.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * net/sched/act_ipt.c iptables target interface |
---|
3 | 4 | * |
---|
4 | 5 | *TODO: Add other tables. For now we only support the ipv4 table targets |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License |
---|
8 | | - * as published by the Free Software Foundation; either version |
---|
9 | | - * 2 of the License, or (at your option) any later version. |
---|
10 | 6 | * |
---|
11 | 7 | * Copyright: Jamal Hadi Salim (2002-13) |
---|
12 | 8 | */ |
---|
.. | .. |
---|
98 | 94 | |
---|
99 | 95 | static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla, |
---|
100 | 96 | struct nlattr *est, struct tc_action **a, |
---|
101 | | - const struct tc_action_ops *ops, int ovr, int bind) |
---|
| 97 | + const struct tc_action_ops *ops, int ovr, int bind, |
---|
| 98 | + struct tcf_proto *tp, u32 flags) |
---|
102 | 99 | { |
---|
103 | 100 | struct tc_action_net *tn = net_generic(net, id); |
---|
104 | 101 | struct nlattr *tb[TCA_IPT_MAX + 1]; |
---|
.. | .. |
---|
113 | 110 | if (nla == NULL) |
---|
114 | 111 | return -EINVAL; |
---|
115 | 112 | |
---|
116 | | - err = nla_parse_nested(tb, TCA_IPT_MAX, nla, ipt_policy, NULL); |
---|
| 113 | + err = nla_parse_nested_deprecated(tb, TCA_IPT_MAX, nla, ipt_policy, |
---|
| 114 | + NULL); |
---|
117 | 115 | if (err < 0) |
---|
118 | 116 | return err; |
---|
119 | 117 | |
---|
.. | .. |
---|
146 | 144 | |
---|
147 | 145 | if (!exists) { |
---|
148 | 146 | ret = tcf_idr_create(tn, index, est, a, ops, bind, |
---|
149 | | - false); |
---|
| 147 | + false, flags); |
---|
150 | 148 | if (ret) { |
---|
151 | 149 | tcf_idr_cleanup(tn, index); |
---|
152 | 150 | return ret; |
---|
.. | .. |
---|
191 | 189 | ipt->tcfi_t = t; |
---|
192 | 190 | ipt->tcfi_hook = hook; |
---|
193 | 191 | spin_unlock_bh(&ipt->tcf_lock); |
---|
194 | | - if (ret == ACT_P_CREATED) |
---|
195 | | - tcf_idr_insert(tn, *a); |
---|
196 | 192 | return ret; |
---|
197 | 193 | |
---|
198 | 194 | err3: |
---|
.. | .. |
---|
206 | 202 | |
---|
207 | 203 | static int tcf_ipt_init(struct net *net, struct nlattr *nla, |
---|
208 | 204 | struct nlattr *est, struct tc_action **a, int ovr, |
---|
209 | | - int bind, bool rtnl_held, |
---|
210 | | - struct netlink_ext_ack *extack) |
---|
| 205 | + int bind, bool rtnl_held, struct tcf_proto *tp, |
---|
| 206 | + u32 flags, struct netlink_ext_ack *extack) |
---|
211 | 207 | { |
---|
212 | 208 | return __tcf_ipt_init(net, ipt_net_id, nla, est, a, &act_ipt_ops, ovr, |
---|
213 | | - bind); |
---|
| 209 | + bind, tp, flags); |
---|
214 | 210 | } |
---|
215 | 211 | |
---|
216 | 212 | static int tcf_xt_init(struct net *net, struct nlattr *nla, |
---|
217 | 213 | struct nlattr *est, struct tc_action **a, int ovr, |
---|
218 | | - int bind, bool unlocked, |
---|
219 | | - struct netlink_ext_ack *extack) |
---|
| 214 | + int bind, bool unlocked, struct tcf_proto *tp, |
---|
| 215 | + u32 flags, struct netlink_ext_ack *extack) |
---|
220 | 216 | { |
---|
221 | 217 | return __tcf_ipt_init(net, xt_net_id, nla, est, a, &act_xt_ops, ovr, |
---|
222 | | - bind); |
---|
| 218 | + bind, tp, flags); |
---|
223 | 219 | } |
---|
224 | 220 | |
---|
225 | 221 | static int tcf_ipt_act(struct sk_buff *skb, const struct tc_action *a, |
---|
.. | .. |
---|
329 | 325 | return tcf_generic_walker(tn, skb, cb, type, ops, extack); |
---|
330 | 326 | } |
---|
331 | 327 | |
---|
332 | | -static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index, |
---|
333 | | - struct netlink_ext_ack *extack) |
---|
| 328 | +static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index) |
---|
334 | 329 | { |
---|
335 | 330 | struct tc_action_net *tn = net_generic(net, ipt_net_id); |
---|
336 | 331 | |
---|
.. | .. |
---|
339 | 334 | |
---|
340 | 335 | static struct tc_action_ops act_ipt_ops = { |
---|
341 | 336 | .kind = "ipt", |
---|
342 | | - .type = TCA_ACT_IPT, |
---|
| 337 | + .id = TCA_ID_IPT, |
---|
343 | 338 | .owner = THIS_MODULE, |
---|
344 | 339 | .act = tcf_ipt_act, |
---|
345 | 340 | .dump = tcf_ipt_dump, |
---|
.. | .. |
---|
379 | 374 | return tcf_generic_walker(tn, skb, cb, type, ops, extack); |
---|
380 | 375 | } |
---|
381 | 376 | |
---|
382 | | -static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index, |
---|
383 | | - struct netlink_ext_ack *extack) |
---|
| 377 | +static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index) |
---|
384 | 378 | { |
---|
385 | 379 | struct tc_action_net *tn = net_generic(net, xt_net_id); |
---|
386 | 380 | |
---|
.. | .. |
---|
389 | 383 | |
---|
390 | 384 | static struct tc_action_ops act_xt_ops = { |
---|
391 | 385 | .kind = "xt", |
---|
392 | | - .type = TCA_ACT_XT, |
---|
| 386 | + .id = TCA_ID_XT, |
---|
393 | 387 | .owner = THIS_MODULE, |
---|
394 | 388 | .act = tcf_ipt_act, |
---|
395 | 389 | .dump = tcf_ipt_dump, |
---|