net sched: Pass the skb into change so it can access NETLINK_CB
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 25 May 2012 19:42:45 +0000 (13:42 -0600)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 15 Aug 2012 04:55:28 +0000 (21:55 -0700)
cls_flow.c plays with uids and gids.  Unless I misread that
code it is possible for classifiers to depend on the specific uid and
gid values.  Therefore I need to know the user namespace of the
netlink socket that is installing the packet classifiers.  Pass
in the rtnetlink skb so I can access the NETLINK_CB of the passed
packet.  In particular I want access to sk_user_ns(NETLINK_CB(in_skb).ssk).

Pass in not the user namespace but the incomming rtnetlink skb into
the the classifier change routines as that is generally the more useful
parameter.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
include/net/sch_generic.h
net/sched/cls_api.c
net/sched/cls_basic.c
net/sched/cls_cgroup.c
net/sched/cls_flow.c
net/sched/cls_fw.c
net/sched/cls_route.c
net/sched/cls_rsvp.h
net/sched/cls_tcindex.c
net/sched/cls_u32.c

index d9611e03241873fd5cb4140cf0d9c5e3ae7a2486..4616f468d5995f9a0b46d7351c5c8f7dc3a869c8 100644 (file)
@@ -188,7 +188,8 @@ struct tcf_proto_ops {
 
        unsigned long           (*get)(struct tcf_proto*, u32 handle);
        void                    (*put)(struct tcf_proto*, unsigned long);
-       int                     (*change)(struct tcf_proto*, unsigned long,
+       int                     (*change)(struct sk_buff *,
+                                       struct tcf_proto*, unsigned long,
                                        u32 handle, struct nlattr **,
                                        unsigned long *);
        int                     (*delete)(struct tcf_proto*, unsigned long);
index 6dd1131f2ec1f023f6113c94c832103860dbb6bb..dc3ef5aef3559a4e4dd0f490230789e0e440e8f3 100644 (file)
@@ -319,7 +319,7 @@ replay:
                }
        }
 
-       err = tp->ops->change(tp, cl, t->tcm_handle, tca, &fh);
+       err = tp->ops->change(skb, tp, cl, t->tcm_handle, tca, &fh);
        if (err == 0) {
                if (tp_created) {
                        spin_lock_bh(root_lock);
index 590960a22a77fb0747c2fc42c78caff686cd8ac8..344a11b342e5ad333430ba68605bec6ce5f27f5c 100644 (file)
@@ -162,7 +162,8 @@ errout:
        return err;
 }
 
-static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
+static int basic_change(struct sk_buff *in_skb,
+                       struct tcf_proto *tp, unsigned long base, u32 handle,
                        struct nlattr **tca, unsigned long *arg)
 {
        int err;
index 7743ea8d1d387d920dcee43abe4a3bfeb8502bfd..91de66695b4a372581466fc0369f6c02c38af570 100644 (file)
@@ -151,7 +151,8 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = {
        [TCA_CGROUP_EMATCHES]   = { .type = NLA_NESTED },
 };
 
-static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base,
+static int cls_cgroup_change(struct sk_buff *in_skb,
+                            struct tcf_proto *tp, unsigned long base,
                             u32 handle, struct nlattr **tca,
                             unsigned long *arg)
 {
index ccd08c8dc6a72b18f0c7c45f743fa4912f954413..ae854f3434b0bf5e2f14d0da31fc56506a7005d2 100644 (file)
@@ -347,7 +347,8 @@ static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = {
        [TCA_FLOW_PERTURB]      = { .type = NLA_U32 },
 };
 
-static int flow_change(struct tcf_proto *tp, unsigned long base,
+static int flow_change(struct sk_buff *in_skb, 
+                      struct tcf_proto *tp, unsigned long base,
                       u32 handle, struct nlattr **tca,
                       unsigned long *arg)
 {
index 8384a47972403360c22688d8daa1ebdf34338aad..4075a0aef2aa2e83fdf167c056e216c3abfc6204 100644 (file)
@@ -233,7 +233,8 @@ errout:
        return err;
 }
 
-static int fw_change(struct tcf_proto *tp, unsigned long base,
+static int fw_change(struct sk_buff *in_skb,
+                    struct tcf_proto *tp, unsigned long base,
                     u32 handle,
                     struct nlattr **tca,
                     unsigned long *arg)
index 44f405cb9aafa54d07ecbd99d006778f71e5634e..c10d57bf98f2aa036434633db10a03fa530688da 100644 (file)
@@ -427,7 +427,8 @@ errout:
        return err;
 }
 
-static int route4_change(struct tcf_proto *tp, unsigned long base,
+static int route4_change(struct sk_buff *in_skb,
+                      struct tcf_proto *tp, unsigned long base,
                       u32 handle,
                       struct nlattr **tca,
                       unsigned long *arg)
index 18ab93ec8d7e3abb9b25514d09485d4a3e3b21c4..494bbb90924a36445d73ef5c921112b685722128 100644 (file)
@@ -416,7 +416,8 @@ static const struct nla_policy rsvp_policy[TCA_RSVP_MAX + 1] = {
        [TCA_RSVP_PINFO]        = { .len = sizeof(struct tc_rsvp_pinfo) },
 };
 
-static int rsvp_change(struct tcf_proto *tp, unsigned long base,
+static int rsvp_change(struct sk_buff *in_skb,
+                      struct tcf_proto *tp, unsigned long base,
                       u32 handle,
                       struct nlattr **tca,
                       unsigned long *arg)
index fe29420d0b0e5a4241dbe7a5190c2f0686ce1fa0..a1293b4ab7a13a38ae2653bc91bf48527cfdee7a 100644 (file)
@@ -332,7 +332,8 @@ errout:
 }
 
 static int
-tcindex_change(struct tcf_proto *tp, unsigned long base, u32 handle,
+tcindex_change(struct sk_buff *in_skb,
+              struct tcf_proto *tp, unsigned long base, u32 handle,
               struct nlattr **tca, unsigned long *arg)
 {
        struct nlattr *opt = tca[TCA_OPTIONS];
index d45373fb00b968f058459c654f7088551410778f..c7c27bc91b5af300e74fe8434f7fcedb30635df6 100644 (file)
@@ -544,7 +544,8 @@ errout:
        return err;
 }
 
-static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
+static int u32_change(struct sk_buff *in_skb,
+                     struct tcf_proto *tp, unsigned long base, u32 handle,
                      struct nlattr **tca,
                      unsigned long *arg)
 {
This page took 0.029515 seconds and 5 git commands to generate.