fragment locally-generated IPsec6 packets that need it
Subsystems (4)
PATCH v2 1/1 fragment locally-generated IPsec6 packets that need it
This patch modifies IPsec6 to fragment IPv6 packets that are locally generated as needed.
Signed-off-by David L Stevens <[email protected]>
include/net/ip6_route.h +10 -0
@@ -164,5 +164,15 @@ static inline int ipv6_unicast_destinatireturn rt->rt6i_flags &RTF_LOCAL ; } +int ip6_fragment (struct sk_buff *skb,int (*output)(struct sk_buff *)); + +static inline int ip6_skb_dst_mtu (struct sk_buff *skb) +{ +struct ipv6_pinfo *np = skb->sk ?inet6_sk (skb->sk) :NULL ; + +return (np && np->pmtudisc ==IPV6_PMTUDISC_PROBE ) ? +skb_dst (skb)->dev->mtu :dst_mtu (skb_dst (skb)); +} +#endif #endif
net/ipv6/ip6_output.c +2 -10
@@ -56,7 +56,7 @@#include <net/checksum.h> #include <linux/mroute6.h> -static int ip6_fragment (struct sk_buff *skb,int (*output)(struct sk_buff *)); +int ip6_fragment (struct sk_buff *skb,int (*output)(struct sk_buff *));int __ip6_local_out (struct sk_buff *skb) {
@@ -145,14 +145,6 @@ static int ip6_finish_output2(struct sk_return -EINVAL ; } -static inline int ip6_skb_dst_mtu (struct sk_buff *skb) -{ -struct ipv6_pinfo *np = skb->sk ?inet6_sk (skb->sk) :NULL ; - -return (np && np->pmtudisc ==IPV6_PMTUDISC_PROBE ) ? -skb_dst (skb)->dev->mtu :dst_mtu (skb_dst (skb)); -} -static int ip6_finish_output (struct sk_buff *skb) { if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) ||
@@ -601,7 +593,7 @@ int ip6_find_1stfragopt(struct sk_buff *return offset; } -static int ip6_fragment (struct sk_buff *skb,int (*output)(struct sk_buff *)) +int ip6_fragment (struct sk_buff *skb,int (*output)(struct sk_buff *)) {struct sk_buff *frag;struct rt6_info *rt = (struct rt6_info *)skb_dst (skb);
net/ipv6/xfrm6_output.c +11 -1
@@ -17,6 +17,7 @@#include <linux/netfilter_ipv6.h> #include <net/dst.h> #include <net/ipv6.h> +#include <net/ip6_route.h> #include <net/xfrm.h> int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
@@ -88,8 +89,17 @@ static int xfrm6_output_finish(struct skreturn xfrm_output (skb); } -int xfrm6_output (struct sk_buff *skb) +static int __xfrm6_output (struct sk_buff *skb) {return NF_HOOK (NFPROTO_IPV6 ,NF_INET_POST_ROUTING , skb,NULL ,skb_dst (skb)->dev, xfrm6_output_finish); } + +int xfrm6_output (struct sk_buff *skb) +{ +if ((skb->len >ip6_skb_dst_mtu (skb) && !skb_is_gso (skb)) || +dst_allfrag (skb_dst (skb))) { +return ip6_fragment (skb, __xfrm6_output); + } +return __xfrm6_output (skb); +}
Herbert Xu
maintainerQuoted 10 lines · David L Stevens
net/ipv6/xfrm6_output.c +1
-1@@ -88,8 +89,17 @@ static int xfrm6_output_finish(struct skreturn xfrm_output (skb); } -int xfrm6_output (struct sk_buff *skb) +static int __xfrm6_output (struct sk_buff *skb) {return NF_HOOK (NFPROTO_IPV6 ,NF_INET_POST_ROUTING , skb,NULL ,skb_dst (skb)->dev, xfrm6_output_finish);
net/ipv6/xfrm6_output.c static int xfrm6_output_finish(struct sk · line 105
Quoted 10 lines
net/ipv6/xfrm6_output.c +9
-0} + +int xfrm6_output (struct sk_buff *skb) +{ +if ((skb->len >ip6_skb_dst_mtu (skb) && !skb_is_gso (skb)) || +dst_allfrag (skb_dst (skb))) { +return ip6_fragment (skb, __xfrm6_output); + } +return __xfrm6_output (skb); +}
Oops, I didn't notice this the first time around. The fragmentation call should occur after POST_ROUTING.
Thanks,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt