ipv6: Pass struct net into nf_ct_frag6_gather
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 9 Oct 2015 18:44:55 +0000 (13:44 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Oct 2015 02:44:17 +0000 (19:44 -0700)
The function nf_ct_frag6_gather is called on both the input and the
output paths of the networking stack.  In particular ipv6_defrag which
calls nf_ct_frag6_gather is called from both the the PRE_ROUTING chain
on input and the LOCAL_OUT chain on output.

The addition of a net parameter makes it explicit which network
namespace the packets are being reassembled in, and removes the need
for nf_ct_frag6_gather to guess.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netfilter/ipv6/nf_defrag_ipv6.h
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c
net/openvswitch/conntrack.c

index 27666d8a0bd07f38f644bf7c768678ade981155b..fb7da5bb76cc8a58716b59d1ed421868ce18c697 100644 (file)
@@ -5,7 +5,7 @@ void nf_defrag_ipv6_enable(void);
 
 int nf_ct_frag6_init(void);
 void nf_ct_frag6_cleanup(void);
-struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
+struct sk_buff *nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user);
 void nf_ct_frag6_consume_orig(struct sk_buff *skb);
 
 struct inet_frags_ctl;
index 701cd2bae0a9224d56005f67d8b9f5e71f45825f..2fb86a99bf5f1325cb97e1bd75c5870b38f64116 100644 (file)
@@ -563,12 +563,10 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
        return 0;
 }
 
-struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user)
+struct sk_buff *nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)
 {
        struct sk_buff *clone;
        struct net_device *dev = skb->dev;
-       struct net *net = skb_dst(skb) ? dev_net(skb_dst(skb)->dev)
-                                      : dev_net(skb->dev);
        struct frag_hdr *fhdr;
        struct frag_queue *fq;
        struct ipv6hdr *hdr;
index a99baf63eccf7768eb07777310ea8ba5aad2067b..5173a89a238ef37e2862b7e91abafb84700fc191 100644 (file)
@@ -63,7 +63,8 @@ static unsigned int ipv6_defrag(void *priv,
                return NF_ACCEPT;
 #endif
 
-       reasm = nf_ct_frag6_gather(skb, nf_ct6_defrag_user(state->hook, skb));
+       reasm = nf_ct_frag6_gather(state->net, skb,
+                                  nf_ct6_defrag_user(state->hook, skb));
        /* queued */
        if (reasm == NULL)
                return NF_STOLEN;
index cb76076a7a42f49b3b2656199b304a306505ae46..ad614267cc2a620249e18e4ef6bec35c7fa19f8f 100644 (file)
@@ -315,7 +315,7 @@ static int handle_fragments(struct net *net, struct sw_flow_key *key,
                struct sk_buff *reasm;
 
                memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));
-               reasm = nf_ct_frag6_gather(skb, user);
+               reasm = nf_ct_frag6_gather(net, skb, user);
                if (!reasm)
                        return -EINPROGRESS;