]> err.no Git - linux-2.6/blobdiff - net/sched/act_api.c
[NET_SCHED]: kill obsolete NET_CLS_POLICE option
[linux-2.6] / net / sched / act_api.c
index feef366cad5dab0ad6f36a18ae0ec7203b1f1641..81506474a4f769bde9cb0e5349d2977962923cce 100644 (file)
@@ -18,6 +18,8 @@
 #include <linux/skbuff.h>
 #include <linux/init.h>
 #include <linux/kmod.h>
+#include <net/net_namespace.h>
+#include <net/sock.h>
 #include <net/sch_generic.h>
 #include <net/act_api.h>
 #include <net/netlink.h>
@@ -68,7 +70,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
        int err = 0, index = -1,i = 0, s_i = 0, n_i = 0;
        struct rtattr *r ;
 
-       read_lock(hinfo->lock);
+       read_lock_bh(hinfo->lock);
 
        s_i = cb->args[0];
 
@@ -96,7 +98,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct netlink_callback *cb,
                }
        }
 done:
-       read_unlock(hinfo->lock);
+       read_unlock_bh(hinfo->lock);
        if (n_i)
                cb->args[0] += n_i;
        return n_i;
@@ -156,13 +158,13 @@ struct tcf_common *tcf_hash_lookup(u32 index, struct tcf_hashinfo *hinfo)
 {
        struct tcf_common *p;
 
-       read_lock(hinfo->lock);
+       read_lock_bh(hinfo->lock);
        for (p = hinfo->htab[tcf_hash(index, hinfo->hmask)]; p;
             p = p->tcfc_next) {
                if (p->tcfc_index == index)
                        break;
        }
-       read_unlock(hinfo->lock);
+       read_unlock_bh(hinfo->lock);
 
        return p;
 }
@@ -658,7 +660,7 @@ act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event)
                return -EINVAL;
        }
 
-       return rtnl_unicast(skb, pid);
+       return rtnl_unicast(skb, &init_net, pid);
 }
 
 static struct tc_action *
@@ -779,7 +781,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
        nlh->nlmsg_flags |= NLM_F_ROOT;
        module_put(a->ops->owner);
        kfree(a);
-       err = rtnetlink_send(skb, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO);
+       err = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO);
        if (err > 0)
                return 0;
 
@@ -842,7 +844,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)
 
                /* now do the delete */
                tcf_action_destroy(head, 0);
-               ret = rtnetlink_send(skb, pid, RTNLGRP_TC,
+               ret = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC,
                                     n->nlmsg_flags&NLM_F_ECHO);
                if (ret > 0)
                        return 0;
@@ -886,7 +888,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
        nlh->nlmsg_len = skb_tail_pointer(skb) - b;
        NETLINK_CB(skb).dst_group = RTNLGRP_TC;
 
-       err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
+       err = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
        if (err > 0)
                err = 0;
        return err;
@@ -924,10 +926,14 @@ done:
 
 static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
 {
+       struct net *net = skb->sk->sk_net;
        struct rtattr **tca = arg;
        u32 pid = skb ? NETLINK_CB(skb).pid : 0;
        int ret = 0, ovr = 0;
 
+       if (net != &init_net)
+               return -EINVAL;
+
        if (tca[TCA_ACT_TAB-1] == NULL) {
                printk("tc_ctl_action: received NO action attribs\n");
                return -EINVAL;
@@ -997,6 +1003,7 @@ find_dump_kind(struct nlmsghdr *n)
 static int
 tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
 {
+       struct net *net = skb->sk->sk_net;
        struct nlmsghdr *nlh;
        unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *x;
@@ -1006,6 +1013,9 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
        struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
        struct rtattr *kind = find_dump_kind(cb->nlh);
 
+       if (net != &init_net)
+               return 0;
+
        if (kind == NULL) {
                printk("tc_dump_action: action bad kind\n");
                return 0;