Skip to content

Commit

Permalink
netfilter: nf_flow_table: do not remove offload when other netns's in…
Browse files Browse the repository at this point in the history
…terface is down

When interface is down, offload cleanup function(nf_flow_table_do_cleanup)
is called and that checks whether interface index of offload and
index of link down interface is same. but only interface index checking
is not enough because flowtable is not pernet list.
So that, if other netns's interface that has index is same with offload
is down, that offload will be removed.
This patch adds netns checking code to the offload cleanup routine.

Fixes: 59c466d ("netfilter: nf_flow_table: add a new flow state for tearing down offloading")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
TaeheeYoo authored and ummakynes committed Oct 19, 2018
1 parent b7f1a16 commit a3fb369
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/netfilter/nf_flow_table_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,17 @@ EXPORT_SYMBOL_GPL(nf_flow_table_init);
static void nf_flow_table_do_cleanup(struct flow_offload *flow, void *data)
{
struct net_device *dev = data;
struct flow_offload_entry *e;

e = container_of(flow, struct flow_offload_entry, flow);

if (!dev) {
flow_offload_teardown(flow);
return;
}

if (flow->tuplehash[0].tuple.iifidx == dev->ifindex ||
flow->tuplehash[1].tuple.iifidx == dev->ifindex)
if (net_eq(nf_ct_net(e->ct), dev_net(dev)) &&
(flow->tuplehash[0].tuple.iifidx == dev->ifindex ||
flow->tuplehash[1].tuple.iifidx == dev->ifindex))
flow_offload_dead(flow);
}

Expand Down

0 comments on commit a3fb369

Please sign in to comment.