netfilter: Push struct net down into nf_afinfo.reroute
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 25 Sep 2015 20:07:28 +0000 (15:07 -0500)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 29 Sep 2015 18:21:31 +0000 (20:21 +0200)
The network namespace is needed when routing a packet.
Stop making nf_afinfo.reroute guess which network namespace
is the proper namespace to route the packet in.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/linux/netfilter.h
net/ipv4/netfilter.c
net/ipv6/netfilter.c
net/netfilter/nf_queue.c

index 987c74cd523cbdf8bf9799eb8e9c6512dc6808a6..165ab2d14734ade6b0766f96fdd8fdb904ba94ea 100644 (file)
@@ -283,7 +283,7 @@ struct nf_afinfo {
                                 struct flowi *fl, bool strict);
        void            (*saveroute)(const struct sk_buff *skb,
                                     struct nf_queue_entry *entry);
-       int             (*reroute)(struct sk_buff *skb,
+       int             (*reroute)(struct net *net, struct sk_buff *skb,
                                   const struct nf_queue_entry *entry);
        int             route_key_size;
 };
index 61eafc9b4545d5a9e1ea405e196753b3608c5fa0..9e07e6f23398144cdb4eb455f89e757eeafee18e 100644 (file)
@@ -104,7 +104,7 @@ static void nf_ip_saveroute(const struct sk_buff *skb,
        }
 }
 
-static int nf_ip_reroute(struct sk_buff *skb,
+static int nf_ip_reroute(struct net *net, struct sk_buff *skb,
                         const struct nf_queue_entry *entry)
 {
        const struct ip_rt_info *rt_info = nf_queue_entry_reroute(entry);
index b4de08a83e0b8da054fb7eb4f48d88a999795e6f..26911b93dc7ad8c13a62c55f9db3bdd6c3971956 100644 (file)
@@ -93,7 +93,7 @@ static void nf_ip6_saveroute(const struct sk_buff *skb,
        }
 }
 
-static int nf_ip6_reroute(struct sk_buff *skb,
+static int nf_ip6_reroute(struct net *net, struct sk_buff *skb,
                          const struct nf_queue_entry *entry)
 {
        struct ip6_rt_info *rt_info = nf_queue_entry_reroute(entry);
index 9f3c3c25fa733289adb735a095294f8237a3263d..34f628e16a4cf7e460342311cbdbf579199c158b 100644 (file)
@@ -199,7 +199,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
 
        if (verdict == NF_ACCEPT) {
                afinfo = nf_get_afinfo(entry->state.pf);
-               if (!afinfo || afinfo->reroute(skb, entry) < 0)
+               if (!afinfo || afinfo->reroute(entry->state.net, skb, entry) < 0)
                        verdict = NF_DROP;
        }