aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_api.c
diff options
context:
space:
mode:
authorBenjamin LaHaise <bcrl@kvack.org>2013-01-14 00:15:39 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-14 15:09:36 -0500
commitc1b52739e45f5969b208ebc377f52468280af11e (patch)
tree313ee0c665f27b7d3ea31c8984879930f1de7021 /net/sched/act_api.c
parent605928337866c6369ae60509fa2b10af325a25eb (diff)
pkt_sched: namespace aware act_mirred
Eric Dumazet pointed out that act_mirred needs to find the current net_ns, and struct net pointer is not provided in the call chain. His original patch made use of current->nsproxy->net_ns to find the network namespace, but this fails to work correctly for userspace code that makes use of netlink sockets in different network namespaces. Instead, pass the "struct net *" down along the call chain to where it is needed. This version removes the ifb changes as Eric has submitted that patch separately, but is otherwise identical to the previous version. Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Tested-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_api.c')
-rw-r--r--net/sched/act_api.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 65d240cbf74b..8579c4bb20c9 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -485,8 +485,9 @@ errout:
485 return err; 485 return err;
486} 486}
487 487
488struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, 488struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla,
489 char *name, int ovr, int bind) 489 struct nlattr *est, char *name, int ovr,
490 int bind)
490{ 491{
491 struct tc_action *a; 492 struct tc_action *a;
492 struct tc_action_ops *a_o; 493 struct tc_action_ops *a_o;
@@ -542,9 +543,9 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est,
542 543
543 /* backward compatibility for policer */ 544 /* backward compatibility for policer */
544 if (name == NULL) 545 if (name == NULL)
545 err = a_o->init(tb[TCA_ACT_OPTIONS], est, a, ovr, bind); 546 err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, a, ovr, bind);
546 else 547 else
547 err = a_o->init(nla, est, a, ovr, bind); 548 err = a_o->init(net, nla, est, a, ovr, bind);
548 if (err < 0) 549 if (err < 0)
549 goto err_free; 550 goto err_free;
550 551
@@ -566,8 +567,9 @@ err_out:
566 return ERR_PTR(err); 567 return ERR_PTR(err);
567} 568}
568 569
569struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, 570struct tc_action *tcf_action_init(struct net *net, struct nlattr *nla,
570 char *name, int ovr, int bind) 571 struct nlattr *est, char *name, int ovr,
572 int bind)
571{ 573{
572 struct nlattr *tb[TCA_ACT_MAX_PRIO + 1]; 574 struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
573 struct tc_action *head = NULL, *act, *act_prev = NULL; 575 struct tc_action *head = NULL, *act, *act_prev = NULL;
@@ -579,7 +581,7 @@ struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est,
579 return ERR_PTR(err); 581 return ERR_PTR(err);
580 582
581 for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { 583 for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
582 act = tcf_action_init_1(tb[i], est, name, ovr, bind); 584 act = tcf_action_init_1(net, tb[i], est, name, ovr, bind);
583 if (IS_ERR(act)) 585 if (IS_ERR(act))
584 goto err; 586 goto err;
585 act->order = i; 587 act->order = i;
@@ -960,7 +962,7 @@ tcf_action_add(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
960 struct tc_action *a; 962 struct tc_action *a;
961 u32 seq = n->nlmsg_seq; 963 u32 seq = n->nlmsg_seq;
962 964
963 act = tcf_action_init(nla, NULL, NULL, ovr, 0); 965 act = tcf_action_init(net, nla, NULL, NULL, ovr, 0);
964 if (act == NULL) 966 if (act == NULL)
965 goto done; 967 goto done;
966 if (IS_ERR(act)) { 968 if (IS_ERR(act)) {