Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: add ipv6_fragment hook in ipv6_stub

Add ipv6_fragment to ipv6_stub to avoid calling netfilter when
access ip6_fragment.

Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

wenxu and committed by
David S. Miller
1d97898b 353ff8cc

+12
+3
include/net/ipv6_stubs.h
··· 63 63 int encap_type); 64 64 #endif 65 65 struct neigh_table *nd_tbl; 66 + 67 + int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb, 68 + int (*output)(struct net *, struct sock *, struct sk_buff *)); 66 69 }; 67 70 extern const struct ipv6_stub *ipv6_stub __read_mostly; 68 71
+8
net/ipv6/addrconf_core.c
··· 191 191 return -EAFNOSUPPORT; 192 192 } 193 193 194 + static int eafnosupport_ipv6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, 195 + int (*output)(struct net *, struct sock *, struct sk_buff *)) 196 + { 197 + kfree_skb(skb); 198 + return -EAFNOSUPPORT; 199 + } 200 + 194 201 const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) { 195 202 .ipv6_dst_lookup_flow = eafnosupport_ipv6_dst_lookup_flow, 196 203 .ipv6_route_input = eafnosupport_ipv6_route_input, ··· 208 201 .ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6, 209 202 .fib6_nh_init = eafnosupport_fib6_nh_init, 210 203 .ip6_del_rt = eafnosupport_ip6_del_rt, 204 + .ipv6_fragment = eafnosupport_ipv6_fragment, 211 205 }; 212 206 EXPORT_SYMBOL_GPL(ipv6_stub); 213 207
+1
net/ipv6/af_inet6.c
··· 1027 1027 .xfrm6_rcv_encap = xfrm6_rcv_encap, 1028 1028 #endif 1029 1029 .nd_tbl = &nd_tbl, 1030 + .ipv6_fragment = ip6_fragment, 1030 1031 }; 1031 1032 1032 1033 static const struct ipv6_bpf_stub ipv6_bpf_stub_impl = {