Skip to content

Commit 0dcffd0

Browse files
jhsmtdavem330
authored andcommitted
net_sched: act_ipt forward compat with xtables
Deal with changes in newer xtables while maintaining backward compatibility. Thanks to Jan Engelhardt for suggestions. Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fe86d71 commit 0dcffd0

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

net/sched/act_ipt.c

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* as published by the Free Software Foundation; either version
99
* 2 of the License, or (at your option) any later version.
1010
*
11-
* Copyright: Jamal Hadi Salim (2002-4)
11+
* Copyright: Jamal Hadi Salim (2002-13)
1212
*/
1313

1414
#include <linux/types.h>
@@ -303,17 +303,44 @@ static struct tc_action_ops act_ipt_ops = {
303303
.walk = tcf_generic_walker
304304
};
305305

306-
MODULE_AUTHOR("Jamal Hadi Salim(2002-4)");
306+
static struct tc_action_ops act_xt_ops = {
307+
.kind = "xt",
308+
.hinfo = &ipt_hash_info,
309+
.type = TCA_ACT_IPT,
310+
.capab = TCA_CAP_NONE,
311+
.owner = THIS_MODULE,
312+
.act = tcf_ipt,
313+
.dump = tcf_ipt_dump,
314+
.cleanup = tcf_ipt_cleanup,
315+
.lookup = tcf_hash_search,
316+
.init = tcf_ipt_init,
317+
.walk = tcf_generic_walker
318+
};
319+
320+
MODULE_AUTHOR("Jamal Hadi Salim(2002-13)");
307321
MODULE_DESCRIPTION("Iptables target actions");
308322
MODULE_LICENSE("GPL");
323+
MODULE_ALIAS("act_xt");
309324

310325
static int __init ipt_init_module(void)
311326
{
312-
return tcf_register_action(&act_ipt_ops);
327+
int ret1, ret2;
328+
ret1 = tcf_register_action(&act_xt_ops);
329+
if (ret1 < 0)
330+
printk("Failed to load xt action\n");
331+
ret2 = tcf_register_action(&act_ipt_ops);
332+
if (ret2 < 0)
333+
printk("Failed to load ipt action\n");
334+
335+
if (ret1 < 0 && ret2 < 0)
336+
return ret1;
337+
else
338+
return 0;
313339
}
314340

315341
static void __exit ipt_cleanup_module(void)
316342
{
343+
tcf_unregister_action(&act_xt_ops);
317344
tcf_unregister_action(&act_ipt_ops);
318345
}
319346

0 commit comments

Comments
 (0)