hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/sched/act_ipt.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * net/sched/act_ipt.c iptables target interface
34 *
45 *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.
106 *
117 * Copyright: Jamal Hadi Salim (2002-13)
128 */
....@@ -98,7 +94,8 @@
9894
9995 static int __tcf_ipt_init(struct net *net, unsigned int id, struct nlattr *nla,
10096 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)
10299 {
103100 struct tc_action_net *tn = net_generic(net, id);
104101 struct nlattr *tb[TCA_IPT_MAX + 1];
....@@ -113,7 +110,8 @@
113110 if (nla == NULL)
114111 return -EINVAL;
115112
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);
117115 if (err < 0)
118116 return err;
119117
....@@ -146,7 +144,7 @@
146144
147145 if (!exists) {
148146 ret = tcf_idr_create(tn, index, est, a, ops, bind,
149
- false);
147
+ false, flags);
150148 if (ret) {
151149 tcf_idr_cleanup(tn, index);
152150 return ret;
....@@ -191,8 +189,6 @@
191189 ipt->tcfi_t = t;
192190 ipt->tcfi_hook = hook;
193191 spin_unlock_bh(&ipt->tcf_lock);
194
- if (ret == ACT_P_CREATED)
195
- tcf_idr_insert(tn, *a);
196192 return ret;
197193
198194 err3:
....@@ -206,20 +202,20 @@
206202
207203 static int tcf_ipt_init(struct net *net, struct nlattr *nla,
208204 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)
211207 {
212208 return __tcf_ipt_init(net, ipt_net_id, nla, est, a, &act_ipt_ops, ovr,
213
- bind);
209
+ bind, tp, flags);
214210 }
215211
216212 static int tcf_xt_init(struct net *net, struct nlattr *nla,
217213 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)
220216 {
221217 return __tcf_ipt_init(net, xt_net_id, nla, est, a, &act_xt_ops, ovr,
222
- bind);
218
+ bind, tp, flags);
223219 }
224220
225221 static int tcf_ipt_act(struct sk_buff *skb, const struct tc_action *a,
....@@ -329,8 +325,7 @@
329325 return tcf_generic_walker(tn, skb, cb, type, ops, extack);
330326 }
331327
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)
334329 {
335330 struct tc_action_net *tn = net_generic(net, ipt_net_id);
336331
....@@ -339,7 +334,7 @@
339334
340335 static struct tc_action_ops act_ipt_ops = {
341336 .kind = "ipt",
342
- .type = TCA_ACT_IPT,
337
+ .id = TCA_ID_IPT,
343338 .owner = THIS_MODULE,
344339 .act = tcf_ipt_act,
345340 .dump = tcf_ipt_dump,
....@@ -379,8 +374,7 @@
379374 return tcf_generic_walker(tn, skb, cb, type, ops, extack);
380375 }
381376
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)
384378 {
385379 struct tc_action_net *tn = net_generic(net, xt_net_id);
386380
....@@ -389,7 +383,7 @@
389383
390384 static struct tc_action_ops act_xt_ops = {
391385 .kind = "xt",
392
- .type = TCA_ACT_XT,
386
+ .id = TCA_ID_XT,
393387 .owner = THIS_MODULE,
394388 .act = tcf_ipt_act,
395389 .dump = tcf_ipt_dump,