diff options
author | Tom Goff <thomas.goff@boeing.com> | 2010-03-19 11:40:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-22 23:26:25 -0400 |
commit | 7316ae88c43d47f6503f4c29b4973204e33c3411 (patch) | |
tree | 442b265d3fd083065330e355cf8e9c73196cc443 /net/sched/cls_api.c | |
parent | 300bc0602489d9f09f7b548f790afd2952f6070b (diff) |
net_sched: make traffic control network namespace aware
Mostly minor changes to add a net argument to various functions and
remove initial network namespace checks.
Make /proc/net/psched per network namespace.
Signed-off-by: Tom Goff <thomas.goff@boeing.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r-- | net/sched/cls_api.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 3725d8fa29db..4a795d966172 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -98,8 +98,9 @@ out: | |||
98 | } | 98 | } |
99 | EXPORT_SYMBOL(unregister_tcf_proto_ops); | 99 | EXPORT_SYMBOL(unregister_tcf_proto_ops); |
100 | 100 | ||
101 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 101 | static int tfilter_notify(struct net *net, struct sk_buff *oskb, |
102 | struct tcf_proto *tp, unsigned long fh, int event); | 102 | struct nlmsghdr *n, struct tcf_proto *tp, |
103 | unsigned long fh, int event); | ||
103 | 104 | ||
104 | 105 | ||
105 | /* Select new prio value from the range, managed by kernel. */ | 106 | /* Select new prio value from the range, managed by kernel. */ |
@@ -137,9 +138,6 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
137 | int err; | 138 | int err; |
138 | int tp_created = 0; | 139 | int tp_created = 0; |
139 | 140 | ||
140 | if (!net_eq(net, &init_net)) | ||
141 | return -EINVAL; | ||
142 | |||
143 | replay: | 141 | replay: |
144 | t = NLMSG_DATA(n); | 142 | t = NLMSG_DATA(n); |
145 | protocol = TC_H_MIN(t->tcm_info); | 143 | protocol = TC_H_MIN(t->tcm_info); |
@@ -158,7 +156,7 @@ replay: | |||
158 | /* Find head of filter chain. */ | 156 | /* Find head of filter chain. */ |
159 | 157 | ||
160 | /* Find link */ | 158 | /* Find link */ |
161 | dev = __dev_get_by_index(&init_net, t->tcm_ifindex); | 159 | dev = __dev_get_by_index(net, t->tcm_ifindex); |
162 | if (dev == NULL) | 160 | if (dev == NULL) |
163 | return -ENODEV; | 161 | return -ENODEV; |
164 | 162 | ||
@@ -282,7 +280,7 @@ replay: | |||
282 | *back = tp->next; | 280 | *back = tp->next; |
283 | spin_unlock_bh(root_lock); | 281 | spin_unlock_bh(root_lock); |
284 | 282 | ||
285 | tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER); | 283 | tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER); |
286 | tcf_destroy(tp); | 284 | tcf_destroy(tp); |
287 | err = 0; | 285 | err = 0; |
288 | goto errout; | 286 | goto errout; |
@@ -305,10 +303,10 @@ replay: | |||
305 | case RTM_DELTFILTER: | 303 | case RTM_DELTFILTER: |
306 | err = tp->ops->delete(tp, fh); | 304 | err = tp->ops->delete(tp, fh); |
307 | if (err == 0) | 305 | if (err == 0) |
308 | tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER); | 306 | tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER); |
309 | goto errout; | 307 | goto errout; |
310 | case RTM_GETTFILTER: | 308 | case RTM_GETTFILTER: |
311 | err = tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER); | 309 | err = tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER); |
312 | goto errout; | 310 | goto errout; |
313 | default: | 311 | default: |
314 | err = -EINVAL; | 312 | err = -EINVAL; |
@@ -324,7 +322,7 @@ replay: | |||
324 | *back = tp; | 322 | *back = tp; |
325 | spin_unlock_bh(root_lock); | 323 | spin_unlock_bh(root_lock); |
326 | } | 324 | } |
327 | tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER); | 325 | tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER); |
328 | } else { | 326 | } else { |
329 | if (tp_created) | 327 | if (tp_created) |
330 | tcf_destroy(tp); | 328 | tcf_destroy(tp); |
@@ -370,8 +368,9 @@ nla_put_failure: | |||
370 | return -1; | 368 | return -1; |
371 | } | 369 | } |
372 | 370 | ||
373 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 371 | static int tfilter_notify(struct net *net, struct sk_buff *oskb, |
374 | struct tcf_proto *tp, unsigned long fh, int event) | 372 | struct nlmsghdr *n, struct tcf_proto *tp, |
373 | unsigned long fh, int event) | ||
375 | { | 374 | { |
376 | struct sk_buff *skb; | 375 | struct sk_buff *skb; |
377 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; | 376 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; |
@@ -385,7 +384,7 @@ static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
385 | return -EINVAL; | 384 | return -EINVAL; |
386 | } | 385 | } |
387 | 386 | ||
388 | return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, | 387 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
389 | n->nlmsg_flags & NLM_F_ECHO); | 388 | n->nlmsg_flags & NLM_F_ECHO); |
390 | } | 389 | } |
391 | 390 | ||
@@ -418,12 +417,9 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
418 | const struct Qdisc_class_ops *cops; | 417 | const struct Qdisc_class_ops *cops; |
419 | struct tcf_dump_args arg; | 418 | struct tcf_dump_args arg; |
420 | 419 | ||
421 | if (!net_eq(net, &init_net)) | ||
422 | return 0; | ||
423 | |||
424 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 420 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) |
425 | return skb->len; | 421 | return skb->len; |
426 | if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) | 422 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) |
427 | return skb->len; | 423 | return skb->len; |
428 | 424 | ||
429 | if (!tcm->tcm_parent) | 425 | if (!tcm->tcm_parent) |