diff options
Diffstat (limited to 'net/ipv4/netfilter/iptable_mangle.c')
-rw-r--r-- | net/ipv4/netfilter/iptable_mangle.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c index b9b83464cbf4..6bdddc8f8862 100644 --- a/net/ipv4/netfilter/iptable_mangle.c +++ b/net/ipv4/netfilter/iptable_mangle.c @@ -32,7 +32,6 @@ static const struct xt_table packet_mangler = { .valid_hooks = MANGLE_VALID_HOOKS, .me = THIS_MODULE, .af = NFPROTO_IPV4, - .priority = NF_IP_PRI_MANGLE, }; static unsigned int @@ -91,7 +90,43 @@ iptable_mangle_hook(unsigned int hook, dev_net(in)->ipv4.iptable_mangle); } -static struct nf_hook_ops *mangle_ops __read_mostly; +static struct nf_hook_ops ipt_ops[] __read_mostly = { + { + .hook = iptable_mangle_hook, + .owner = THIS_MODULE, + .pf = NFPROTO_IPV4, + .hooknum = NF_INET_PRE_ROUTING, + .priority = NF_IP_PRI_MANGLE, + }, + { + .hook = iptable_mangle_hook, + .owner = THIS_MODULE, + .pf = NFPROTO_IPV4, + .hooknum = NF_INET_LOCAL_IN, + .priority = NF_IP_PRI_MANGLE, + }, + { + .hook = iptable_mangle_hook, + .owner = THIS_MODULE, + .pf = NFPROTO_IPV4, + .hooknum = NF_INET_FORWARD, + .priority = NF_IP_PRI_MANGLE, + }, + { + .hook = iptable_mangle_hook, + .owner = THIS_MODULE, + .pf = NFPROTO_IPV4, + .hooknum = NF_INET_LOCAL_OUT, + .priority = NF_IP_PRI_MANGLE, + }, + { + .hook = iptable_mangle_hook, + .owner = THIS_MODULE, + .pf = NFPROTO_IPV4, + .hooknum = NF_INET_POST_ROUTING, + .priority = NF_IP_PRI_MANGLE, + }, +}; static int __net_init iptable_mangle_net_init(struct net *net) { @@ -127,11 +162,9 @@ static int __init iptable_mangle_init(void) return ret; /* Register hooks */ - mangle_ops = xt_hook_link(&packet_mangler, iptable_mangle_hook); - if (IS_ERR(mangle_ops)) { - ret = PTR_ERR(mangle_ops); + ret = nf_register_hooks(ipt_ops, ARRAY_SIZE(ipt_ops)); + if (ret < 0) goto cleanup_table; - } return ret; @@ -142,7 +175,7 @@ static int __init iptable_mangle_init(void) static void __exit iptable_mangle_fini(void) { - xt_hook_unlink(&packet_mangler, mangle_ops); + nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops)); unregister_pernet_subsys(&iptable_mangle_net_ops); } |