diff options
Diffstat (limited to 'net/sched/cls_bpf.c')
-rw-r--r-- | net/sched/cls_bpf.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 1002a8226281..8e3cf49118e3 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -46,11 +46,6 @@ static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { | |||
46 | .len = sizeof(struct sock_filter) * BPF_MAXINSNS }, | 46 | .len = sizeof(struct sock_filter) * BPF_MAXINSNS }, |
47 | }; | 47 | }; |
48 | 48 | ||
49 | static const struct tcf_ext_map bpf_ext_map = { | ||
50 | .action = TCA_BPF_ACT, | ||
51 | .police = TCA_BPF_POLICE, | ||
52 | }; | ||
53 | |||
54 | static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 49 | static int cls_bpf_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
55 | struct tcf_result *res) | 50 | struct tcf_result *res) |
56 | { | 51 | { |
@@ -174,7 +169,8 @@ static int cls_bpf_modify_existing(struct net *net, struct tcf_proto *tp, | |||
174 | if (!tb[TCA_BPF_OPS_LEN] || !tb[TCA_BPF_OPS] || !tb[TCA_BPF_CLASSID]) | 169 | if (!tb[TCA_BPF_OPS_LEN] || !tb[TCA_BPF_OPS] || !tb[TCA_BPF_CLASSID]) |
175 | return -EINVAL; | 170 | return -EINVAL; |
176 | 171 | ||
177 | ret = tcf_exts_validate(net, tp, tb, est, &exts, &bpf_ext_map); | 172 | tcf_exts_init(&exts, TCA_BPF_ACT, TCA_BPF_POLICE); |
173 | ret = tcf_exts_validate(net, tp, tb, est, &exts); | ||
178 | if (ret < 0) | 174 | if (ret < 0) |
179 | return ret; | 175 | return ret; |
180 | 176 | ||
@@ -271,6 +267,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, | |||
271 | if (prog == NULL) | 267 | if (prog == NULL) |
272 | return -ENOBUFS; | 268 | return -ENOBUFS; |
273 | 269 | ||
270 | tcf_exts_init(&prog->exts, TCA_BPF_ACT, TCA_BPF_POLICE); | ||
274 | if (handle == 0) | 271 | if (handle == 0) |
275 | prog->handle = cls_bpf_grab_new_handle(tp, head); | 272 | prog->handle = cls_bpf_grab_new_handle(tp, head); |
276 | else | 273 | else |
@@ -298,7 +295,7 @@ errout: | |||
298 | return ret; | 295 | return ret; |
299 | } | 296 | } |
300 | 297 | ||
301 | static int cls_bpf_dump(struct tcf_proto *tp, unsigned long fh, | 298 | static int cls_bpf_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, |
302 | struct sk_buff *skb, struct tcmsg *tm) | 299 | struct sk_buff *skb, struct tcmsg *tm) |
303 | { | 300 | { |
304 | struct cls_bpf_prog *prog = (struct cls_bpf_prog *) fh; | 301 | struct cls_bpf_prog *prog = (struct cls_bpf_prog *) fh; |
@@ -323,14 +320,14 @@ static int cls_bpf_dump(struct tcf_proto *tp, unsigned long fh, | |||
323 | if (nla == NULL) | 320 | if (nla == NULL) |
324 | goto nla_put_failure; | 321 | goto nla_put_failure; |
325 | 322 | ||
326 | memcpy(nla_data(nla), prog->bpf_ops, nla_len(nla)); | 323 | memcpy(nla_data(nla), prog->bpf_ops, nla_len(nla)); |
327 | 324 | ||
328 | if (tcf_exts_dump(skb, &prog->exts, &bpf_ext_map) < 0) | 325 | if (tcf_exts_dump(skb, &prog->exts) < 0) |
329 | goto nla_put_failure; | 326 | goto nla_put_failure; |
330 | 327 | ||
331 | nla_nest_end(skb, nest); | 328 | nla_nest_end(skb, nest); |
332 | 329 | ||
333 | if (tcf_exts_dump_stats(skb, &prog->exts, &bpf_ext_map) < 0) | 330 | if (tcf_exts_dump_stats(skb, &prog->exts) < 0) |
334 | goto nla_put_failure; | 331 | goto nla_put_failure; |
335 | 332 | ||
336 | return skb->len; | 333 | return skb->len; |