diff options
author | Benjamin LaHaise <bcrl@kvack.org> | 2013-01-14 00:15:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-14 15:09:36 -0500 |
commit | c1b52739e45f5969b208ebc377f52468280af11e (patch) | |
tree | 313ee0c665f27b7d3ea31c8984879930f1de7021 | |
parent | 605928337866c6369ae60509fa2b10af325a25eb (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>
-rw-r--r-- | include/net/act_api.h | 12 | ||||
-rw-r--r-- | include/net/pkt_cls.h | 7 | ||||
-rw-r--r-- | include/net/sch_generic.h | 2 | ||||
-rw-r--r-- | net/sched/act_api.c | 18 | ||||
-rw-r--r-- | net/sched/act_csum.c | 2 | ||||
-rw-r--r-- | net/sched/act_gact.c | 5 | ||||
-rw-r--r-- | net/sched/act_ipt.c | 2 | ||||
-rw-r--r-- | net/sched/act_mirred.c | 7 | ||||
-rw-r--r-- | net/sched/act_nat.c | 2 | ||||
-rw-r--r-- | net/sched/act_pedit.c | 5 | ||||
-rw-r--r-- | net/sched/act_police.c | 5 | ||||
-rw-r--r-- | net/sched/act_simple.c | 5 | ||||
-rw-r--r-- | net/sched/act_skbedit.c | 5 | ||||
-rw-r--r-- | net/sched/cls_api.c | 11 | ||||
-rw-r--r-- | net/sched/cls_basic.c | 13 | ||||
-rw-r--r-- | net/sched/cls_cgroup.c | 5 | ||||
-rw-r--r-- | net/sched/cls_flow.c | 4 | ||||
-rw-r--r-- | net/sched/cls_fw.c | 10 | ||||
-rw-r--r-- | net/sched/cls_route.c | 15 | ||||
-rw-r--r-- | net/sched/cls_rsvp.h | 4 | ||||
-rw-r--r-- | net/sched/cls_tcindex.c | 14 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 13 |
22 files changed, 94 insertions, 72 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h index c739531e1564..112c25c393a2 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -91,7 +91,9 @@ struct tc_action_ops { | |||
91 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); | 91 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
92 | int (*cleanup)(struct tc_action *, int bind); | 92 | int (*cleanup)(struct tc_action *, int bind); |
93 | int (*lookup)(struct tc_action *, u32); | 93 | int (*lookup)(struct tc_action *, u32); |
94 | int (*init)(struct nlattr *, struct nlattr *, struct tc_action *, int , int); | 94 | int (*init)(struct net *net, struct nlattr *nla, |
95 | struct nlattr *est, struct tc_action *act, int ovr, | ||
96 | int bind); | ||
95 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); | 97 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); |
96 | }; | 98 | }; |
97 | 99 | ||
@@ -116,8 +118,12 @@ extern int tcf_register_action(struct tc_action_ops *a); | |||
116 | extern int tcf_unregister_action(struct tc_action_ops *a); | 118 | extern int tcf_unregister_action(struct tc_action_ops *a); |
117 | extern void tcf_action_destroy(struct tc_action *a, int bind); | 119 | extern void tcf_action_destroy(struct tc_action *a, int bind); |
118 | extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res); | 120 | extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res); |
119 | extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); | 121 | extern struct tc_action *tcf_action_init(struct net *net, struct nlattr *nla, |
120 | extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); | 122 | struct nlattr *est, char *n, int ovr, |
123 | int bind); | ||
124 | extern struct tc_action *tcf_action_init_1(struct net *net, struct nlattr *nla, | ||
125 | struct nlattr *est, char *n, int ovr, | ||
126 | int bind); | ||
121 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); | 127 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); |
122 | extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); | 128 | extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); |
123 | extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); | 129 | extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 9fcc680ab6b9..13174509cdfd 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -126,9 +126,10 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts, | |||
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
128 | 128 | ||
129 | extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, | 129 | extern int tcf_exts_validate(struct net *net, struct tcf_proto *tp, |
130 | struct nlattr *rate_tlv, struct tcf_exts *exts, | 130 | struct nlattr **tb, struct nlattr *rate_tlv, |
131 | const struct tcf_ext_map *map); | 131 | struct tcf_exts *exts, |
132 | const struct tcf_ext_map *map); | ||
132 | extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); | 133 | extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); |
133 | extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, | 134 | extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, |
134 | struct tcf_exts *src); | 135 | struct tcf_exts *src); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 1540f9c2fcf4..2d06c2a53de1 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -195,7 +195,7 @@ struct tcf_proto_ops { | |||
195 | 195 | ||
196 | unsigned long (*get)(struct tcf_proto*, u32 handle); | 196 | unsigned long (*get)(struct tcf_proto*, u32 handle); |
197 | void (*put)(struct tcf_proto*, unsigned long); | 197 | void (*put)(struct tcf_proto*, unsigned long); |
198 | int (*change)(struct sk_buff *, | 198 | int (*change)(struct net *net, struct sk_buff *, |
199 | struct tcf_proto*, unsigned long, | 199 | struct tcf_proto*, unsigned long, |
200 | u32 handle, struct nlattr **, | 200 | u32 handle, struct nlattr **, |
201 | unsigned long *); | 201 | unsigned long *); |
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 | ||
488 | struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, | 488 | struct 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 | ||
569 | struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, | 570 | struct 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)) { |
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 2c8ad7c86e43..08fa1e8a4ca4 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c | |||
@@ -51,7 +51,7 @@ static const struct nla_policy csum_policy[TCA_CSUM_MAX + 1] = { | |||
51 | [TCA_CSUM_PARMS] = { .len = sizeof(struct tc_csum), }, | 51 | [TCA_CSUM_PARMS] = { .len = sizeof(struct tc_csum), }, |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int tcf_csum_init(struct nlattr *nla, struct nlattr *est, | 54 | static int tcf_csum_init(struct net *n, struct nlattr *nla, struct nlattr *est, |
55 | struct tc_action *a, int ovr, int bind) | 55 | struct tc_action *a, int ovr, int bind) |
56 | { | 56 | { |
57 | struct nlattr *tb[TCA_CSUM_MAX + 1]; | 57 | struct nlattr *tb[TCA_CSUM_MAX + 1]; |
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 05d60859d8e3..fd2b3cff5fa2 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -58,8 +58,9 @@ static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = { | |||
58 | [TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) }, | 58 | [TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) }, |
59 | }; | 59 | }; |
60 | 60 | ||
61 | static int tcf_gact_init(struct nlattr *nla, struct nlattr *est, | 61 | static int tcf_gact_init(struct net *net, struct nlattr *nla, |
62 | struct tc_action *a, int ovr, int bind) | 62 | struct nlattr *est, struct tc_action *a, |
63 | int ovr, int bind) | ||
63 | { | 64 | { |
64 | struct nlattr *tb[TCA_GACT_MAX + 1]; | 65 | struct nlattr *tb[TCA_GACT_MAX + 1]; |
65 | struct tc_gact *parm; | 66 | struct tc_gact *parm; |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 58fb3c7aab9e..0fb9e3f567e6 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -102,7 +102,7 @@ static const struct nla_policy ipt_policy[TCA_IPT_MAX + 1] = { | |||
102 | [TCA_IPT_TARG] = { .len = sizeof(struct xt_entry_target) }, | 102 | [TCA_IPT_TARG] = { .len = sizeof(struct xt_entry_target) }, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static int tcf_ipt_init(struct nlattr *nla, struct nlattr *est, | 105 | static int tcf_ipt_init(struct net *net, struct nlattr *nla, struct nlattr *est, |
106 | struct tc_action *a, int ovr, int bind) | 106 | struct tc_action *a, int ovr, int bind) |
107 | { | 107 | { |
108 | struct nlattr *tb[TCA_IPT_MAX + 1]; | 108 | struct nlattr *tb[TCA_IPT_MAX + 1]; |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 9c0fd0c78814..5d676edc22a6 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -62,8 +62,9 @@ static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = { | |||
62 | [TCA_MIRRED_PARMS] = { .len = sizeof(struct tc_mirred) }, | 62 | [TCA_MIRRED_PARMS] = { .len = sizeof(struct tc_mirred) }, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est, | 65 | static int tcf_mirred_init(struct net *net, struct nlattr *nla, |
66 | struct tc_action *a, int ovr, int bind) | 66 | struct nlattr *est, struct tc_action *a, int ovr, |
67 | int bind) | ||
67 | { | 68 | { |
68 | struct nlattr *tb[TCA_MIRRED_MAX + 1]; | 69 | struct nlattr *tb[TCA_MIRRED_MAX + 1]; |
69 | struct tc_mirred *parm; | 70 | struct tc_mirred *parm; |
@@ -88,7 +89,7 @@ static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est, | |||
88 | return -EINVAL; | 89 | return -EINVAL; |
89 | } | 90 | } |
90 | if (parm->ifindex) { | 91 | if (parm->ifindex) { |
91 | dev = __dev_get_by_index(&init_net, parm->ifindex); | 92 | dev = __dev_get_by_index(net, parm->ifindex); |
92 | if (dev == NULL) | 93 | if (dev == NULL) |
93 | return -ENODEV; | 94 | return -ENODEV; |
94 | switch (dev->type) { | 95 | switch (dev->type) { |
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index b5d029eb44f2..876f0ef29694 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c | |||
@@ -44,7 +44,7 @@ static const struct nla_policy nat_policy[TCA_NAT_MAX + 1] = { | |||
44 | [TCA_NAT_PARMS] = { .len = sizeof(struct tc_nat) }, | 44 | [TCA_NAT_PARMS] = { .len = sizeof(struct tc_nat) }, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int tcf_nat_init(struct nlattr *nla, struct nlattr *est, | 47 | static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est, |
48 | struct tc_action *a, int ovr, int bind) | 48 | struct tc_action *a, int ovr, int bind) |
49 | { | 49 | { |
50 | struct nlattr *tb[TCA_NAT_MAX + 1]; | 50 | struct nlattr *tb[TCA_NAT_MAX + 1]; |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 45c53ab067a6..0c3faddf3f2c 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -38,8 +38,9 @@ static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = { | |||
38 | [TCA_PEDIT_PARMS] = { .len = sizeof(struct tc_pedit) }, | 38 | [TCA_PEDIT_PARMS] = { .len = sizeof(struct tc_pedit) }, |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est, | 41 | static int tcf_pedit_init(struct net *net, struct nlattr *nla, |
42 | struct tc_action *a, int ovr, int bind) | 42 | struct nlattr *est, struct tc_action *a, |
43 | int ovr, int bind) | ||
43 | { | 44 | { |
44 | struct nlattr *tb[TCA_PEDIT_MAX + 1]; | 45 | struct nlattr *tb[TCA_PEDIT_MAX + 1]; |
45 | struct tc_pedit *parm; | 46 | struct tc_pedit *parm; |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index a9de23297d47..8dbd695c160b 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -130,8 +130,9 @@ static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = { | |||
130 | [TCA_POLICE_RESULT] = { .type = NLA_U32 }, | 130 | [TCA_POLICE_RESULT] = { .type = NLA_U32 }, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est, | 133 | static int tcf_act_police_locate(struct net *net, struct nlattr *nla, |
134 | struct tc_action *a, int ovr, int bind) | 134 | struct nlattr *est, struct tc_action *a, |
135 | int ovr, int bind) | ||
135 | { | 136 | { |
136 | unsigned int h; | 137 | unsigned int h; |
137 | int ret = 0, err; | 138 | int ret = 0, err; |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 3714f60f0b3c..7725eb4ab756 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -95,8 +95,9 @@ static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { | |||
95 | [TCA_DEF_DATA] = { .type = NLA_STRING, .len = SIMP_MAX_DATA }, | 95 | [TCA_DEF_DATA] = { .type = NLA_STRING, .len = SIMP_MAX_DATA }, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | 98 | static int tcf_simp_init(struct net *net, struct nlattr *nla, |
99 | struct tc_action *a, int ovr, int bind) | 99 | struct nlattr *est, struct tc_action *a, |
100 | int ovr, int bind) | ||
100 | { | 101 | { |
101 | struct nlattr *tb[TCA_DEF_MAX + 1]; | 102 | struct nlattr *tb[TCA_DEF_MAX + 1]; |
102 | struct tc_defact *parm; | 103 | struct tc_defact *parm; |
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 476e0fac6712..cb4221171f93 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
@@ -67,8 +67,9 @@ static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = { | |||
67 | [TCA_SKBEDIT_MARK] = { .len = sizeof(u32) }, | 67 | [TCA_SKBEDIT_MARK] = { .len = sizeof(u32) }, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static int tcf_skbedit_init(struct nlattr *nla, struct nlattr *est, | 70 | static int tcf_skbedit_init(struct net *net, struct nlattr *nla, |
71 | struct tc_action *a, int ovr, int bind) | 71 | struct nlattr *est, struct tc_action *a, |
72 | int ovr, int bind) | ||
72 | { | 73 | { |
73 | struct nlattr *tb[TCA_SKBEDIT_MAX + 1]; | 74 | struct nlattr *tb[TCA_SKBEDIT_MAX + 1]; |
74 | struct tc_skbedit *parm; | 75 | struct tc_skbedit *parm; |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index ff55ed6c49b2..964f5e4f4b8a 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -321,7 +321,7 @@ replay: | |||
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | err = tp->ops->change(skb, tp, cl, t->tcm_handle, tca, &fh); | 324 | err = tp->ops->change(net, skb, tp, cl, t->tcm_handle, tca, &fh); |
325 | if (err == 0) { | 325 | if (err == 0) { |
326 | if (tp_created) { | 326 | if (tp_created) { |
327 | spin_lock_bh(root_lock); | 327 | spin_lock_bh(root_lock); |
@@ -508,7 +508,7 @@ void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts) | |||
508 | } | 508 | } |
509 | EXPORT_SYMBOL(tcf_exts_destroy); | 509 | EXPORT_SYMBOL(tcf_exts_destroy); |
510 | 510 | ||
511 | int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, | 511 | int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, |
512 | struct nlattr *rate_tlv, struct tcf_exts *exts, | 512 | struct nlattr *rate_tlv, struct tcf_exts *exts, |
513 | const struct tcf_ext_map *map) | 513 | const struct tcf_ext_map *map) |
514 | { | 514 | { |
@@ -519,7 +519,7 @@ int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, | |||
519 | struct tc_action *act; | 519 | struct tc_action *act; |
520 | 520 | ||
521 | if (map->police && tb[map->police]) { | 521 | if (map->police && tb[map->police]) { |
522 | act = tcf_action_init_1(tb[map->police], rate_tlv, | 522 | act = tcf_action_init_1(net, tb[map->police], rate_tlv, |
523 | "police", TCA_ACT_NOREPLACE, | 523 | "police", TCA_ACT_NOREPLACE, |
524 | TCA_ACT_BIND); | 524 | TCA_ACT_BIND); |
525 | if (IS_ERR(act)) | 525 | if (IS_ERR(act)) |
@@ -528,8 +528,9 @@ int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, | |||
528 | act->type = TCA_OLD_COMPAT; | 528 | act->type = TCA_OLD_COMPAT; |
529 | exts->action = act; | 529 | exts->action = act; |
530 | } else if (map->action && tb[map->action]) { | 530 | } else if (map->action && tb[map->action]) { |
531 | act = tcf_action_init(tb[map->action], rate_tlv, NULL, | 531 | act = tcf_action_init(net, tb[map->action], rate_tlv, |
532 | TCA_ACT_NOREPLACE, TCA_ACT_BIND); | 532 | NULL, TCA_ACT_NOREPLACE, |
533 | TCA_ACT_BIND); | ||
533 | if (IS_ERR(act)) | 534 | if (IS_ERR(act)) |
534 | return PTR_ERR(act); | 535 | return PTR_ERR(act); |
535 | 536 | ||
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 344a11b342e5..d76a35d0dc85 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -132,15 +132,16 @@ static const struct nla_policy basic_policy[TCA_BASIC_MAX + 1] = { | |||
132 | [TCA_BASIC_EMATCHES] = { .type = NLA_NESTED }, | 132 | [TCA_BASIC_EMATCHES] = { .type = NLA_NESTED }, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | static int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f, | 135 | static int basic_set_parms(struct net *net, struct tcf_proto *tp, |
136 | unsigned long base, struct nlattr **tb, | 136 | struct basic_filter *f, unsigned long base, |
137 | struct nlattr **tb, | ||
137 | struct nlattr *est) | 138 | struct nlattr *est) |
138 | { | 139 | { |
139 | int err = -EINVAL; | 140 | int err = -EINVAL; |
140 | struct tcf_exts e; | 141 | struct tcf_exts e; |
141 | struct tcf_ematch_tree t; | 142 | struct tcf_ematch_tree t; |
142 | 143 | ||
143 | err = tcf_exts_validate(tp, tb, est, &e, &basic_ext_map); | 144 | err = tcf_exts_validate(net, tp, tb, est, &e, &basic_ext_map); |
144 | if (err < 0) | 145 | if (err < 0) |
145 | return err; | 146 | return err; |
146 | 147 | ||
@@ -162,7 +163,7 @@ errout: | |||
162 | return err; | 163 | return err; |
163 | } | 164 | } |
164 | 165 | ||
165 | static int basic_change(struct sk_buff *in_skb, | 166 | static int basic_change(struct net *net, struct sk_buff *in_skb, |
166 | struct tcf_proto *tp, unsigned long base, u32 handle, | 167 | struct tcf_proto *tp, unsigned long base, u32 handle, |
167 | struct nlattr **tca, unsigned long *arg) | 168 | struct nlattr **tca, unsigned long *arg) |
168 | { | 169 | { |
@@ -182,7 +183,7 @@ static int basic_change(struct sk_buff *in_skb, | |||
182 | if (f != NULL) { | 183 | if (f != NULL) { |
183 | if (handle && f->handle != handle) | 184 | if (handle && f->handle != handle) |
184 | return -EINVAL; | 185 | return -EINVAL; |
185 | return basic_set_parms(tp, f, base, tb, tca[TCA_RATE]); | 186 | return basic_set_parms(net, tp, f, base, tb, tca[TCA_RATE]); |
186 | } | 187 | } |
187 | 188 | ||
188 | err = -ENOBUFS; | 189 | err = -ENOBUFS; |
@@ -208,7 +209,7 @@ static int basic_change(struct sk_buff *in_skb, | |||
208 | f->handle = head->hgenerator; | 209 | f->handle = head->hgenerator; |
209 | } | 210 | } |
210 | 211 | ||
211 | err = basic_set_parms(tp, f, base, tb, tca[TCA_RATE]); | 212 | err = basic_set_parms(net, tp, f, base, tb, tca[TCA_RATE]); |
212 | if (err < 0) | 213 | if (err < 0) |
213 | goto errout; | 214 | goto errout; |
214 | 215 | ||
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 6db7855b9029..3a294eb98d61 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -178,7 +178,7 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = { | |||
178 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, | 178 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, |
179 | }; | 179 | }; |
180 | 180 | ||
181 | static int cls_cgroup_change(struct sk_buff *in_skb, | 181 | static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, |
182 | struct tcf_proto *tp, unsigned long base, | 182 | struct tcf_proto *tp, unsigned long base, |
183 | u32 handle, struct nlattr **tca, | 183 | u32 handle, struct nlattr **tca, |
184 | unsigned long *arg) | 184 | unsigned long *arg) |
@@ -215,7 +215,8 @@ static int cls_cgroup_change(struct sk_buff *in_skb, | |||
215 | if (err < 0) | 215 | if (err < 0) |
216 | return err; | 216 | return err; |
217 | 217 | ||
218 | err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &cgroup_ext_map); | 218 | err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, |
219 | &cgroup_ext_map); | ||
219 | if (err < 0) | 220 | if (err < 0) |
220 | return err; | 221 | return err; |
221 | 222 | ||
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index ce82d0cb1b47..aa36a8c8b33b 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -351,7 +351,7 @@ static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = { | |||
351 | [TCA_FLOW_PERTURB] = { .type = NLA_U32 }, | 351 | [TCA_FLOW_PERTURB] = { .type = NLA_U32 }, |
352 | }; | 352 | }; |
353 | 353 | ||
354 | static int flow_change(struct sk_buff *in_skb, | 354 | static int flow_change(struct net *net, struct sk_buff *in_skb, |
355 | struct tcf_proto *tp, unsigned long base, | 355 | struct tcf_proto *tp, unsigned long base, |
356 | u32 handle, struct nlattr **tca, | 356 | u32 handle, struct nlattr **tca, |
357 | unsigned long *arg) | 357 | unsigned long *arg) |
@@ -397,7 +397,7 @@ static int flow_change(struct sk_buff *in_skb, | |||
397 | return -EOPNOTSUPP; | 397 | return -EOPNOTSUPP; |
398 | } | 398 | } |
399 | 399 | ||
400 | err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &flow_ext_map); | 400 | err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, &flow_ext_map); |
401 | if (err < 0) | 401 | if (err < 0) |
402 | return err; | 402 | return err; |
403 | 403 | ||
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 4075a0aef2aa..1135d8227f9b 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -192,7 +192,7 @@ static const struct nla_policy fw_policy[TCA_FW_MAX + 1] = { | |||
192 | }; | 192 | }; |
193 | 193 | ||
194 | static int | 194 | static int |
195 | fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f, | 195 | fw_change_attrs(struct net *net, struct tcf_proto *tp, struct fw_filter *f, |
196 | struct nlattr **tb, struct nlattr **tca, unsigned long base) | 196 | struct nlattr **tb, struct nlattr **tca, unsigned long base) |
197 | { | 197 | { |
198 | struct fw_head *head = (struct fw_head *)tp->root; | 198 | struct fw_head *head = (struct fw_head *)tp->root; |
@@ -200,7 +200,7 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f, | |||
200 | u32 mask; | 200 | u32 mask; |
201 | int err; | 201 | int err; |
202 | 202 | ||
203 | err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &fw_ext_map); | 203 | err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, &fw_ext_map); |
204 | if (err < 0) | 204 | if (err < 0) |
205 | return err; | 205 | return err; |
206 | 206 | ||
@@ -233,7 +233,7 @@ errout: | |||
233 | return err; | 233 | return err; |
234 | } | 234 | } |
235 | 235 | ||
236 | static int fw_change(struct sk_buff *in_skb, | 236 | static int fw_change(struct net *net, struct sk_buff *in_skb, |
237 | struct tcf_proto *tp, unsigned long base, | 237 | struct tcf_proto *tp, unsigned long base, |
238 | u32 handle, | 238 | u32 handle, |
239 | struct nlattr **tca, | 239 | struct nlattr **tca, |
@@ -255,7 +255,7 @@ static int fw_change(struct sk_buff *in_skb, | |||
255 | if (f != NULL) { | 255 | if (f != NULL) { |
256 | if (f->id != handle && handle) | 256 | if (f->id != handle && handle) |
257 | return -EINVAL; | 257 | return -EINVAL; |
258 | return fw_change_attrs(tp, f, tb, tca, base); | 258 | return fw_change_attrs(net, tp, f, tb, tca, base); |
259 | } | 259 | } |
260 | 260 | ||
261 | if (!handle) | 261 | if (!handle) |
@@ -282,7 +282,7 @@ static int fw_change(struct sk_buff *in_skb, | |||
282 | 282 | ||
283 | f->id = handle; | 283 | f->id = handle; |
284 | 284 | ||
285 | err = fw_change_attrs(tp, f, tb, tca, base); | 285 | err = fw_change_attrs(net, tp, f, tb, tca, base); |
286 | if (err < 0) | 286 | if (err < 0) |
287 | goto errout; | 287 | goto errout; |
288 | 288 | ||
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index c10d57bf98f2..37da567d833e 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -335,9 +335,10 @@ static const struct nla_policy route4_policy[TCA_ROUTE4_MAX + 1] = { | |||
335 | [TCA_ROUTE4_IIF] = { .type = NLA_U32 }, | 335 | [TCA_ROUTE4_IIF] = { .type = NLA_U32 }, |
336 | }; | 336 | }; |
337 | 337 | ||
338 | static int route4_set_parms(struct tcf_proto *tp, unsigned long base, | 338 | static int route4_set_parms(struct net *net, struct tcf_proto *tp, |
339 | struct route4_filter *f, u32 handle, struct route4_head *head, | 339 | unsigned long base, struct route4_filter *f, |
340 | struct nlattr **tb, struct nlattr *est, int new) | 340 | u32 handle, struct route4_head *head, |
341 | struct nlattr **tb, struct nlattr *est, int new) | ||
341 | { | 342 | { |
342 | int err; | 343 | int err; |
343 | u32 id = 0, to = 0, nhandle = 0x8000; | 344 | u32 id = 0, to = 0, nhandle = 0x8000; |
@@ -346,7 +347,7 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base, | |||
346 | struct route4_bucket *b; | 347 | struct route4_bucket *b; |
347 | struct tcf_exts e; | 348 | struct tcf_exts e; |
348 | 349 | ||
349 | err = tcf_exts_validate(tp, tb, est, &e, &route_ext_map); | 350 | err = tcf_exts_validate(net, tp, tb, est, &e, &route_ext_map); |
350 | if (err < 0) | 351 | if (err < 0) |
351 | return err; | 352 | return err; |
352 | 353 | ||
@@ -427,7 +428,7 @@ errout: | |||
427 | return err; | 428 | return err; |
428 | } | 429 | } |
429 | 430 | ||
430 | static int route4_change(struct sk_buff *in_skb, | 431 | static int route4_change(struct net *net, struct sk_buff *in_skb, |
431 | struct tcf_proto *tp, unsigned long base, | 432 | struct tcf_proto *tp, unsigned long base, |
432 | u32 handle, | 433 | u32 handle, |
433 | struct nlattr **tca, | 434 | struct nlattr **tca, |
@@ -457,7 +458,7 @@ static int route4_change(struct sk_buff *in_skb, | |||
457 | if (f->bkt) | 458 | if (f->bkt) |
458 | old_handle = f->handle; | 459 | old_handle = f->handle; |
459 | 460 | ||
460 | err = route4_set_parms(tp, base, f, handle, head, tb, | 461 | err = route4_set_parms(net, tp, base, f, handle, head, tb, |
461 | tca[TCA_RATE], 0); | 462 | tca[TCA_RATE], 0); |
462 | if (err < 0) | 463 | if (err < 0) |
463 | return err; | 464 | return err; |
@@ -480,7 +481,7 @@ static int route4_change(struct sk_buff *in_skb, | |||
480 | if (f == NULL) | 481 | if (f == NULL) |
481 | goto errout; | 482 | goto errout; |
482 | 483 | ||
483 | err = route4_set_parms(tp, base, f, handle, head, tb, | 484 | err = route4_set_parms(net, tp, base, f, handle, head, tb, |
484 | tca[TCA_RATE], 1); | 485 | tca[TCA_RATE], 1); |
485 | if (err < 0) | 486 | if (err < 0) |
486 | goto errout; | 487 | goto errout; |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index 494bbb90924a..252d8b05872e 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -416,7 +416,7 @@ static const struct nla_policy rsvp_policy[TCA_RSVP_MAX + 1] = { | |||
416 | [TCA_RSVP_PINFO] = { .len = sizeof(struct tc_rsvp_pinfo) }, | 416 | [TCA_RSVP_PINFO] = { .len = sizeof(struct tc_rsvp_pinfo) }, |
417 | }; | 417 | }; |
418 | 418 | ||
419 | static int rsvp_change(struct sk_buff *in_skb, | 419 | static int rsvp_change(struct net *net, struct sk_buff *in_skb, |
420 | struct tcf_proto *tp, unsigned long base, | 420 | struct tcf_proto *tp, unsigned long base, |
421 | u32 handle, | 421 | u32 handle, |
422 | struct nlattr **tca, | 422 | struct nlattr **tca, |
@@ -440,7 +440,7 @@ static int rsvp_change(struct sk_buff *in_skb, | |||
440 | if (err < 0) | 440 | if (err < 0) |
441 | return err; | 441 | return err; |
442 | 442 | ||
443 | err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &rsvp_ext_map); | 443 | err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, &rsvp_ext_map); |
444 | if (err < 0) | 444 | if (err < 0) |
445 | return err; | 445 | return err; |
446 | 446 | ||
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index a1293b4ab7a1..b86535a40169 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -197,9 +197,10 @@ static const struct nla_policy tcindex_policy[TCA_TCINDEX_MAX + 1] = { | |||
197 | }; | 197 | }; |
198 | 198 | ||
199 | static int | 199 | static int |
200 | tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, | 200 | tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, |
201 | struct tcindex_data *p, struct tcindex_filter_result *r, | 201 | u32 handle, struct tcindex_data *p, |
202 | struct nlattr **tb, struct nlattr *est) | 202 | struct tcindex_filter_result *r, struct nlattr **tb, |
203 | struct nlattr *est) | ||
203 | { | 204 | { |
204 | int err, balloc = 0; | 205 | int err, balloc = 0; |
205 | struct tcindex_filter_result new_filter_result, *old_r = r; | 206 | struct tcindex_filter_result new_filter_result, *old_r = r; |
@@ -208,7 +209,7 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
208 | struct tcindex_filter *f = NULL; /* make gcc behave */ | 209 | struct tcindex_filter *f = NULL; /* make gcc behave */ |
209 | struct tcf_exts e; | 210 | struct tcf_exts e; |
210 | 211 | ||
211 | err = tcf_exts_validate(tp, tb, est, &e, &tcindex_ext_map); | 212 | err = tcf_exts_validate(net, tp, tb, est, &e, &tcindex_ext_map); |
212 | if (err < 0) | 213 | if (err < 0) |
213 | return err; | 214 | return err; |
214 | 215 | ||
@@ -332,7 +333,7 @@ errout: | |||
332 | } | 333 | } |
333 | 334 | ||
334 | static int | 335 | static int |
335 | tcindex_change(struct sk_buff *in_skb, | 336 | tcindex_change(struct net *net, struct sk_buff *in_skb, |
336 | struct tcf_proto *tp, unsigned long base, u32 handle, | 337 | struct tcf_proto *tp, unsigned long base, u32 handle, |
337 | struct nlattr **tca, unsigned long *arg) | 338 | struct nlattr **tca, unsigned long *arg) |
338 | { | 339 | { |
@@ -353,7 +354,8 @@ tcindex_change(struct sk_buff *in_skb, | |||
353 | if (err < 0) | 354 | if (err < 0) |
354 | return err; | 355 | return err; |
355 | 356 | ||
356 | return tcindex_set_parms(tp, base, handle, p, r, tb, tca[TCA_RATE]); | 357 | return tcindex_set_parms(net, tp, base, handle, p, r, tb, |
358 | tca[TCA_RATE]); | ||
357 | } | 359 | } |
358 | 360 | ||
359 | 361 | ||
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index c7c27bc91b5a..eb07a1e536e6 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -488,15 +488,15 @@ static const struct nla_policy u32_policy[TCA_U32_MAX + 1] = { | |||
488 | [TCA_U32_MARK] = { .len = sizeof(struct tc_u32_mark) }, | 488 | [TCA_U32_MARK] = { .len = sizeof(struct tc_u32_mark) }, |
489 | }; | 489 | }; |
490 | 490 | ||
491 | static int u32_set_parms(struct tcf_proto *tp, unsigned long base, | 491 | static int u32_set_parms(struct net *net, struct tcf_proto *tp, |
492 | struct tc_u_hnode *ht, | 492 | unsigned long base, struct tc_u_hnode *ht, |
493 | struct tc_u_knode *n, struct nlattr **tb, | 493 | struct tc_u_knode *n, struct nlattr **tb, |
494 | struct nlattr *est) | 494 | struct nlattr *est) |
495 | { | 495 | { |
496 | int err; | 496 | int err; |
497 | struct tcf_exts e; | 497 | struct tcf_exts e; |
498 | 498 | ||
499 | err = tcf_exts_validate(tp, tb, est, &e, &u32_ext_map); | 499 | err = tcf_exts_validate(net, tp, tb, est, &e, &u32_ext_map); |
500 | if (err < 0) | 500 | if (err < 0) |
501 | return err; | 501 | return err; |
502 | 502 | ||
@@ -544,7 +544,7 @@ errout: | |||
544 | return err; | 544 | return err; |
545 | } | 545 | } |
546 | 546 | ||
547 | static int u32_change(struct sk_buff *in_skb, | 547 | static int u32_change(struct net *net, struct sk_buff *in_skb, |
548 | struct tcf_proto *tp, unsigned long base, u32 handle, | 548 | struct tcf_proto *tp, unsigned long base, u32 handle, |
549 | struct nlattr **tca, | 549 | struct nlattr **tca, |
550 | unsigned long *arg) | 550 | unsigned long *arg) |
@@ -570,7 +570,8 @@ static int u32_change(struct sk_buff *in_skb, | |||
570 | if (TC_U32_KEY(n->handle) == 0) | 570 | if (TC_U32_KEY(n->handle) == 0) |
571 | return -EINVAL; | 571 | return -EINVAL; |
572 | 572 | ||
573 | return u32_set_parms(tp, base, n->ht_up, n, tb, tca[TCA_RATE]); | 573 | return u32_set_parms(net, tp, base, n->ht_up, n, tb, |
574 | tca[TCA_RATE]); | ||
574 | } | 575 | } |
575 | 576 | ||
576 | if (tb[TCA_U32_DIVISOR]) { | 577 | if (tb[TCA_U32_DIVISOR]) { |
@@ -656,7 +657,7 @@ static int u32_change(struct sk_buff *in_skb, | |||
656 | } | 657 | } |
657 | #endif | 658 | #endif |
658 | 659 | ||
659 | err = u32_set_parms(tp, base, ht, n, tb, tca[TCA_RATE]); | 660 | err = u32_set_parms(net, tp, base, ht, n, tb, tca[TCA_RATE]); |
660 | if (err == 0) { | 661 | if (err == 0) { |
661 | struct tc_u_knode **ins; | 662 | struct tc_u_knode **ins; |
662 | for (ins = &ht->ht[TC_U32_HASH(handle)]; *ins; ins = &(*ins)->next) | 663 | for (ins = &ht->ht[TC_U32_HASH(handle)]; *ins; ins = &(*ins)->next) |