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 /net/sched/cls_route.c | |
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>
Diffstat (limited to 'net/sched/cls_route.c')
-rw-r--r-- | net/sched/cls_route.c | 15 |
1 files changed, 8 insertions, 7 deletions
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; |