Skip to content

Commit

Permalink
netfilter: Push struct net down into nf_afinfo.reroute
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ebiederm authored and ummakynes committed Sep 29, 2015
1 parent 372892e commit d815d90
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/linux/netfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/netfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/nf_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit d815d90

Please sign in to comment.