diff options
Diffstat (limited to 'net/sched/act_connmark.c')
-rw-r--r-- | net/sched/act_connmark.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 35a5270f289d..eae07a2e774d 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #define CONNMARK_TAB_MASK 3 | 31 | #define CONNMARK_TAB_MASK 3 |
32 | 32 | ||
33 | static int connmark_net_id; | 33 | static int connmark_net_id; |
34 | static struct tc_action_ops act_connmark_ops; | ||
34 | 35 | ||
35 | static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a, | 36 | static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a, |
36 | struct tcf_result *res) | 37 | struct tcf_result *res) |
@@ -38,7 +39,7 @@ static int tcf_connmark(struct sk_buff *skb, const struct tc_action *a, | |||
38 | const struct nf_conntrack_tuple_hash *thash; | 39 | const struct nf_conntrack_tuple_hash *thash; |
39 | struct nf_conntrack_tuple tuple; | 40 | struct nf_conntrack_tuple tuple; |
40 | enum ip_conntrack_info ctinfo; | 41 | enum ip_conntrack_info ctinfo; |
41 | struct tcf_connmark_info *ca = a->priv; | 42 | struct tcf_connmark_info *ca = to_connmark(a); |
42 | struct nf_conntrack_zone zone; | 43 | struct nf_conntrack_zone zone; |
43 | struct nf_conn *c; | 44 | struct nf_conn *c; |
44 | int proto; | 45 | int proto; |
@@ -96,7 +97,7 @@ static const struct nla_policy connmark_policy[TCA_CONNMARK_MAX + 1] = { | |||
96 | }; | 97 | }; |
97 | 98 | ||
98 | static int tcf_connmark_init(struct net *net, struct nlattr *nla, | 99 | static int tcf_connmark_init(struct net *net, struct nlattr *nla, |
99 | struct nlattr *est, struct tc_action *a, | 100 | struct nlattr *est, struct tc_action **a, |
100 | int ovr, int bind) | 101 | int ovr, int bind) |
101 | { | 102 | { |
102 | struct tc_action_net *tn = net_generic(net, connmark_net_id); | 103 | struct tc_action_net *tn = net_generic(net, connmark_net_id); |
@@ -116,22 +117,22 @@ static int tcf_connmark_init(struct net *net, struct nlattr *nla, | |||
116 | 117 | ||
117 | if (!tcf_hash_check(tn, parm->index, a, bind)) { | 118 | if (!tcf_hash_check(tn, parm->index, a, bind)) { |
118 | ret = tcf_hash_create(tn, parm->index, est, a, | 119 | ret = tcf_hash_create(tn, parm->index, est, a, |
119 | sizeof(*ci), bind, false); | 120 | &act_connmark_ops, bind, false); |
120 | if (ret) | 121 | if (ret) |
121 | return ret; | 122 | return ret; |
122 | 123 | ||
123 | ci = to_connmark(a); | 124 | ci = to_connmark(*a); |
124 | ci->tcf_action = parm->action; | 125 | ci->tcf_action = parm->action; |
125 | ci->net = net; | 126 | ci->net = net; |
126 | ci->zone = parm->zone; | 127 | ci->zone = parm->zone; |
127 | 128 | ||
128 | tcf_hash_insert(tn, a); | 129 | tcf_hash_insert(tn, *a); |
129 | ret = ACT_P_CREATED; | 130 | ret = ACT_P_CREATED; |
130 | } else { | 131 | } else { |
131 | ci = to_connmark(a); | 132 | ci = to_connmark(*a); |
132 | if (bind) | 133 | if (bind) |
133 | return 0; | 134 | return 0; |
134 | tcf_hash_release(a, bind); | 135 | tcf_hash_release(*a, bind); |
135 | if (!ovr) | 136 | if (!ovr) |
136 | return -EEXIST; | 137 | return -EEXIST; |
137 | /* replacing action and zone */ | 138 | /* replacing action and zone */ |
@@ -146,7 +147,7 @@ static inline int tcf_connmark_dump(struct sk_buff *skb, struct tc_action *a, | |||
146 | int bind, int ref) | 147 | int bind, int ref) |
147 | { | 148 | { |
148 | unsigned char *b = skb_tail_pointer(skb); | 149 | unsigned char *b = skb_tail_pointer(skb); |
149 | struct tcf_connmark_info *ci = a->priv; | 150 | struct tcf_connmark_info *ci = to_connmark(a); |
150 | 151 | ||
151 | struct tc_connmark opt = { | 152 | struct tc_connmark opt = { |
152 | .index = ci->tcf_index, | 153 | .index = ci->tcf_index, |
@@ -173,14 +174,14 @@ nla_put_failure: | |||
173 | 174 | ||
174 | static int tcf_connmark_walker(struct net *net, struct sk_buff *skb, | 175 | static int tcf_connmark_walker(struct net *net, struct sk_buff *skb, |
175 | struct netlink_callback *cb, int type, | 176 | struct netlink_callback *cb, int type, |
176 | struct tc_action *a) | 177 | const struct tc_action_ops *ops) |
177 | { | 178 | { |
178 | struct tc_action_net *tn = net_generic(net, connmark_net_id); | 179 | struct tc_action_net *tn = net_generic(net, connmark_net_id); |
179 | 180 | ||
180 | return tcf_generic_walker(tn, skb, cb, type, a); | 181 | return tcf_generic_walker(tn, skb, cb, type, ops); |
181 | } | 182 | } |
182 | 183 | ||
183 | static int tcf_connmark_search(struct net *net, struct tc_action *a, u32 index) | 184 | static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index) |
184 | { | 185 | { |
185 | struct tc_action_net *tn = net_generic(net, connmark_net_id); | 186 | struct tc_action_net *tn = net_generic(net, connmark_net_id); |
186 | 187 | ||
@@ -196,6 +197,7 @@ static struct tc_action_ops act_connmark_ops = { | |||
196 | .init = tcf_connmark_init, | 197 | .init = tcf_connmark_init, |
197 | .walk = tcf_connmark_walker, | 198 | .walk = tcf_connmark_walker, |
198 | .lookup = tcf_connmark_search, | 199 | .lookup = tcf_connmark_search, |
200 | .size = sizeof(struct tcf_connmark_info), | ||
199 | }; | 201 | }; |
200 | 202 | ||
201 | static __net_init int connmark_init_net(struct net *net) | 203 | static __net_init int connmark_init_net(struct net *net) |