act_mirred: get rid of tcfm_ifindex from struct tcf_mirred
[linux-block.git] / net / sched / act_mirred.c
index 590f56afb985781c0a66b4ecca95ff9b9fdf6705..ff497909c0ada39b838642aeb0c81b0a9aeaf995 100644 (file)
@@ -139,8 +139,6 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
        m->tcf_action = parm->action;
        m->tcfm_eaction = parm->eaction;
        if (dev != NULL) {
-               m->tcfm_ifindex = parm->ifindex;
-               m->net = net;
                if (ret != ACT_P_CREATED)
                        dev_put(rcu_dereference_protected(m->tcfm_dev, 1));
                dev_hold(dev);
@@ -247,13 +245,14 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind,
 {
        unsigned char *b = skb_tail_pointer(skb);
        struct tcf_mirred *m = to_mirred(a);
+       struct net_device *dev = rtnl_dereference(m->tcfm_dev);
        struct tc_mirred opt = {
                .index   = m->tcf_index,
                .action  = m->tcf_action,
                .refcnt  = m->tcf_refcnt - ref,
                .bindcnt = m->tcf_bindcnt - bind,
                .eaction = m->tcfm_eaction,
-               .ifindex = m->tcfm_ifindex,
+               .ifindex = dev ? dev->ifindex : 0,
        };
        struct tcf_t t;
 
@@ -318,7 +317,7 @@ static struct net_device *tcf_mirred_get_dev(const struct tc_action *a)
 {
        struct tcf_mirred *m = to_mirred(a);
 
-       return __dev_get_by_index(m->net, m->tcfm_ifindex);
+       return rtnl_dereference(m->tcfm_dev);
 }
 
 static struct tc_action_ops act_mirred_ops = {