diff options
Diffstat (limited to 'net/sched/cls_api.c')
| -rw-r--r-- | net/sched/cls_api.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 3725d8fa29db..5fd0c28ef79a 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/kmod.h> | 24 | #include <linux/kmod.h> |
| 25 | #include <linux/netlink.h> | 25 | #include <linux/netlink.h> |
| 26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
| 27 | #include <linux/slab.h> | ||
| 27 | #include <net/net_namespace.h> | 28 | #include <net/net_namespace.h> |
| 28 | #include <net/sock.h> | 29 | #include <net/sock.h> |
| 29 | #include <net/netlink.h> | 30 | #include <net/netlink.h> |
| @@ -98,8 +99,9 @@ out: | |||
| 98 | } | 99 | } |
| 99 | EXPORT_SYMBOL(unregister_tcf_proto_ops); | 100 | EXPORT_SYMBOL(unregister_tcf_proto_ops); |
| 100 | 101 | ||
| 101 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 102 | static int tfilter_notify(struct net *net, struct sk_buff *oskb, |
| 102 | struct tcf_proto *tp, unsigned long fh, int event); | 103 | struct nlmsghdr *n, struct tcf_proto *tp, |
| 104 | unsigned long fh, int event); | ||
| 103 | 105 | ||
| 104 | 106 | ||
| 105 | /* Select new prio value from the range, managed by kernel. */ | 107 | /* Select new prio value from the range, managed by kernel. */ |
| @@ -137,9 +139,6 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
| 137 | int err; | 139 | int err; |
| 138 | int tp_created = 0; | 140 | int tp_created = 0; |
| 139 | 141 | ||
| 140 | if (!net_eq(net, &init_net)) | ||
| 141 | return -EINVAL; | ||
| 142 | |||
| 143 | replay: | 142 | replay: |
| 144 | t = NLMSG_DATA(n); | 143 | t = NLMSG_DATA(n); |
| 145 | protocol = TC_H_MIN(t->tcm_info); | 144 | protocol = TC_H_MIN(t->tcm_info); |
| @@ -158,7 +157,7 @@ replay: | |||
| 158 | /* Find head of filter chain. */ | 157 | /* Find head of filter chain. */ |
| 159 | 158 | ||
| 160 | /* Find link */ | 159 | /* Find link */ |
| 161 | dev = __dev_get_by_index(&init_net, t->tcm_ifindex); | 160 | dev = __dev_get_by_index(net, t->tcm_ifindex); |
| 162 | if (dev == NULL) | 161 | if (dev == NULL) |
| 163 | return -ENODEV; | 162 | return -ENODEV; |
| 164 | 163 | ||
| @@ -282,7 +281,7 @@ replay: | |||
| 282 | *back = tp->next; | 281 | *back = tp->next; |
| 283 | spin_unlock_bh(root_lock); | 282 | spin_unlock_bh(root_lock); |
| 284 | 283 | ||
| 285 | tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER); | 284 | tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER); |
| 286 | tcf_destroy(tp); | 285 | tcf_destroy(tp); |
| 287 | err = 0; | 286 | err = 0; |
| 288 | goto errout; | 287 | goto errout; |
| @@ -305,10 +304,10 @@ replay: | |||
| 305 | case RTM_DELTFILTER: | 304 | case RTM_DELTFILTER: |
| 306 | err = tp->ops->delete(tp, fh); | 305 | err = tp->ops->delete(tp, fh); |
| 307 | if (err == 0) | 306 | if (err == 0) |
| 308 | tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER); | 307 | tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER); |
| 309 | goto errout; | 308 | goto errout; |
| 310 | case RTM_GETTFILTER: | 309 | case RTM_GETTFILTER: |
| 311 | err = tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER); | 310 | err = tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER); |
| 312 | goto errout; | 311 | goto errout; |
| 313 | default: | 312 | default: |
| 314 | err = -EINVAL; | 313 | err = -EINVAL; |
| @@ -324,7 +323,7 @@ replay: | |||
| 324 | *back = tp; | 323 | *back = tp; |
| 325 | spin_unlock_bh(root_lock); | 324 | spin_unlock_bh(root_lock); |
| 326 | } | 325 | } |
| 327 | tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER); | 326 | tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER); |
| 328 | } else { | 327 | } else { |
| 329 | if (tp_created) | 328 | if (tp_created) |
| 330 | tcf_destroy(tp); | 329 | tcf_destroy(tp); |
| @@ -370,8 +369,9 @@ nla_put_failure: | |||
| 370 | return -1; | 369 | return -1; |
| 371 | } | 370 | } |
| 372 | 371 | ||
| 373 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 372 | static int tfilter_notify(struct net *net, struct sk_buff *oskb, |
| 374 | struct tcf_proto *tp, unsigned long fh, int event) | 373 | struct nlmsghdr *n, struct tcf_proto *tp, |
| 374 | unsigned long fh, int event) | ||
| 375 | { | 375 | { |
| 376 | struct sk_buff *skb; | 376 | struct sk_buff *skb; |
| 377 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; | 377 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; |
| @@ -385,7 +385,7 @@ static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
| 385 | return -EINVAL; | 385 | return -EINVAL; |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, | 388 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
| 389 | n->nlmsg_flags & NLM_F_ECHO); | 389 | n->nlmsg_flags & NLM_F_ECHO); |
| 390 | } | 390 | } |
| 391 | 391 | ||
| @@ -418,12 +418,9 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 418 | const struct Qdisc_class_ops *cops; | 418 | const struct Qdisc_class_ops *cops; |
| 419 | struct tcf_dump_args arg; | 419 | struct tcf_dump_args arg; |
| 420 | 420 | ||
| 421 | if (!net_eq(net, &init_net)) | ||
| 422 | return 0; | ||
| 423 | |||
| 424 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 421 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) |
| 425 | return skb->len; | 422 | return skb->len; |
| 426 | if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) | 423 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) |
| 427 | return skb->len; | 424 | return skb->len; |
| 428 | 425 | ||
| 429 | if (!tcm->tcm_parent) | 426 | if (!tcm->tcm_parent) |
