Skip to content

Commit

Permalink
net sched: Pass the skb into change so it can access NETLINK_CB
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: David S. Miller <[email protected]>
Acked-by: Serge Hallyn <[email protected]>
Signed-off-by: Eric W. Biederman <[email protected]>
  • Loading branch information
ebiederm committed Aug 15, 2012
1 parent 9eea951 commit af4c664
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
}
}

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);
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ static int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
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;
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
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)
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base,
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)
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_rsvp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_tcindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle,
}

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];
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_u32.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ static int u32_set_parms(struct tcf_proto *tp, unsigned long base,
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)
{
Expand Down

0 comments on commit af4c664

Please sign in to comment.