Unified · Split
| @@ -2,8 +2,8 @@ · 1 unmodified line | |||
| 2 | #define __NET_ACT_API_H | 2 | #define __NET_ACT_API_H |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| 5 | * Public police action API for classifiers/qdiscs | 5 | * Public action API for classifiers/qdiscs |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <net/sch_generic.h> | 8 | #include <net/sch_generic.h> |
| 9 | #include <net/pkt_sched.h> | 9 | #include <net/pkt_sched.h> |
| @@ -107,7 +107,8 @@ struct tc_action_ops { · 97 unmodified lines | |||
| 107 | char kind[IFNAMSIZ]; | 107 | char kind[IFNAMSIZ]; |
| 108 | __u32 type; /* TBD to match kind */ | 108 | __u32 type; /* TBD to match kind */ |
| 109 | struct module *owner; | 109 | struct module *owner; |
| 110 | int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); | 110 | int (*act)(struct sk_buff *, const struct tc_action *, |
| 111 | struct tcf_result *); | ||
| 111 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); | 112 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
| 112 | void (*cleanup)(struct tc_action *, int bind); | 113 | void (*cleanup)(struct tc_action *, int bind); |
| 113 | int (*lookup)(struct net *, struct tc_action *, u32); | 114 | int (*lookup)(struct net *, struct tc_action *, u32); |
| @@ -125,8 +126,8 @@ struct tc_action_net { · 11 unmodified lines | |||
| 125 | }; | 126 | }; |
| 126 | 127 | ||
| 127 | static inline | 128 | static inline |
| 128 | int tc_action_net_init(struct tc_action_net *tn, const struct tc_action_ops *ops, | 129 | int tc_action_net_init(struct tc_action_net *tn, |
| 129 | unsigned int mask) | 130 | const struct tc_action_ops *ops, unsigned int mask) |
| 130 | { | 131 | { |
| 131 | int err = 0; | 132 | int err = 0; |
| 132 | 133 | ||
| @@ -169,7 +170,8 @@ static inline int tcf_hash_release(struct tc_action *a, bool bind) · 36 unmodified lines | |||
| 169 | } | 170 | } |
| 170 | 171 | ||
| 171 | int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops); | 172 | int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops); |
| 172 | int tcf_unregister_action(struct tc_action_ops *a, struct pernet_operations *ops); | 173 | int tcf_unregister_action(struct tc_action_ops *a, |
| 174 | struct pernet_operations *ops); | ||
| 173 | int tcf_action_destroy(struct list_head *actions, int bind); | 175 | int tcf_action_destroy(struct list_head *actions, int bind); |
| 174 | int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, | 176 | int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, |
| 175 | struct tcf_result *res); | 177 | struct tcf_result *res); |
| @@ -5,8 +5,8 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | struct tcf_defact { | 6 | struct tcf_defact { |
| 7 | struct tcf_common common; | 7 | struct tcf_common common; |
| 8 | u32 tcfd_datalen; | 8 | u32 tcfd_datalen; |
| 9 | void *tcfd_defdata; | 9 | void *tcfd_defdata; |
| 10 | }; | 10 | }; |
| 11 | #define to_defact(a) \ | 11 | #define to_defact(a) \ |
| 12 | container_of(a->priv, struct tcf_defact, common) | 12 | container_of(a->priv, struct tcf_defact, common) |
| @@ -115,8 +115,8 @@ struct tc_police { · 114 unmodified lines | |||
| 115 | __u32 mtu; | 115 | __u32 mtu; |
| 116 | struct tc_ratespec rate; | 116 | struct tc_ratespec rate; |
| 117 | struct tc_ratespec peakrate; | 117 | struct tc_ratespec peakrate; |
| 118 | int refcnt; | 118 | int refcnt; |
| 119 | int bindcnt; | 119 | int bindcnt; |
| 120 | __u32 capab; | 120 | __u32 capab; |
| 121 | }; | 121 | }; |
| 122 | 122 | ||
| @@ -128,7 +128,7 @@ struct tcf_t { · 5 unmodified lines | |||
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| 130 | struct tc_cnt { | 130 | struct tc_cnt { |
| 131 | int refcnt; | 131 | int refcnt; |
| 132 | int bindcnt; | 132 | int bindcnt; |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| @@ -504,8 +504,8 @@ nla_put_failure: · 503 unmodified lines | |||
| 504 | } | 504 | } |
| 505 | EXPORT_SYMBOL(tcf_action_dump_1); | 505 | EXPORT_SYMBOL(tcf_action_dump_1); |
| 506 | 506 | ||
| 507 | int | 507 | int tcf_action_dump(struct sk_buff *skb, struct list_head *actions, |
| 508 | tcf_action_dump(struct sk_buff *skb, struct list_head *actions, int bind, int ref) | 508 | int bind, int ref) |
| 509 | { | 509 | { |
| 510 | struct tc_action *a; | 510 | struct tc_action *a; |
| 511 | int err = -EINVAL; | 511 | int err = -EINVAL; |
| @@ -688,9 +688,9 @@ errout: · 176 unmodified lines | |||
| 688 | return -1; | 688 | return -1; |
| 689 | } | 689 | } |
| 690 | 690 | ||
| 691 | static int | 691 | static int tca_get_fill(struct sk_buff *skb, struct list_head *actions, |
| 692 | tca_get_fill(struct sk_buff *skb, struct list_head *actions, u32 portid, u32 seq, | 692 | u32 portid, u32 seq, u16 flags, int event, int bind, |
| 693 | u16 flags, int event, int bind, int ref) | 693 | int ref) |
| 694 | { | 694 | { |
| 695 | struct tcamsg *t; | 695 | struct tcamsg *t; |
| 696 | struct nlmsghdr *nlh; | 696 | struct nlmsghdr *nlh; |
| @@ -731,7 +731,8 @@ act_get_notify(struct net *net, u32 portid, struct nlmsghdr *n, · 34 unmodified lines | |||
| 731 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 731 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); |
| 732 | if (!skb) | 732 | if (!skb) |
| 733 | return -ENOBUFS; | 733 | return -ENOBUFS; |
| 734 | if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, event, 0, 0) <= 0) { | 734 | if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, event, |
| 735 | 0, 0) <= 0) { | ||
| 735 | kfree_skb(skb); | 736 | kfree_skb(skb); |
| 736 | return -EINVAL; | 737 | return -EINVAL; |
| 737 | } | 738 | } |
| @@ -839,7 +840,8 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, · 101 unmodified lines | |||
| 839 | if (a.ops == NULL) /*some idjot trying to flush unknown action */ | 840 | if (a.ops == NULL) /*some idjot trying to flush unknown action */ |
| 840 | goto err_out; | 841 | goto err_out; |
| 841 | 842 | ||
| 842 | nlh = nlmsg_put(skb, portid, n->nlmsg_seq, RTM_DELACTION, sizeof(*t), 0); | 843 | nlh = nlmsg_put(skb, portid, n->nlmsg_seq, RTM_DELACTION, |
| 844 | sizeof(*t), 0); | ||
| 843 | if (!nlh) | 845 | if (!nlh) |
| 844 | goto out_module_put; | 846 | goto out_module_put; |
| 845 | t = nlmsg_data(nlh); | 847 | t = nlmsg_data(nlh); |
| @@ -1002,7 +1004,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n) · 156 unmodified lines | |||
| 1002 | u32 portid = skb ? NETLINK_CB(skb).portid : 0; | 1004 | u32 portid = skb ? NETLINK_CB(skb).portid : 0; |
| 1003 | int ret = 0, ovr = 0; | 1005 | int ret = 0, ovr = 0; |
| 1004 | 1006 | ||
| 1005 | if ((n->nlmsg_type != RTM_GETACTION) && !netlink_capable(skb, CAP_NET_ADMIN)) | 1007 | if ((n->nlmsg_type != RTM_GETACTION) && |
| 1008 | !netlink_capable(skb, CAP_NET_ADMIN)) | ||
| 1006 | return -EPERM; | 1009 | return -EPERM; |
| 1007 | 1010 | ||
| 1008 | ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL); | 1011 | ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL); |
| @@ -169,7 +169,8 @@ nla_put_failure: · 168 unmodified lines | |||
| 169 | static const struct nla_policy act_bpf_policy[TCA_ACT_BPF_MAX + 1] = { | 169 | static const struct nla_policy act_bpf_policy[TCA_ACT_BPF_MAX + 1] = { |
| 170 | [TCA_ACT_BPF_PARMS] = { .len = sizeof(struct tc_act_bpf) }, | 170 | [TCA_ACT_BPF_PARMS] = { .len = sizeof(struct tc_act_bpf) }, |
| 171 | [TCA_ACT_BPF_FD] = { .type = NLA_U32 }, | 171 | [TCA_ACT_BPF_FD] = { .type = NLA_U32 }, |
| 172 | [TCA_ACT_BPF_NAME] = { .type = NLA_NUL_STRING, .len = ACT_BPF_NAME_LEN }, | 172 | [TCA_ACT_BPF_NAME] = { .type = NLA_NUL_STRING, |
| 173 | .len = ACT_BPF_NAME_LEN }, | ||
| 173 | [TCA_ACT_BPF_OPS_LEN] = { .type = NLA_U16 }, | 174 | [TCA_ACT_BPF_OPS_LEN] = { .type = NLA_U16 }, |
| 174 | [TCA_ACT_BPF_OPS] = { .type = NLA_BINARY, | 175 | [TCA_ACT_BPF_OPS] = { .type = NLA_BINARY, |
| 175 | .len = sizeof(struct sock_filter) * BPF_MAXINSNS }, | 176 | .len = sizeof(struct sock_filter) * BPF_MAXINSNS }, |
| @@ -162,7 +162,8 @@ static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u32 packets, · 161 unmodified lines | |||
| 162 | tm->lastuse = lastuse; | 162 | tm->lastuse = lastuse; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 165 | static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, |
| 166 | int bind, int ref) | ||
| 166 | { | 167 | { |
| 167 | unsigned char *b = skb_tail_pointer(skb); | 168 | unsigned char *b = skb_tail_pointer(skb); |
| 168 | struct tcf_gact *gact = a->priv; | 169 | struct tcf_gact *gact = a->priv; |
| @@ -34,7 +34,8 @@ static int ipt_net_id; · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | static int xt_net_id; | 35 | static int xt_net_id; |
| 36 | 36 | ||
| 37 | static int ipt_init_target(struct xt_entry_target *t, char *table, unsigned int hook) | 37 | static int ipt_init_target(struct xt_entry_target *t, char *table, |
| 38 | unsigned int hook) | ||
| 38 | { | 39 | { |
| 39 | struct xt_tgchk_param par; | 40 | struct xt_tgchk_param par; |
| 40 | struct xt_target *target; | 41 | struct xt_target *target; |
| @@ -250,7 +251,8 @@ static int tcf_ipt(struct sk_buff *skb, const struct tc_action *a, · 209 unmodified lines | |||
| 250 | 251 | ||
| 251 | } | 252 | } |
| 252 | 253 | ||
| 253 | static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 254 | static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, |
| 255 | int ref) | ||
| 254 | { | 256 | { |
| 255 | unsigned char *b = skb_tail_pointer(skb); | 257 | unsigned char *b = skb_tail_pointer(skb); |
| 256 | struct tcf_ipt *ipt = a->priv; | 258 | struct tcf_ipt *ipt = a->priv; |
| @@ -179,7 +179,8 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a, · 178 unmodified lines | |||
| 179 | 179 | ||
| 180 | if (v->tcfv_action == TCA_VLAN_ACT_PUSH && | 180 | if (v->tcfv_action == TCA_VLAN_ACT_PUSH && |
| 181 | (nla_put_u16(skb, TCA_VLAN_PUSH_VLAN_ID, v->tcfv_push_vid) || | 181 | (nla_put_u16(skb, TCA_VLAN_PUSH_VLAN_ID, v->tcfv_push_vid) || |
| 182 | nla_put_be16(skb, TCA_VLAN_PUSH_VLAN_PROTOCOL, v->tcfv_push_proto))) | 182 | nla_put_be16(skb, TCA_VLAN_PUSH_VLAN_PROTOCOL, |
| 183 | v->tcfv_push_proto))) | ||
| 183 | goto nla_put_failure; | 184 | goto nla_put_failure; |
| 184 | 185 | ||
| 185 | tcf_tm_dump(&t, &v->tcf_tm); | 186 | tcf_tm_dump(&t, &v->tcf_tm); |
| @@ -351,8 +351,9 @@ errout: · 350 unmodified lines | |||
| 351 | return err; | 351 | return err; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | static int tcf_fill_node(struct net *net, struct sk_buff *skb, struct tcf_proto *tp, | 354 | static int tcf_fill_node(struct net *net, struct sk_buff *skb, |
| 355 | unsigned long fh, u32 portid, u32 seq, u16 flags, int event) | 355 | struct tcf_proto *tp, unsigned long fh, u32 portid, |
| 356 | u32 seq, u16 flags, int event) | ||
| 356 | { | 357 | { |
| 357 | struct tcmsg *tcm; | 358 | struct tcmsg *tcm; |
| 358 | struct nlmsghdr *nlh; | 359 | struct nlmsghdr *nlh; |
| @@ -474,9 +475,11 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) · 115 unmodified lines | |||
| 474 | TC_H_MIN(tcm->tcm_info) != tp->protocol) | 475 | TC_H_MIN(tcm->tcm_info) != tp->protocol) |
| 475 | continue; | 476 | continue; |
| 476 | if (t > s_t) | 477 | if (t > s_t) |
| 477 | memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0])); | 478 | memset(&cb->args[1], 0, |
| 479 | sizeof(cb->args)-sizeof(cb->args[0])); | ||
| 478 | if (cb->args[1] == 0) { | 480 | if (cb->args[1] == 0) { |
| 479 | if (tcf_fill_node(net, skb, tp, 0, NETLINK_CB(cb->skb).portid, | 481 | if (tcf_fill_node(net, skb, tp, 0, |
| 482 | NETLINK_CB(cb->skb).portid, | ||
| 480 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 483 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
| 481 | RTM_NEWTFILTER) <= 0) | 484 | RTM_NEWTFILTER) <= 0) |
| 482 | break; | 485 | break; |