]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ipv6: add ipv6_fragment hook in ipv6_stub
authorwenxu <wenxu@ucloud.cn>
Fri, 28 Aug 2020 15:14:31 +0000 (23:14 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 31 Aug 2020 19:26:39 +0000 (12:26 -0700)
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>
include/net/ipv6_stubs.h
net/ipv6/addrconf_core.c
net/ipv6/af_inet6.c

index d7a7f7c81e7b047a989bb398eb8141301f1c52e5..8fce558b5fea3cdcab8b80bc73a0e24d7080efd8 100644 (file)
@@ -63,6 +63,9 @@ struct ipv6_stub {
                               int encap_type);
 #endif
        struct neigh_table *nd_tbl;
+
+       int (*ipv6_fragment)(struct net *net, struct sock *sk, struct sk_buff *skb,
+                            int (*output)(struct net *, struct sock *, struct sk_buff *));
 };
 extern const struct ipv6_stub *ipv6_stub __read_mostly;
 
index 9ebf3fe0d2b1fbee3812579a190540639aec1284..c70c192bc91b3c2b05bad082c174a32dfcbc04c5 100644 (file)
@@ -191,6 +191,13 @@ static int eafnosupport_ip6_del_rt(struct net *net, struct fib6_info *rt,
        return -EAFNOSUPPORT;
 }
 
+static int eafnosupport_ipv6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
+                                     int (*output)(struct net *, struct sock *, struct sk_buff *))
+{
+       kfree_skb(skb);
+       return -EAFNOSUPPORT;
+}
+
 const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
        .ipv6_dst_lookup_flow = eafnosupport_ipv6_dst_lookup_flow,
        .ipv6_route_input  = eafnosupport_ipv6_route_input,
@@ -201,6 +208,7 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) {
        .ip6_mtu_from_fib6 = eafnosupport_ip6_mtu_from_fib6,
        .fib6_nh_init      = eafnosupport_fib6_nh_init,
        .ip6_del_rt        = eafnosupport_ip6_del_rt,
+       .ipv6_fragment     = eafnosupport_ipv6_fragment,
 };
 EXPORT_SYMBOL_GPL(ipv6_stub);
 
index d9a14935f402aa3f99a91cddb22ab1260895fe39..e648fbebb1670748de4b22a45356de306a0dc430 100644 (file)
@@ -1027,6 +1027,7 @@ static const struct ipv6_stub ipv6_stub_impl = {
        .xfrm6_rcv_encap = xfrm6_rcv_encap,
 #endif
        .nd_tbl = &nd_tbl,
+       .ipv6_fragment = ip6_fragment,
 };
 
 static const struct ipv6_bpf_stub ipv6_bpf_stub_impl = {