netfilter: Store net in nf_hook_state
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 16 Sep 2015 01:03:50 +0000 (20:03 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Sep 2015 00:18:32 +0000 (17:18 -0700)
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter.h
include/linux/netfilter_ingress.h

index 1abac85ec9079f163ede72e47de09a5c183ae26b..889ac0e11f014321e3dd6dc7ac86c1284a449e11 100644 (file)
@@ -54,6 +54,7 @@ struct nf_hook_state {
        struct net_device *in;
        struct net_device *out;
        struct sock *sk;
+       struct net *net;
        struct list_head *hook_list;
        int (*okfn)(struct sock *, struct sk_buff *);
 };
@@ -65,6 +66,7 @@ static inline void nf_hook_state_init(struct nf_hook_state *p,
                                      struct net_device *indev,
                                      struct net_device *outdev,
                                      struct sock *sk,
+                                     struct net *net,
                                      int (*okfn)(struct sock *, struct sk_buff *))
 {
        p->hook = hook;
@@ -73,6 +75,7 @@ static inline void nf_hook_state_init(struct nf_hook_state *p,
        p->in = indev;
        p->out = outdev;
        p->sk = sk;
+       p->net = net;
        p->hook_list = hook_list;
        p->okfn = okfn;
 }
@@ -181,7 +184,7 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
                struct nf_hook_state state;
 
                nf_hook_state_init(&state, hook_list, hook, thresh,
-                                  pf, indev, outdev, sk, okfn);
+                                  pf, indev, outdev, sk, net, okfn);
                return nf_hook_slow(skb, &state);
        }
        return 1;
index cb0727fe2b3dbc5894b98867370615295edd3c87..187feabe557c379b2a78bb4467623722e7ed4996 100644 (file)
@@ -17,7 +17,7 @@ static inline int nf_hook_ingress(struct sk_buff *skb)
 
        nf_hook_state_init(&state, &skb->dev->nf_hooks_ingress,
                           NF_NETDEV_INGRESS, INT_MIN, NFPROTO_NETDEV, NULL,
-                          skb->dev, NULL, NULL);
+                          skb->dev, NULL, dev_net(skb->dev), NULL);
        return nf_hook_slow(skb, &state);
 }