Release 4.11 net/ipv4/xfrm4_output.c
/*
* xfrm4_output.c - Common IPsec encapsulation code for IPv4.
* Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/if_ether.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netfilter_ipv4.h>
#include <net/dst.h>
#include <net/ip.h>
#include <net/xfrm.h>
#include <net/icmp.h>
static int xfrm4_tunnel_check_size(struct sk_buff *skb)
{
int mtu, ret = 0;
if (IPCB(skb)->flags & IPSKB_XFRM_TUNNEL_SIZE)
goto out;
if (!(ip_hdr(skb)->frag_off & htons(IP_DF)) || skb->ignore_df)
goto out;
mtu = dst_mtu(skb_dst(skb));
if (skb->len > mtu) {
skb->protocol = htons(ETH_P_IP);
if (skb->sk)
xfrm_local_error(skb, mtu);
else
icmp_send(skb, ICMP_DEST_UNREACH,
ICMP_FRAG_NEEDED, htonl(mtu));
ret = -EMSGSIZE;
}
out:
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Herbert Xu | 90 | 73.17% | 2 | 22.22% |
Steffen Klassert | 22 | 17.89% | 2 | 22.22% |
Hannes Frederic Sowa | 6 | 4.88% | 3 | 33.33% |
Arnaldo Carvalho de Melo | 4 | 3.25% | 1 | 11.11% |
Américo Wang | 1 | 0.81% | 1 | 11.11% |
Total | 123 | 100.00% | 9 | 100.00% |
int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb)
{
int err;
err = xfrm4_tunnel_check_size(skb);
if (err)
return err;
XFRM_MODE_SKB_CB(skb)->protocol = ip_hdr(skb)->protocol;
return xfrm4_extract_header(skb);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Herbert Xu | 52 | 100.00% | 4 | 100.00% |
Total | 52 | 100.00% | 4 | 100.00% |
int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb)
{
int err;
err = xfrm_inner_extract_output(x, skb);
if (err)
return err;
IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE;
skb->protocol = htons(ETH_P_IP);
return x->outer_mode->output2(x, skb);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Herbert Xu | 54 | 84.38% | 4 | 66.67% |
Steffen Klassert | 9 | 14.06% | 1 | 16.67% |
Kazunori Miyazawa | 1 | 1.56% | 1 | 16.67% |
Total | 64 | 100.00% | 6 | 100.00% |
EXPORT_SYMBOL(xfrm4_prepare_output);
int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb)
{
memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
#ifdef CONFIG_NETFILTER
IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED;
#endif
return xfrm_output(sk, skb);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Herbert Xu | 36 | 64.29% | 2 | 40.00% |
Steffen Klassert | 11 | 19.64% | 1 | 20.00% |
David S. Miller | 7 | 12.50% | 1 | 20.00% |
Eric Dumazet | 2 | 3.57% | 1 | 20.00% |
Total | 56 | 100.00% | 5 | 100.00% |
static int __xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb)
{
struct xfrm_state *x = skb_dst(skb)->xfrm;
#ifdef CONFIG_NETFILTER
if (!x) {
IPCB(skb)->flags |= IPSKB_REROUTED;
return dst_output(net, sk, skb);
}
#endif
return x->outer_mode->afinfo->output_finish(sk, skb);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Herbert Xu | 28 | 35.90% | 2 | 20.00% |
Steffen Klassert | 22 | 28.21% | 2 | 20.00% |
David S. Miller | 9 | 11.54% | 1 | 10.00% |
Patrick McHardy | 8 | 10.26% | 1 | 10.00% |
Eric W. Biedermann | 8 | 10.26% | 3 | 30.00% |
Eric Dumazet | 3 | 3.85% | 1 | 10.00% |
Total | 78 | 100.00% | 10 | 100.00% |
int xfrm4_output(struct net *net, struct sock *sk, struct sk_buff *skb)
{
return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING,
net, sk, skb, NULL, skb_dst(skb)->dev,
__xfrm4_output,
!(IPCB(skb)->flags & IPSKB_REROUTED));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Patrick McHardy | 37 | 64.91% | 3 | 33.33% |
Eric W. Biedermann | 7 | 12.28% | 2 | 22.22% |
Steffen Klassert | 5 | 8.77% | 1 | 11.11% |
Eric Dumazet | 5 | 8.77% | 1 | 11.11% |
David S. Miller | 2 | 3.51% | 1 | 11.11% |
Jan Engelhardt | 1 | 1.75% | 1 | 11.11% |
Total | 57 | 100.00% | 9 | 100.00% |
void xfrm4_local_error(struct sk_buff *skb, u32 mtu)
{
struct iphdr *hdr;
hdr = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb);
ip_local_error(skb->sk, EMSGSIZE, hdr->daddr,
inet_sk(skb->sk)->inet_dport, mtu);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Hannes Frederic Sowa | 58 | 100.00% | 1 | 100.00% |
Total | 58 | 100.00% | 1 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Herbert Xu | 287 | 55.09% | 10 | 29.41% |
Steffen Klassert | 69 | 13.24% | 5 | 14.71% |
Hannes Frederic Sowa | 64 | 12.28% | 3 | 8.82% |
Patrick McHardy | 50 | 9.60% | 3 | 8.82% |
David S. Miller | 18 | 3.45% | 1 | 2.94% |
Eric W. Biedermann | 15 | 2.88% | 5 | 14.71% |
Eric Dumazet | 10 | 1.92% | 2 | 5.88% |
Arnaldo Carvalho de Melo | 4 | 0.77% | 1 | 2.94% |
Hideaki Yoshifuji / 吉藤英明 | 1 | 0.19% | 1 | 2.94% |
Kazunori Miyazawa | 1 | 0.19% | 1 | 2.94% |
Américo Wang | 1 | 0.19% | 1 | 2.94% |
Jan Engelhardt | 1 | 0.19% | 1 | 2.94% |
Total | 521 | 100.00% | 34 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.