From patchwork Sun Jan 13 03:06:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [net-next] pkt_sched: namespace aware ifb Date: Sat, 12 Jan 2013 17:06:14 -0000 From: Eric Dumazet X-Patchwork-Id: 211585 Message-Id: <1358046374.20249.1789.camel@edumazet-glaptop> To: David Miller Cc: socketcan@hartkopp.net, netdev@vger.kernel.org From: Eric Dumazet act_mirred needs to find the current net_ns, and struct net pointer is not provided in the call chain. We run in process context and current->nsproxy->net_ns is the needed pointer. For ifb, things are easier, as the current ifb device can provide the net pointer immediately. Signed-off-by: Eric Dumazet --- drivers/net/ifb.c | 2 +- net/sched/act_mirred.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 344dceb..8216438 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -90,7 +90,7 @@ static void ri_tasklet(unsigned long dev) u64_stats_update_end(&dp->tsync); rcu_read_lock(); - skb->dev = dev_get_by_index_rcu(&init_net, skb->skb_iif); + skb->dev = dev_get_by_index_rcu(dev_net(_dev), skb->skb_iif); if (!skb->dev) { rcu_read_unlock(); dev_kfree_skb(skb); diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 9c0fd0c..f5a7e18 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -88,7 +88,7 @@ static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est, return -EINVAL; } if (parm->ifindex) { - dev = __dev_get_by_index(&init_net, parm->ifindex); + dev = __dev_get_by_index(current->nsproxy->net_ns, parm->ifindex); if (dev == NULL) return -ENODEV; switch (dev->type) {