From: Eric W Biederman <ebiederm@xxxxxxxxxxxx> Since pernet hooks, we need to register the hook for each netnamespace space. Signed-off-by: Eric W Biederman <ebiederm@xxxxxxxxxxxx> --- security/smack/smack_netfilter.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/security/smack/smack_netfilter.c b/security/smack/smack_netfilter.c index 0646fe5eda77..fcb3172adb75 100644 --- a/security/smack/smack_netfilter.c +++ b/security/smack/smack_netfilter.c @@ -73,6 +73,21 @@ static struct nf_hook_ops smack_nf_ops[] = { #endif /* IPV6 */ }; +static int smack_net_init(struct net *net) +{ + return nf_register_hooks(net, smack_nf_ops, ARRAY_SIZE(smack_nf_ops)); +} + +static void smack_net_exit(struct net *net) +{ + nf_unregister_hooks(net, smack_nf_ops, ARRAY_SIZE(smack_nf_ops)); +} + +static struct pernet_operations smack_net_ops = { + .init = smack_net_init, + .exit = smack_net_exit, +}; + static int __init smack_nf_ip_init(void) { int err; @@ -82,8 +97,7 @@ static int __init smack_nf_ip_init(void) printk(KERN_DEBUG "Smack: Registering netfilter hooks\n"); - err = nf_register_hooks(&init_net, smack_nf_ops, - ARRAY_SIZE(smack_nf_ops)); + err = register_pernet_subsys(&smack_net_ops); if (err) pr_info("Smack: nf_register_hooks: error %d\n", err); -- 2.2.1 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html