diff options
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/act_api.c | 65 | ||||
-rw-r--r-- | net/sched/act_gact.c | 4 | ||||
-rw-r--r-- | net/sched/act_ipt.c | 9 | ||||
-rw-r--r-- | net/sched/act_mirred.c | 6 | ||||
-rw-r--r-- | net/sched/act_pedit.c | 11 | ||||
-rw-r--r-- | net/sched/act_simple.c | 4 | ||||
-rw-r--r-- | net/sched/cls_api.c | 30 | ||||
-rw-r--r-- | net/sched/cls_flow.c | 1 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 10 | ||||
-rw-r--r-- | net/sched/ematch.c | 3 | ||||
-rw-r--r-- | net/sched/sch_api.c | 121 | ||||
-rw-r--r-- | net/sched/sch_generic.c | 21 | ||||
-rw-r--r-- | net/sched/sch_hfsc.c | 7 | ||||
-rw-r--r-- | net/sched/sch_ingress.c | 1 | ||||
-rw-r--r-- | net/sched/sch_mq.c | 1 | ||||
-rw-r--r-- | net/sched/sch_multiq.c | 1 | ||||
-rw-r--r-- | net/sched/sch_prio.c | 1 | ||||
-rw-r--r-- | net/sched/sch_red.c | 1 | ||||
-rw-r--r-- | net/sched/sch_sfq.c | 10 | ||||
-rw-r--r-- | net/sched/sch_tbf.c | 6 |
20 files changed, 180 insertions, 133 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index d8e0171d9a4..972378f47f3 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -153,7 +153,7 @@ int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb, | |||
153 | } else if (type == RTM_GETACTION) { | 153 | } else if (type == RTM_GETACTION) { |
154 | return tcf_dump_walker(skb, cb, a, hinfo); | 154 | return tcf_dump_walker(skb, cb, a, hinfo); |
155 | } else { | 155 | } else { |
156 | printk("tcf_generic_walker: unknown action %d\n", type); | 156 | WARN(1, "tcf_generic_walker: unknown action %d\n", type); |
157 | return -EINVAL; | 157 | return -EINVAL; |
158 | } | 158 | } |
159 | } | 159 | } |
@@ -403,8 +403,9 @@ void tcf_action_destroy(struct tc_action *act, int bind) | |||
403 | module_put(a->ops->owner); | 403 | module_put(a->ops->owner); |
404 | act = act->next; | 404 | act = act->next; |
405 | kfree(a); | 405 | kfree(a); |
406 | } else { /*FIXME: Remove later - catch insertion bugs*/ | 406 | } else { |
407 | printk("tcf_action_destroy: BUG? destroying NULL ops\n"); | 407 | /*FIXME: Remove later - catch insertion bugs*/ |
408 | WARN(1, "tcf_action_destroy: BUG? destroying NULL ops\n"); | ||
408 | act = act->next; | 409 | act = act->next; |
409 | kfree(a); | 410 | kfree(a); |
410 | } | 411 | } |
@@ -668,7 +669,8 @@ nlmsg_failure: | |||
668 | } | 669 | } |
669 | 670 | ||
670 | static int | 671 | static int |
671 | act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event) | 672 | act_get_notify(struct net *net, u32 pid, struct nlmsghdr *n, |
673 | struct tc_action *a, int event) | ||
672 | { | 674 | { |
673 | struct sk_buff *skb; | 675 | struct sk_buff *skb; |
674 | 676 | ||
@@ -680,7 +682,7 @@ act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event) | |||
680 | return -EINVAL; | 682 | return -EINVAL; |
681 | } | 683 | } |
682 | 684 | ||
683 | return rtnl_unicast(skb, &init_net, pid); | 685 | return rtnl_unicast(skb, net, pid); |
684 | } | 686 | } |
685 | 687 | ||
686 | static struct tc_action * | 688 | static struct tc_action * |
@@ -743,14 +745,15 @@ static struct tc_action *create_a(int i) | |||
743 | 745 | ||
744 | act = kzalloc(sizeof(*act), GFP_KERNEL); | 746 | act = kzalloc(sizeof(*act), GFP_KERNEL); |
745 | if (act == NULL) { | 747 | if (act == NULL) { |
746 | printk("create_a: failed to alloc!\n"); | 748 | pr_debug("create_a: failed to alloc!\n"); |
747 | return NULL; | 749 | return NULL; |
748 | } | 750 | } |
749 | act->order = i; | 751 | act->order = i; |
750 | return act; | 752 | return act; |
751 | } | 753 | } |
752 | 754 | ||
753 | static int tca_action_flush(struct nlattr *nla, struct nlmsghdr *n, u32 pid) | 755 | static int tca_action_flush(struct net *net, struct nlattr *nla, |
756 | struct nlmsghdr *n, u32 pid) | ||
754 | { | 757 | { |
755 | struct sk_buff *skb; | 758 | struct sk_buff *skb; |
756 | unsigned char *b; | 759 | unsigned char *b; |
@@ -764,13 +767,13 @@ static int tca_action_flush(struct nlattr *nla, struct nlmsghdr *n, u32 pid) | |||
764 | int err = -ENOMEM; | 767 | int err = -ENOMEM; |
765 | 768 | ||
766 | if (a == NULL) { | 769 | if (a == NULL) { |
767 | printk("tca_action_flush: couldnt create tc_action\n"); | 770 | pr_debug("tca_action_flush: couldnt create tc_action\n"); |
768 | return err; | 771 | return err; |
769 | } | 772 | } |
770 | 773 | ||
771 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 774 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); |
772 | if (!skb) { | 775 | if (!skb) { |
773 | printk("tca_action_flush: failed skb alloc\n"); | 776 | pr_debug("tca_action_flush: failed skb alloc\n"); |
774 | kfree(a); | 777 | kfree(a); |
775 | return err; | 778 | return err; |
776 | } | 779 | } |
@@ -809,7 +812,7 @@ static int tca_action_flush(struct nlattr *nla, struct nlmsghdr *n, u32 pid) | |||
809 | nlh->nlmsg_flags |= NLM_F_ROOT; | 812 | nlh->nlmsg_flags |= NLM_F_ROOT; |
810 | module_put(a->ops->owner); | 813 | module_put(a->ops->owner); |
811 | kfree(a); | 814 | kfree(a); |
812 | err = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); | 815 | err = rtnetlink_send(skb, net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); |
813 | if (err > 0) | 816 | if (err > 0) |
814 | return 0; | 817 | return 0; |
815 | 818 | ||
@@ -826,7 +829,8 @@ noflush_out: | |||
826 | } | 829 | } |
827 | 830 | ||
828 | static int | 831 | static int |
829 | tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event) | 832 | tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n, |
833 | u32 pid, int event) | ||
830 | { | 834 | { |
831 | int i, ret; | 835 | int i, ret; |
832 | struct nlattr *tb[TCA_ACT_MAX_PRIO+1]; | 836 | struct nlattr *tb[TCA_ACT_MAX_PRIO+1]; |
@@ -838,7 +842,7 @@ tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event) | |||
838 | 842 | ||
839 | if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) { | 843 | if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) { |
840 | if (tb[1] != NULL) | 844 | if (tb[1] != NULL) |
841 | return tca_action_flush(tb[1], n, pid); | 845 | return tca_action_flush(net, tb[1], n, pid); |
842 | else | 846 | else |
843 | return -EINVAL; | 847 | return -EINVAL; |
844 | } | 848 | } |
@@ -859,7 +863,7 @@ tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event) | |||
859 | } | 863 | } |
860 | 864 | ||
861 | if (event == RTM_GETACTION) | 865 | if (event == RTM_GETACTION) |
862 | ret = act_get_notify(pid, n, head, event); | 866 | ret = act_get_notify(net, pid, n, head, event); |
863 | else { /* delete */ | 867 | else { /* delete */ |
864 | struct sk_buff *skb; | 868 | struct sk_buff *skb; |
865 | 869 | ||
@@ -878,7 +882,7 @@ tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event) | |||
878 | 882 | ||
879 | /* now do the delete */ | 883 | /* now do the delete */ |
880 | tcf_action_destroy(head, 0); | 884 | tcf_action_destroy(head, 0); |
881 | ret = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, | 885 | ret = rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
882 | n->nlmsg_flags&NLM_F_ECHO); | 886 | n->nlmsg_flags&NLM_F_ECHO); |
883 | if (ret > 0) | 887 | if (ret > 0) |
884 | return 0; | 888 | return 0; |
@@ -889,8 +893,8 @@ err: | |||
889 | return ret; | 893 | return ret; |
890 | } | 894 | } |
891 | 895 | ||
892 | static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, | 896 | static int tcf_add_notify(struct net *net, struct tc_action *a, |
893 | u16 flags) | 897 | u32 pid, u32 seq, int event, u16 flags) |
894 | { | 898 | { |
895 | struct tcamsg *t; | 899 | struct tcamsg *t; |
896 | struct nlmsghdr *nlh; | 900 | struct nlmsghdr *nlh; |
@@ -923,7 +927,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, | |||
923 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; | 927 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
924 | NETLINK_CB(skb).dst_group = RTNLGRP_TC; | 928 | NETLINK_CB(skb).dst_group = RTNLGRP_TC; |
925 | 929 | ||
926 | err = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, flags&NLM_F_ECHO); | 930 | err = rtnetlink_send(skb, net, pid, RTNLGRP_TC, flags&NLM_F_ECHO); |
927 | if (err > 0) | 931 | if (err > 0) |
928 | err = 0; | 932 | err = 0; |
929 | return err; | 933 | return err; |
@@ -936,7 +940,8 @@ nlmsg_failure: | |||
936 | 940 | ||
937 | 941 | ||
938 | static int | 942 | static int |
939 | tcf_action_add(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int ovr) | 943 | tcf_action_add(struct net *net, struct nlattr *nla, struct nlmsghdr *n, |
944 | u32 pid, int ovr) | ||
940 | { | 945 | { |
941 | int ret = 0; | 946 | int ret = 0; |
942 | struct tc_action *act; | 947 | struct tc_action *act; |
@@ -954,7 +959,7 @@ tcf_action_add(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int ovr) | |||
954 | /* dump then free all the actions after update; inserted policy | 959 | /* dump then free all the actions after update; inserted policy |
955 | * stays intact | 960 | * stays intact |
956 | * */ | 961 | * */ |
957 | ret = tcf_add_notify(act, pid, seq, RTM_NEWACTION, n->nlmsg_flags); | 962 | ret = tcf_add_notify(net, act, pid, seq, RTM_NEWACTION, n->nlmsg_flags); |
958 | for (a = act; a; a = act) { | 963 | for (a = act; a; a = act) { |
959 | act = a->next; | 964 | act = a->next; |
960 | kfree(a); | 965 | kfree(a); |
@@ -970,15 +975,12 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
970 | u32 pid = skb ? NETLINK_CB(skb).pid : 0; | 975 | u32 pid = skb ? NETLINK_CB(skb).pid : 0; |
971 | int ret = 0, ovr = 0; | 976 | int ret = 0, ovr = 0; |
972 | 977 | ||
973 | if (!net_eq(net, &init_net)) | ||
974 | return -EINVAL; | ||
975 | |||
976 | ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL); | 978 | ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL); |
977 | if (ret < 0) | 979 | if (ret < 0) |
978 | return ret; | 980 | return ret; |
979 | 981 | ||
980 | if (tca[TCA_ACT_TAB] == NULL) { | 982 | if (tca[TCA_ACT_TAB] == NULL) { |
981 | printk("tc_ctl_action: received NO action attribs\n"); | 983 | pr_notice("tc_ctl_action: received NO action attribs\n"); |
982 | return -EINVAL; | 984 | return -EINVAL; |
983 | } | 985 | } |
984 | 986 | ||
@@ -995,15 +997,17 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
995 | if (n->nlmsg_flags&NLM_F_REPLACE) | 997 | if (n->nlmsg_flags&NLM_F_REPLACE) |
996 | ovr = 1; | 998 | ovr = 1; |
997 | replay: | 999 | replay: |
998 | ret = tcf_action_add(tca[TCA_ACT_TAB], n, pid, ovr); | 1000 | ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, pid, ovr); |
999 | if (ret == -EAGAIN) | 1001 | if (ret == -EAGAIN) |
1000 | goto replay; | 1002 | goto replay; |
1001 | break; | 1003 | break; |
1002 | case RTM_DELACTION: | 1004 | case RTM_DELACTION: |
1003 | ret = tca_action_gd(tca[TCA_ACT_TAB], n, pid, RTM_DELACTION); | 1005 | ret = tca_action_gd(net, tca[TCA_ACT_TAB], n, |
1006 | pid, RTM_DELACTION); | ||
1004 | break; | 1007 | break; |
1005 | case RTM_GETACTION: | 1008 | case RTM_GETACTION: |
1006 | ret = tca_action_gd(tca[TCA_ACT_TAB], n, pid, RTM_GETACTION); | 1009 | ret = tca_action_gd(net, tca[TCA_ACT_TAB], n, |
1010 | pid, RTM_GETACTION); | ||
1007 | break; | 1011 | break; |
1008 | default: | 1012 | default: |
1009 | BUG(); | 1013 | BUG(); |
@@ -1043,7 +1047,6 @@ find_dump_kind(const struct nlmsghdr *n) | |||
1043 | static int | 1047 | static int |
1044 | tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | 1048 | tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) |
1045 | { | 1049 | { |
1046 | struct net *net = sock_net(skb->sk); | ||
1047 | struct nlmsghdr *nlh; | 1050 | struct nlmsghdr *nlh; |
1048 | unsigned char *b = skb_tail_pointer(skb); | 1051 | unsigned char *b = skb_tail_pointer(skb); |
1049 | struct nlattr *nest; | 1052 | struct nlattr *nest; |
@@ -1053,11 +1056,8 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1053 | struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh); | 1056 | struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh); |
1054 | struct nlattr *kind = find_dump_kind(cb->nlh); | 1057 | struct nlattr *kind = find_dump_kind(cb->nlh); |
1055 | 1058 | ||
1056 | if (!net_eq(net, &init_net)) | ||
1057 | return 0; | ||
1058 | |||
1059 | if (kind == NULL) { | 1059 | if (kind == NULL) { |
1060 | printk("tc_dump_action: action bad kind\n"); | 1060 | pr_info("tc_dump_action: action bad kind\n"); |
1061 | return 0; | 1061 | return 0; |
1062 | } | 1062 | } |
1063 | 1063 | ||
@@ -1070,7 +1070,8 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1070 | a.ops = a_o; | 1070 | a.ops = a_o; |
1071 | 1071 | ||
1072 | if (a_o->walk == NULL) { | 1072 | if (a_o->walk == NULL) { |
1073 | printk("tc_dump_action: %s !capable of dumping table\n", a_o->kind); | 1073 | WARN(1, "tc_dump_action: %s !capable of dumping table\n", |
1074 | a_o->kind); | ||
1074 | goto nla_put_failure; | 1075 | goto nla_put_failure; |
1075 | } | 1076 | } |
1076 | 1077 | ||
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index e7f796aec65..8406c665499 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -202,9 +202,9 @@ MODULE_LICENSE("GPL"); | |||
202 | static int __init gact_init_module(void) | 202 | static int __init gact_init_module(void) |
203 | { | 203 | { |
204 | #ifdef CONFIG_GACT_PROB | 204 | #ifdef CONFIG_GACT_PROB |
205 | printk("GACT probability on\n"); | 205 | printk(KERN_INFO "GACT probability on\n"); |
206 | #else | 206 | #else |
207 | printk("GACT probability NOT on\n"); | 207 | printk(KERN_INFO "GACT probability NOT on\n"); |
208 | #endif | 208 | #endif |
209 | return tcf_register_action(&act_gact_ops); | 209 | return tcf_register_action(&act_gact_ops); |
210 | } | 210 | } |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index da27a170b6b..c7e59e6ec34 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -47,8 +47,8 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int | |||
47 | 47 | ||
48 | target = xt_request_find_target(AF_INET, t->u.user.name, | 48 | target = xt_request_find_target(AF_INET, t->u.user.name, |
49 | t->u.user.revision); | 49 | t->u.user.revision); |
50 | if (!target) | 50 | if (IS_ERR(target)) |
51 | return -ENOENT; | 51 | return PTR_ERR(target); |
52 | 52 | ||
53 | t->u.kernel.target = target; | 53 | t->u.kernel.target = target; |
54 | par.table = table; | 54 | par.table = table; |
@@ -199,7 +199,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, | |||
199 | { | 199 | { |
200 | int ret = 0, result = 0; | 200 | int ret = 0, result = 0; |
201 | struct tcf_ipt *ipt = a->priv; | 201 | struct tcf_ipt *ipt = a->priv; |
202 | struct xt_target_param par; | 202 | struct xt_action_param par; |
203 | 203 | ||
204 | if (skb_cloned(skb)) { | 204 | if (skb_cloned(skb)) { |
205 | if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) | 205 | if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) |
@@ -235,7 +235,8 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, | |||
235 | break; | 235 | break; |
236 | default: | 236 | default: |
237 | if (net_ratelimit()) | 237 | if (net_ratelimit()) |
238 | printk("Bogus netfilter code %d assume ACCEPT\n", ret); | 238 | pr_notice("tc filter: Bogus netfilter code" |
239 | " %d assume ACCEPT\n", ret); | ||
239 | result = TC_POLICE_OK; | 240 | result = TC_POLICE_OK; |
240 | break; | 241 | break; |
241 | } | 242 | } |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index c046682054e..c0b6863e3b8 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -164,8 +164,8 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, | |||
164 | dev = m->tcfm_dev; | 164 | dev = m->tcfm_dev; |
165 | if (!(dev->flags & IFF_UP)) { | 165 | if (!(dev->flags & IFF_UP)) { |
166 | if (net_ratelimit()) | 166 | if (net_ratelimit()) |
167 | printk("mirred to Houston: device %s is gone!\n", | 167 | pr_notice("tc mirred to Houston: device %s is gone!\n", |
168 | dev->name); | 168 | dev->name); |
169 | goto out; | 169 | goto out; |
170 | } | 170 | } |
171 | 171 | ||
@@ -252,7 +252,7 @@ MODULE_LICENSE("GPL"); | |||
252 | 252 | ||
253 | static int __init mirred_init_module(void) | 253 | static int __init mirred_init_module(void) |
254 | { | 254 | { |
255 | printk("Mirror/redirect action on\n"); | 255 | pr_info("Mirror/redirect action on\n"); |
256 | return tcf_register_action(&act_mirred_ops); | 256 | return tcf_register_action(&act_mirred_ops); |
257 | } | 257 | } |
258 | 258 | ||
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index b7dcfedc802..fdbd0b7bd84 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -158,11 +158,13 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, | |||
158 | } | 158 | } |
159 | 159 | ||
160 | if (offset % 4) { | 160 | if (offset % 4) { |
161 | printk("offset must be on 32 bit boundaries\n"); | 161 | pr_info("tc filter pedit" |
162 | " offset must be on 32 bit boundaries\n"); | ||
162 | goto bad; | 163 | goto bad; |
163 | } | 164 | } |
164 | if (offset > 0 && offset > skb->len) { | 165 | if (offset > 0 && offset > skb->len) { |
165 | printk("offset %d cant exceed pkt length %d\n", | 166 | pr_info("tc filter pedit" |
167 | " offset %d cant exceed pkt length %d\n", | ||
166 | offset, skb->len); | 168 | offset, skb->len); |
167 | goto bad; | 169 | goto bad; |
168 | } | 170 | } |
@@ -176,9 +178,8 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, | |||
176 | if (munged) | 178 | if (munged) |
177 | skb->tc_verd = SET_TC_MUNGED(skb->tc_verd); | 179 | skb->tc_verd = SET_TC_MUNGED(skb->tc_verd); |
178 | goto done; | 180 | goto done; |
179 | } else { | 181 | } else |
180 | printk("pedit BUG: index %d\n", p->tcf_index); | 182 | WARN(1, "pedit BUG: index %d\n", p->tcf_index); |
181 | } | ||
182 | 183 | ||
183 | bad: | 184 | bad: |
184 | p->tcf_qstats.overlimits++; | 185 | p->tcf_qstats.overlimits++; |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 622ca809c15..1b4bc691d7d 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -49,7 +49,7 @@ static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result | |||
49 | * Example if this was the 3rd packet and the string was "hello" | 49 | * Example if this was the 3rd packet and the string was "hello" |
50 | * then it would look like "hello_3" (without quotes) | 50 | * then it would look like "hello_3" (without quotes) |
51 | **/ | 51 | **/ |
52 | printk("simple: %s_%d\n", | 52 | pr_info("simple: %s_%d\n", |
53 | (char *)d->tcfd_defdata, d->tcf_bstats.packets); | 53 | (char *)d->tcfd_defdata, d->tcf_bstats.packets); |
54 | spin_unlock(&d->tcf_lock); | 54 | spin_unlock(&d->tcf_lock); |
55 | return d->tcf_action; | 55 | return d->tcf_action; |
@@ -205,7 +205,7 @@ static int __init simp_init_module(void) | |||
205 | { | 205 | { |
206 | int ret = tcf_register_action(&act_simp_ops); | 206 | int ret = tcf_register_action(&act_simp_ops); |
207 | if (!ret) | 207 | if (!ret) |
208 | printk("Simple TC action Loaded\n"); | 208 | pr_info("Simple TC action Loaded\n"); |
209 | return ret; | 209 | return ret; |
210 | } | 210 | } |
211 | 211 | ||
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index f082b27ff46..5fd0c28ef79 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -99,8 +99,9 @@ out: | |||
99 | } | 99 | } |
100 | EXPORT_SYMBOL(unregister_tcf_proto_ops); | 100 | EXPORT_SYMBOL(unregister_tcf_proto_ops); |
101 | 101 | ||
102 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 102 | static int tfilter_notify(struct net *net, struct sk_buff *oskb, |
103 | struct tcf_proto *tp, unsigned long fh, int event); | 103 | struct nlmsghdr *n, struct tcf_proto *tp, |
104 | unsigned long fh, int event); | ||
104 | 105 | ||
105 | 106 | ||
106 | /* Select new prio value from the range, managed by kernel. */ | 107 | /* Select new prio value from the range, managed by kernel. */ |
@@ -138,9 +139,6 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
138 | int err; | 139 | int err; |
139 | int tp_created = 0; | 140 | int tp_created = 0; |
140 | 141 | ||
141 | if (!net_eq(net, &init_net)) | ||
142 | return -EINVAL; | ||
143 | |||
144 | replay: | 142 | replay: |
145 | t = NLMSG_DATA(n); | 143 | t = NLMSG_DATA(n); |
146 | protocol = TC_H_MIN(t->tcm_info); | 144 | protocol = TC_H_MIN(t->tcm_info); |
@@ -159,7 +157,7 @@ replay: | |||
159 | /* Find head of filter chain. */ | 157 | /* Find head of filter chain. */ |
160 | 158 | ||
161 | /* Find link */ | 159 | /* Find link */ |
162 | dev = __dev_get_by_index(&init_net, t->tcm_ifindex); | 160 | dev = __dev_get_by_index(net, t->tcm_ifindex); |
163 | if (dev == NULL) | 161 | if (dev == NULL) |
164 | return -ENODEV; | 162 | return -ENODEV; |
165 | 163 | ||
@@ -283,7 +281,7 @@ replay: | |||
283 | *back = tp->next; | 281 | *back = tp->next; |
284 | spin_unlock_bh(root_lock); | 282 | spin_unlock_bh(root_lock); |
285 | 283 | ||
286 | tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER); | 284 | tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER); |
287 | tcf_destroy(tp); | 285 | tcf_destroy(tp); |
288 | err = 0; | 286 | err = 0; |
289 | goto errout; | 287 | goto errout; |
@@ -306,10 +304,10 @@ replay: | |||
306 | case RTM_DELTFILTER: | 304 | case RTM_DELTFILTER: |
307 | err = tp->ops->delete(tp, fh); | 305 | err = tp->ops->delete(tp, fh); |
308 | if (err == 0) | 306 | if (err == 0) |
309 | tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER); | 307 | tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER); |
310 | goto errout; | 308 | goto errout; |
311 | case RTM_GETTFILTER: | 309 | case RTM_GETTFILTER: |
312 | err = tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER); | 310 | err = tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER); |
313 | goto errout; | 311 | goto errout; |
314 | default: | 312 | default: |
315 | err = -EINVAL; | 313 | err = -EINVAL; |
@@ -325,7 +323,7 @@ replay: | |||
325 | *back = tp; | 323 | *back = tp; |
326 | spin_unlock_bh(root_lock); | 324 | spin_unlock_bh(root_lock); |
327 | } | 325 | } |
328 | tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER); | 326 | tfilter_notify(net, skb, n, tp, fh, RTM_NEWTFILTER); |
329 | } else { | 327 | } else { |
330 | if (tp_created) | 328 | if (tp_created) |
331 | tcf_destroy(tp); | 329 | tcf_destroy(tp); |
@@ -371,8 +369,9 @@ nla_put_failure: | |||
371 | return -1; | 369 | return -1; |
372 | } | 370 | } |
373 | 371 | ||
374 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 372 | static int tfilter_notify(struct net *net, struct sk_buff *oskb, |
375 | struct tcf_proto *tp, unsigned long fh, int event) | 373 | struct nlmsghdr *n, struct tcf_proto *tp, |
374 | unsigned long fh, int event) | ||
376 | { | 375 | { |
377 | struct sk_buff *skb; | 376 | struct sk_buff *skb; |
378 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; | 377 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; |
@@ -386,7 +385,7 @@ static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
386 | return -EINVAL; | 385 | return -EINVAL; |
387 | } | 386 | } |
388 | 387 | ||
389 | return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, | 388 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
390 | n->nlmsg_flags & NLM_F_ECHO); | 389 | n->nlmsg_flags & NLM_F_ECHO); |
391 | } | 390 | } |
392 | 391 | ||
@@ -419,12 +418,9 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
419 | const struct Qdisc_class_ops *cops; | 418 | const struct Qdisc_class_ops *cops; |
420 | struct tcf_dump_args arg; | 419 | struct tcf_dump_args arg; |
421 | 420 | ||
422 | if (!net_eq(net, &init_net)) | ||
423 | return 0; | ||
424 | |||
425 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 421 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) |
426 | return skb->len; | 422 | return skb->len; |
427 | if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) | 423 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) |
428 | return skb->len; | 424 | return skb->len; |
429 | 425 | ||
430 | if (!tcm->tcm_parent) | 426 | if (!tcm->tcm_parent) |
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 6ed61b10e00..f73542d2cdd 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -602,7 +602,6 @@ static unsigned long flow_get(struct tcf_proto *tp, u32 handle) | |||
602 | 602 | ||
603 | static void flow_put(struct tcf_proto *tp, unsigned long f) | 603 | static void flow_put(struct tcf_proto *tp, unsigned long f) |
604 | { | 604 | { |
605 | return; | ||
606 | } | 605 | } |
607 | 606 | ||
608 | static int flow_dump(struct tcf_proto *tp, unsigned long fh, | 607 | static int flow_dump(struct tcf_proto *tp, unsigned long fh, |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 17c5dfc6732..96275422c61 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -211,7 +211,7 @@ check_terminal: | |||
211 | 211 | ||
212 | deadloop: | 212 | deadloop: |
213 | if (net_ratelimit()) | 213 | if (net_ratelimit()) |
214 | printk("cls_u32: dead loop\n"); | 214 | printk(KERN_WARNING "cls_u32: dead loop\n"); |
215 | return -1; | 215 | return -1; |
216 | } | 216 | } |
217 | 217 | ||
@@ -768,15 +768,15 @@ static struct tcf_proto_ops cls_u32_ops __read_mostly = { | |||
768 | 768 | ||
769 | static int __init init_u32(void) | 769 | static int __init init_u32(void) |
770 | { | 770 | { |
771 | printk("u32 classifier\n"); | 771 | pr_info("u32 classifier\n"); |
772 | #ifdef CONFIG_CLS_U32_PERF | 772 | #ifdef CONFIG_CLS_U32_PERF |
773 | printk(" Performance counters on\n"); | 773 | pr_info(" Performance counters on\n"); |
774 | #endif | 774 | #endif |
775 | #ifdef CONFIG_NET_CLS_IND | 775 | #ifdef CONFIG_NET_CLS_IND |
776 | printk(" input device check on \n"); | 776 | pr_info(" input device check on\n"); |
777 | #endif | 777 | #endif |
778 | #ifdef CONFIG_NET_CLS_ACT | 778 | #ifdef CONFIG_NET_CLS_ACT |
779 | printk(" Actions configured \n"); | 779 | pr_info(" Actions configured\n"); |
780 | #endif | 780 | #endif |
781 | return register_tcf_proto_ops(&cls_u32_ops); | 781 | return register_tcf_proto_ops(&cls_u32_ops); |
782 | } | 782 | } |
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index e782bdeedc5..5e37da961f8 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -527,7 +527,8 @@ pop_stack: | |||
527 | 527 | ||
528 | stack_overflow: | 528 | stack_overflow: |
529 | if (net_ratelimit()) | 529 | if (net_ratelimit()) |
530 | printk("Local stack overflow, increase NET_EMATCH_STACK\n"); | 530 | printk(KERN_WARNING "tc ematch: local stack overflow," |
531 | " increase NET_EMATCH_STACK\n"); | ||
531 | return -1; | 532 | return -1; |
532 | } | 533 | } |
533 | EXPORT_SYMBOL(__tcf_em_tree_match); | 534 | EXPORT_SYMBOL(__tcf_em_tree_match); |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 145268ca57c..fe35c1f338c 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -35,10 +35,12 @@ | |||
35 | #include <net/netlink.h> | 35 | #include <net/netlink.h> |
36 | #include <net/pkt_sched.h> | 36 | #include <net/pkt_sched.h> |
37 | 37 | ||
38 | static int qdisc_notify(struct sk_buff *oskb, struct nlmsghdr *n, u32 clid, | 38 | static int qdisc_notify(struct net *net, struct sk_buff *oskb, |
39 | struct nlmsghdr *n, u32 clid, | ||
39 | struct Qdisc *old, struct Qdisc *new); | 40 | struct Qdisc *old, struct Qdisc *new); |
40 | static int tclass_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 41 | static int tclass_notify(struct net *net, struct sk_buff *oskb, |
41 | struct Qdisc *q, unsigned long cl, int event); | 42 | struct nlmsghdr *n, struct Qdisc *q, |
43 | unsigned long cl, int event); | ||
42 | 44 | ||
43 | /* | 45 | /* |
44 | 46 | ||
@@ -639,11 +641,12 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) | |||
639 | } | 641 | } |
640 | EXPORT_SYMBOL(qdisc_tree_decrease_qlen); | 642 | EXPORT_SYMBOL(qdisc_tree_decrease_qlen); |
641 | 643 | ||
642 | static void notify_and_destroy(struct sk_buff *skb, struct nlmsghdr *n, u32 clid, | 644 | static void notify_and_destroy(struct net *net, struct sk_buff *skb, |
645 | struct nlmsghdr *n, u32 clid, | ||
643 | struct Qdisc *old, struct Qdisc *new) | 646 | struct Qdisc *old, struct Qdisc *new) |
644 | { | 647 | { |
645 | if (new || old) | 648 | if (new || old) |
646 | qdisc_notify(skb, n, clid, old, new); | 649 | qdisc_notify(net, skb, n, clid, old, new); |
647 | 650 | ||
648 | if (old) | 651 | if (old) |
649 | qdisc_destroy(old); | 652 | qdisc_destroy(old); |
@@ -663,6 +666,7 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
663 | struct Qdisc *new, struct Qdisc *old) | 666 | struct Qdisc *new, struct Qdisc *old) |
664 | { | 667 | { |
665 | struct Qdisc *q = old; | 668 | struct Qdisc *q = old; |
669 | struct net *net = dev_net(dev); | ||
666 | int err = 0; | 670 | int err = 0; |
667 | 671 | ||
668 | if (parent == NULL) { | 672 | if (parent == NULL) { |
@@ -699,12 +703,13 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
699 | } | 703 | } |
700 | 704 | ||
701 | if (!ingress) { | 705 | if (!ingress) { |
702 | notify_and_destroy(skb, n, classid, dev->qdisc, new); | 706 | notify_and_destroy(net, skb, n, classid, |
707 | dev->qdisc, new); | ||
703 | if (new && !new->ops->attach) | 708 | if (new && !new->ops->attach) |
704 | atomic_inc(&new->refcnt); | 709 | atomic_inc(&new->refcnt); |
705 | dev->qdisc = new ? : &noop_qdisc; | 710 | dev->qdisc = new ? : &noop_qdisc; |
706 | } else { | 711 | } else { |
707 | notify_and_destroy(skb, n, classid, old, new); | 712 | notify_and_destroy(net, skb, n, classid, old, new); |
708 | } | 713 | } |
709 | 714 | ||
710 | if (dev->flags & IFF_UP) | 715 | if (dev->flags & IFF_UP) |
@@ -722,7 +727,7 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
722 | err = -ENOENT; | 727 | err = -ENOENT; |
723 | } | 728 | } |
724 | if (!err) | 729 | if (!err) |
725 | notify_and_destroy(skb, n, classid, old, new); | 730 | notify_and_destroy(net, skb, n, classid, old, new); |
726 | } | 731 | } |
727 | return err; | 732 | return err; |
728 | } | 733 | } |
@@ -948,10 +953,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
948 | struct Qdisc *p = NULL; | 953 | struct Qdisc *p = NULL; |
949 | int err; | 954 | int err; |
950 | 955 | ||
951 | if (!net_eq(net, &init_net)) | 956 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) |
952 | return -EINVAL; | ||
953 | |||
954 | if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) | ||
955 | return -ENODEV; | 957 | return -ENODEV; |
956 | 958 | ||
957 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); | 959 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); |
@@ -991,7 +993,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
991 | if ((err = qdisc_graft(dev, p, skb, n, clid, NULL, q)) != 0) | 993 | if ((err = qdisc_graft(dev, p, skb, n, clid, NULL, q)) != 0) |
992 | return err; | 994 | return err; |
993 | } else { | 995 | } else { |
994 | qdisc_notify(skb, n, clid, NULL, q); | 996 | qdisc_notify(net, skb, n, clid, NULL, q); |
995 | } | 997 | } |
996 | return 0; | 998 | return 0; |
997 | } | 999 | } |
@@ -1010,16 +1012,13 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1010 | struct Qdisc *q, *p; | 1012 | struct Qdisc *q, *p; |
1011 | int err; | 1013 | int err; |
1012 | 1014 | ||
1013 | if (!net_eq(net, &init_net)) | ||
1014 | return -EINVAL; | ||
1015 | |||
1016 | replay: | 1015 | replay: |
1017 | /* Reinit, just in case something touches this. */ | 1016 | /* Reinit, just in case something touches this. */ |
1018 | tcm = NLMSG_DATA(n); | 1017 | tcm = NLMSG_DATA(n); |
1019 | clid = tcm->tcm_parent; | 1018 | clid = tcm->tcm_parent; |
1020 | q = p = NULL; | 1019 | q = p = NULL; |
1021 | 1020 | ||
1022 | if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) | 1021 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) |
1023 | return -ENODEV; | 1022 | return -ENODEV; |
1024 | 1023 | ||
1025 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); | 1024 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); |
@@ -1106,7 +1105,7 @@ replay: | |||
1106 | return -EINVAL; | 1105 | return -EINVAL; |
1107 | err = qdisc_change(q, tca); | 1106 | err = qdisc_change(q, tca); |
1108 | if (err == 0) | 1107 | if (err == 0) |
1109 | qdisc_notify(skb, n, clid, NULL, q); | 1108 | qdisc_notify(net, skb, n, clid, NULL, q); |
1110 | return err; | 1109 | return err; |
1111 | 1110 | ||
1112 | create_n_graft: | 1111 | create_n_graft: |
@@ -1196,8 +1195,9 @@ nla_put_failure: | |||
1196 | return -1; | 1195 | return -1; |
1197 | } | 1196 | } |
1198 | 1197 | ||
1199 | static int qdisc_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 1198 | static int qdisc_notify(struct net *net, struct sk_buff *oskb, |
1200 | u32 clid, struct Qdisc *old, struct Qdisc *new) | 1199 | struct nlmsghdr *n, u32 clid, |
1200 | struct Qdisc *old, struct Qdisc *new) | ||
1201 | { | 1201 | { |
1202 | struct sk_buff *skb; | 1202 | struct sk_buff *skb; |
1203 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; | 1203 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; |
@@ -1216,7 +1216,7 @@ static int qdisc_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
1216 | } | 1216 | } |
1217 | 1217 | ||
1218 | if (skb->len) | 1218 | if (skb->len) |
1219 | return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); | 1219 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); |
1220 | 1220 | ||
1221 | err_out: | 1221 | err_out: |
1222 | kfree_skb(skb); | 1222 | kfree_skb(skb); |
@@ -1275,15 +1275,12 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) | |||
1275 | int s_idx, s_q_idx; | 1275 | int s_idx, s_q_idx; |
1276 | struct net_device *dev; | 1276 | struct net_device *dev; |
1277 | 1277 | ||
1278 | if (!net_eq(net, &init_net)) | ||
1279 | return 0; | ||
1280 | |||
1281 | s_idx = cb->args[0]; | 1278 | s_idx = cb->args[0]; |
1282 | s_q_idx = q_idx = cb->args[1]; | 1279 | s_q_idx = q_idx = cb->args[1]; |
1283 | 1280 | ||
1284 | rcu_read_lock(); | 1281 | rcu_read_lock(); |
1285 | idx = 0; | 1282 | idx = 0; |
1286 | for_each_netdev_rcu(&init_net, dev) { | 1283 | for_each_netdev_rcu(net, dev) { |
1287 | struct netdev_queue *dev_queue; | 1284 | struct netdev_queue *dev_queue; |
1288 | 1285 | ||
1289 | if (idx < s_idx) | 1286 | if (idx < s_idx) |
@@ -1335,10 +1332,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1335 | u32 qid = TC_H_MAJ(clid); | 1332 | u32 qid = TC_H_MAJ(clid); |
1336 | int err; | 1333 | int err; |
1337 | 1334 | ||
1338 | if (!net_eq(net, &init_net)) | 1335 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) |
1339 | return -EINVAL; | ||
1340 | |||
1341 | if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) | ||
1342 | return -ENODEV; | 1336 | return -ENODEV; |
1343 | 1337 | ||
1344 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); | 1338 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); |
@@ -1419,10 +1413,10 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1419 | if (cops->delete) | 1413 | if (cops->delete) |
1420 | err = cops->delete(q, cl); | 1414 | err = cops->delete(q, cl); |
1421 | if (err == 0) | 1415 | if (err == 0) |
1422 | tclass_notify(skb, n, q, cl, RTM_DELTCLASS); | 1416 | tclass_notify(net, skb, n, q, cl, RTM_DELTCLASS); |
1423 | goto out; | 1417 | goto out; |
1424 | case RTM_GETTCLASS: | 1418 | case RTM_GETTCLASS: |
1425 | err = tclass_notify(skb, n, q, cl, RTM_NEWTCLASS); | 1419 | err = tclass_notify(net, skb, n, q, cl, RTM_NEWTCLASS); |
1426 | goto out; | 1420 | goto out; |
1427 | default: | 1421 | default: |
1428 | err = -EINVAL; | 1422 | err = -EINVAL; |
@@ -1435,7 +1429,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1435 | if (cops->change) | 1429 | if (cops->change) |
1436 | err = cops->change(q, clid, pid, tca, &new_cl); | 1430 | err = cops->change(q, clid, pid, tca, &new_cl); |
1437 | if (err == 0) | 1431 | if (err == 0) |
1438 | tclass_notify(skb, n, q, new_cl, RTM_NEWTCLASS); | 1432 | tclass_notify(net, skb, n, q, new_cl, RTM_NEWTCLASS); |
1439 | 1433 | ||
1440 | out: | 1434 | out: |
1441 | if (cl) | 1435 | if (cl) |
@@ -1487,8 +1481,9 @@ nla_put_failure: | |||
1487 | return -1; | 1481 | return -1; |
1488 | } | 1482 | } |
1489 | 1483 | ||
1490 | static int tclass_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 1484 | static int tclass_notify(struct net *net, struct sk_buff *oskb, |
1491 | struct Qdisc *q, unsigned long cl, int event) | 1485 | struct nlmsghdr *n, struct Qdisc *q, |
1486 | unsigned long cl, int event) | ||
1492 | { | 1487 | { |
1493 | struct sk_buff *skb; | 1488 | struct sk_buff *skb; |
1494 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; | 1489 | u32 pid = oskb ? NETLINK_CB(oskb).pid : 0; |
@@ -1502,7 +1497,7 @@ static int tclass_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
1502 | return -EINVAL; | 1497 | return -EINVAL; |
1503 | } | 1498 | } |
1504 | 1499 | ||
1505 | return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); | 1500 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); |
1506 | } | 1501 | } |
1507 | 1502 | ||
1508 | struct qdisc_dump_args | 1503 | struct qdisc_dump_args |
@@ -1577,12 +1572,9 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) | |||
1577 | struct net_device *dev; | 1572 | struct net_device *dev; |
1578 | int t, s_t; | 1573 | int t, s_t; |
1579 | 1574 | ||
1580 | if (!net_eq(net, &init_net)) | ||
1581 | return 0; | ||
1582 | |||
1583 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 1575 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) |
1584 | return 0; | 1576 | return 0; |
1585 | if ((dev = dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL) | 1577 | if ((dev = dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) |
1586 | return 0; | 1578 | return 0; |
1587 | 1579 | ||
1588 | s_t = cb->args[0]; | 1580 | s_t = cb->args[0]; |
@@ -1645,9 +1637,12 @@ reclassify: | |||
1645 | tp = otp; | 1637 | tp = otp; |
1646 | 1638 | ||
1647 | if (verd++ >= MAX_REC_LOOP) { | 1639 | if (verd++ >= MAX_REC_LOOP) { |
1648 | printk("rule prio %u protocol %02x reclassify loop, " | 1640 | if (net_ratelimit()) |
1649 | "packet dropped\n", | 1641 | printk(KERN_NOTICE |
1650 | tp->prio&0xffff, ntohs(tp->protocol)); | 1642 | "%s: packet reclassify loop" |
1643 | " rule prio %u protocol %02x\n", | ||
1644 | tp->q->ops->id, | ||
1645 | tp->prio & 0xffff, ntohs(tp->protocol)); | ||
1651 | return TC_ACT_SHOT; | 1646 | return TC_ACT_SHOT; |
1652 | } | 1647 | } |
1653 | skb->tc_verd = SET_TC_VERD(skb->tc_verd, verd); | 1648 | skb->tc_verd = SET_TC_VERD(skb->tc_verd, verd); |
@@ -1692,7 +1687,7 @@ static int psched_show(struct seq_file *seq, void *v) | |||
1692 | 1687 | ||
1693 | static int psched_open(struct inode *inode, struct file *file) | 1688 | static int psched_open(struct inode *inode, struct file *file) |
1694 | { | 1689 | { |
1695 | return single_open(file, psched_show, PDE(inode)->data); | 1690 | return single_open(file, psched_show, NULL); |
1696 | } | 1691 | } |
1697 | 1692 | ||
1698 | static const struct file_operations psched_fops = { | 1693 | static const struct file_operations psched_fops = { |
@@ -1702,15 +1697,53 @@ static const struct file_operations psched_fops = { | |||
1702 | .llseek = seq_lseek, | 1697 | .llseek = seq_lseek, |
1703 | .release = single_release, | 1698 | .release = single_release, |
1704 | }; | 1699 | }; |
1700 | |||
1701 | static int __net_init psched_net_init(struct net *net) | ||
1702 | { | ||
1703 | struct proc_dir_entry *e; | ||
1704 | |||
1705 | e = proc_net_fops_create(net, "psched", 0, &psched_fops); | ||
1706 | if (e == NULL) | ||
1707 | return -ENOMEM; | ||
1708 | |||
1709 | return 0; | ||
1710 | } | ||
1711 | |||
1712 | static void __net_exit psched_net_exit(struct net *net) | ||
1713 | { | ||
1714 | proc_net_remove(net, "psched"); | ||
1715 | } | ||
1716 | #else | ||
1717 | static int __net_init psched_net_init(struct net *net) | ||
1718 | { | ||
1719 | return 0; | ||
1720 | } | ||
1721 | |||
1722 | static void __net_exit psched_net_exit(struct net *net) | ||
1723 | { | ||
1724 | } | ||
1705 | #endif | 1725 | #endif |
1706 | 1726 | ||
1727 | static struct pernet_operations psched_net_ops = { | ||
1728 | .init = psched_net_init, | ||
1729 | .exit = psched_net_exit, | ||
1730 | }; | ||
1731 | |||
1707 | static int __init pktsched_init(void) | 1732 | static int __init pktsched_init(void) |
1708 | { | 1733 | { |
1734 | int err; | ||
1735 | |||
1736 | err = register_pernet_subsys(&psched_net_ops); | ||
1737 | if (err) { | ||
1738 | printk(KERN_ERR "pktsched_init: " | ||
1739 | "cannot initialize per netns operations\n"); | ||
1740 | return err; | ||
1741 | } | ||
1742 | |||
1709 | register_qdisc(&pfifo_qdisc_ops); | 1743 | register_qdisc(&pfifo_qdisc_ops); |
1710 | register_qdisc(&bfifo_qdisc_ops); | 1744 | register_qdisc(&bfifo_qdisc_ops); |
1711 | register_qdisc(&pfifo_head_drop_qdisc_ops); | 1745 | register_qdisc(&pfifo_head_drop_qdisc_ops); |
1712 | register_qdisc(&mq_qdisc_ops); | 1746 | register_qdisc(&mq_qdisc_ops); |
1713 | proc_net_fops_create(&init_net, "psched", 0, &psched_fops); | ||
1714 | 1747 | ||
1715 | rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL); | 1748 | rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL); |
1716 | rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL); | 1749 | rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL); |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index ff4dd53eeff..a63029ef3ed 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <net/pkt_sched.h> | 28 | #include <net/pkt_sched.h> |
29 | #include <net/dst.h> | ||
29 | 30 | ||
30 | /* Main transmission queue. */ | 31 | /* Main transmission queue. */ |
31 | 32 | ||
@@ -40,6 +41,7 @@ | |||
40 | 41 | ||
41 | static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) | 42 | static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) |
42 | { | 43 | { |
44 | skb_dst_force(skb); | ||
43 | q->gso_skb = skb; | 45 | q->gso_skb = skb; |
44 | q->qstats.requeues++; | 46 | q->qstats.requeues++; |
45 | q->q.qlen++; /* it's still part of the queue */ | 47 | q->q.qlen++; /* it's still part of the queue */ |
@@ -94,7 +96,7 @@ static inline int handle_dev_cpu_collision(struct sk_buff *skb, | |||
94 | * Another cpu is holding lock, requeue & delay xmits for | 96 | * Another cpu is holding lock, requeue & delay xmits for |
95 | * some time. | 97 | * some time. |
96 | */ | 98 | */ |
97 | __get_cpu_var(netdev_rx_stat).cpu_collision++; | 99 | __get_cpu_var(softnet_data).cpu_collision++; |
98 | ret = dev_requeue_skb(skb, q); | 100 | ret = dev_requeue_skb(skb, q); |
99 | } | 101 | } |
100 | 102 | ||
@@ -179,7 +181,7 @@ static inline int qdisc_restart(struct Qdisc *q) | |||
179 | skb = dequeue_skb(q); | 181 | skb = dequeue_skb(q); |
180 | if (unlikely(!skb)) | 182 | if (unlikely(!skb)) |
181 | return 0; | 183 | return 0; |
182 | 184 | WARN_ON_ONCE(skb_dst_is_noref(skb)); | |
183 | root_lock = qdisc_lock(q); | 185 | root_lock = qdisc_lock(q); |
184 | dev = qdisc_dev(q); | 186 | dev = qdisc_dev(q); |
185 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); | 187 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); |
@@ -529,7 +531,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, | |||
529 | unsigned int size; | 531 | unsigned int size; |
530 | int err = -ENOBUFS; | 532 | int err = -ENOBUFS; |
531 | 533 | ||
532 | /* ensure that the Qdisc and the private data are 32-byte aligned */ | 534 | /* ensure that the Qdisc and the private data are 64-byte aligned */ |
533 | size = QDISC_ALIGN(sizeof(*sch)); | 535 | size = QDISC_ALIGN(sizeof(*sch)); |
534 | size += ops->priv_size + (QDISC_ALIGNTO - 1); | 536 | size += ops->priv_size + (QDISC_ALIGNTO - 1); |
535 | 537 | ||
@@ -591,6 +593,13 @@ void qdisc_reset(struct Qdisc *qdisc) | |||
591 | } | 593 | } |
592 | EXPORT_SYMBOL(qdisc_reset); | 594 | EXPORT_SYMBOL(qdisc_reset); |
593 | 595 | ||
596 | static void qdisc_rcu_free(struct rcu_head *head) | ||
597 | { | ||
598 | struct Qdisc *qdisc = container_of(head, struct Qdisc, rcu_head); | ||
599 | |||
600 | kfree((char *) qdisc - qdisc->padded); | ||
601 | } | ||
602 | |||
594 | void qdisc_destroy(struct Qdisc *qdisc) | 603 | void qdisc_destroy(struct Qdisc *qdisc) |
595 | { | 604 | { |
596 | const struct Qdisc_ops *ops = qdisc->ops; | 605 | const struct Qdisc_ops *ops = qdisc->ops; |
@@ -614,7 +623,11 @@ void qdisc_destroy(struct Qdisc *qdisc) | |||
614 | dev_put(qdisc_dev(qdisc)); | 623 | dev_put(qdisc_dev(qdisc)); |
615 | 624 | ||
616 | kfree_skb(qdisc->gso_skb); | 625 | kfree_skb(qdisc->gso_skb); |
617 | kfree((char *) qdisc - qdisc->padded); | 626 | /* |
627 | * gen_estimator est_timer() might access qdisc->q.lock, | ||
628 | * wait a RCU grace period before freeing qdisc. | ||
629 | */ | ||
630 | call_rcu(&qdisc->rcu_head, qdisc_rcu_free); | ||
618 | } | 631 | } |
619 | EXPORT_SYMBOL(qdisc_destroy); | 632 | EXPORT_SYMBOL(qdisc_destroy); |
620 | 633 | ||
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index b38b39c6075..abd904be428 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -617,7 +617,6 @@ rtsc_min(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y) | |||
617 | rtsc->y = y; | 617 | rtsc->y = y; |
618 | rtsc->dx = dx; | 618 | rtsc->dx = dx; |
619 | rtsc->dy = dy; | 619 | rtsc->dy = dy; |
620 | return; | ||
621 | } | 620 | } |
622 | 621 | ||
623 | static void | 622 | static void |
@@ -1155,7 +1154,7 @@ static struct hfsc_class * | |||
1155 | hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) | 1154 | hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) |
1156 | { | 1155 | { |
1157 | struct hfsc_sched *q = qdisc_priv(sch); | 1156 | struct hfsc_sched *q = qdisc_priv(sch); |
1158 | struct hfsc_class *cl; | 1157 | struct hfsc_class *head, *cl; |
1159 | struct tcf_result res; | 1158 | struct tcf_result res; |
1160 | struct tcf_proto *tcf; | 1159 | struct tcf_proto *tcf; |
1161 | int result; | 1160 | int result; |
@@ -1166,6 +1165,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) | |||
1166 | return cl; | 1165 | return cl; |
1167 | 1166 | ||
1168 | *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; | 1167 | *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; |
1168 | head = &q->root; | ||
1169 | tcf = q->root.filter_list; | 1169 | tcf = q->root.filter_list; |
1170 | while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { | 1170 | while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { |
1171 | #ifdef CONFIG_NET_CLS_ACT | 1171 | #ifdef CONFIG_NET_CLS_ACT |
@@ -1180,6 +1180,8 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) | |||
1180 | if ((cl = (struct hfsc_class *)res.class) == NULL) { | 1180 | if ((cl = (struct hfsc_class *)res.class) == NULL) { |
1181 | if ((cl = hfsc_find_class(res.classid, sch)) == NULL) | 1181 | if ((cl = hfsc_find_class(res.classid, sch)) == NULL) |
1182 | break; /* filter selected invalid classid */ | 1182 | break; /* filter selected invalid classid */ |
1183 | if (cl->level >= head->level) | ||
1184 | break; /* filter may only point downwards */ | ||
1183 | } | 1185 | } |
1184 | 1186 | ||
1185 | if (cl->level == 0) | 1187 | if (cl->level == 0) |
@@ -1187,6 +1189,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr) | |||
1187 | 1189 | ||
1188 | /* apply inner filter chain */ | 1190 | /* apply inner filter chain */ |
1189 | tcf = cl->filter_list; | 1191 | tcf = cl->filter_list; |
1192 | head = cl; | ||
1190 | } | 1193 | } |
1191 | 1194 | ||
1192 | /* classification failed, try default class */ | 1195 | /* classification failed, try default class */ |
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index a9e646bdb60..f10e34a6844 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c | |||
@@ -44,7 +44,6 @@ static void ingress_put(struct Qdisc *sch, unsigned long cl) | |||
44 | 44 | ||
45 | static void ingress_walk(struct Qdisc *sch, struct qdisc_walker *walker) | 45 | static void ingress_walk(struct Qdisc *sch, struct qdisc_walker *walker) |
46 | { | 46 | { |
47 | return; | ||
48 | } | 47 | } |
49 | 48 | ||
50 | static struct tcf_proto **ingress_find_tcf(struct Qdisc *sch, unsigned long cl) | 49 | static struct tcf_proto **ingress_find_tcf(struct Qdisc *sch, unsigned long cl) |
diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c index b2aba3f5e6f..fe91e50f9d9 100644 --- a/net/sched/sch_mq.c +++ b/net/sched/sch_mq.c | |||
@@ -174,7 +174,6 @@ static unsigned long mq_get(struct Qdisc *sch, u32 classid) | |||
174 | 174 | ||
175 | static void mq_put(struct Qdisc *sch, unsigned long cl) | 175 | static void mq_put(struct Qdisc *sch, unsigned long cl) |
176 | { | 176 | { |
177 | return; | ||
178 | } | 177 | } |
179 | 178 | ||
180 | static int mq_dump_class(struct Qdisc *sch, unsigned long cl, | 179 | static int mq_dump_class(struct Qdisc *sch, unsigned long cl, |
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c index c50876cd870..6ae251279fc 100644 --- a/net/sched/sch_multiq.c +++ b/net/sched/sch_multiq.c | |||
@@ -340,7 +340,6 @@ static unsigned long multiq_bind(struct Qdisc *sch, unsigned long parent, | |||
340 | 340 | ||
341 | static void multiq_put(struct Qdisc *q, unsigned long cl) | 341 | static void multiq_put(struct Qdisc *q, unsigned long cl) |
342 | { | 342 | { |
343 | return; | ||
344 | } | 343 | } |
345 | 344 | ||
346 | static int multiq_dump_class(struct Qdisc *sch, unsigned long cl, | 345 | static int multiq_dump_class(struct Qdisc *sch, unsigned long cl, |
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 81672e0c1b2..0748fb1e3a4 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -303,7 +303,6 @@ static unsigned long prio_bind(struct Qdisc *sch, unsigned long parent, u32 clas | |||
303 | 303 | ||
304 | static void prio_put(struct Qdisc *q, unsigned long cl) | 304 | static void prio_put(struct Qdisc *q, unsigned long cl) |
305 | { | 305 | { |
306 | return; | ||
307 | } | 306 | } |
308 | 307 | ||
309 | static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb, | 308 | static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb, |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 072cdf442f8..8d42bb3ba54 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -303,7 +303,6 @@ static unsigned long red_get(struct Qdisc *sch, u32 classid) | |||
303 | 303 | ||
304 | static void red_put(struct Qdisc *sch, unsigned long arg) | 304 | static void red_put(struct Qdisc *sch, unsigned long arg) |
305 | { | 305 | { |
306 | return; | ||
307 | } | 306 | } |
308 | 307 | ||
309 | static void red_walk(struct Qdisc *sch, struct qdisc_walker *walker) | 308 | static void red_walk(struct Qdisc *sch, struct qdisc_walker *walker) |
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index c5a9ac56600..c65762823f5 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -123,8 +123,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) | |||
123 | case htons(ETH_P_IP): | 123 | case htons(ETH_P_IP): |
124 | { | 124 | { |
125 | const struct iphdr *iph = ip_hdr(skb); | 125 | const struct iphdr *iph = ip_hdr(skb); |
126 | h = iph->daddr; | 126 | h = (__force u32)iph->daddr; |
127 | h2 = iph->saddr ^ iph->protocol; | 127 | h2 = (__force u32)iph->saddr ^ iph->protocol; |
128 | if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && | 128 | if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && |
129 | (iph->protocol == IPPROTO_TCP || | 129 | (iph->protocol == IPPROTO_TCP || |
130 | iph->protocol == IPPROTO_UDP || | 130 | iph->protocol == IPPROTO_UDP || |
@@ -138,8 +138,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) | |||
138 | case htons(ETH_P_IPV6): | 138 | case htons(ETH_P_IPV6): |
139 | { | 139 | { |
140 | struct ipv6hdr *iph = ipv6_hdr(skb); | 140 | struct ipv6hdr *iph = ipv6_hdr(skb); |
141 | h = iph->daddr.s6_addr32[3]; | 141 | h = (__force u32)iph->daddr.s6_addr32[3]; |
142 | h2 = iph->saddr.s6_addr32[3] ^ iph->nexthdr; | 142 | h2 = (__force u32)iph->saddr.s6_addr32[3] ^ iph->nexthdr; |
143 | if (iph->nexthdr == IPPROTO_TCP || | 143 | if (iph->nexthdr == IPPROTO_TCP || |
144 | iph->nexthdr == IPPROTO_UDP || | 144 | iph->nexthdr == IPPROTO_UDP || |
145 | iph->nexthdr == IPPROTO_UDPLITE || | 145 | iph->nexthdr == IPPROTO_UDPLITE || |
@@ -150,7 +150,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb) | |||
150 | break; | 150 | break; |
151 | } | 151 | } |
152 | default: | 152 | default: |
153 | h = (unsigned long)skb_dst(skb) ^ skb->protocol; | 153 | h = (unsigned long)skb_dst(skb) ^ (__force u32)skb->protocol; |
154 | h2 = (unsigned long)skb->sk; | 154 | h2 = (unsigned long)skb->sk; |
155 | } | 155 | } |
156 | 156 | ||
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 8fb8107ab18..0991c640cd3 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -273,7 +273,11 @@ static int tbf_change(struct Qdisc* sch, struct nlattr *opt) | |||
273 | if (max_size < 0) | 273 | if (max_size < 0) |
274 | goto done; | 274 | goto done; |
275 | 275 | ||
276 | if (qopt->limit > 0) { | 276 | if (q->qdisc != &noop_qdisc) { |
277 | err = fifo_set_limit(q->qdisc, qopt->limit); | ||
278 | if (err) | ||
279 | goto done; | ||
280 | } else if (qopt->limit > 0) { | ||
277 | child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit); | 281 | child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit); |
278 | if (IS_ERR(child)) { | 282 | if (IS_ERR(child)) { |
279 | err = PTR_ERR(child); | 283 | err = PTR_ERR(child); |