aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_basic.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/cls_basic.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/cls_basic.c')
-rw-r--r--net/sched/cls_basic.c13
1 files changed, 7 insertions, 6 deletions
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
135static int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f, 135static 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
165static int basic_change(struct sk_buff *in_skb, 166static 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