Commit 7e2acc7e authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: Fix logging regression

Loading one of the LOG target fails if a different target has already
registered itself as backend for the same family. This can affect the
ipt_LOG and ipt_ULOG modules when both are loaded.

Reported and tested by: <t.artem@mailcity.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ca983cef
...@@ -196,10 +196,8 @@ static int __init ebt_log_init(void) ...@@ -196,10 +196,8 @@ static int __init ebt_log_init(void)
ret = ebt_register_watcher(&log); ret = ebt_register_watcher(&log);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = nf_log_register(PF_BRIDGE, &ebt_log_logger); nf_log_register(PF_BRIDGE, &ebt_log_logger);
if (ret < 0 && ret != -EEXIST) return 0;
ebt_unregister_watcher(&log);
return ret;
} }
static void __exit ebt_log_fini(void) static void __exit ebt_log_fini(void)
......
...@@ -308,12 +308,8 @@ static int __init ebt_ulog_init(void) ...@@ -308,12 +308,8 @@ static int __init ebt_ulog_init(void)
else if ((ret = ebt_register_watcher(&ulog))) else if ((ret = ebt_register_watcher(&ulog)))
sock_release(ebtulognl->sk_socket); sock_release(ebtulognl->sk_socket);
if (nf_log_register(PF_BRIDGE, &ebt_ulog_logger) < 0) { if (ret == 0)
printk(KERN_WARNING "ebt_ulog: not logging via ulog " nf_log_register(PF_BRIDGE, &ebt_ulog_logger);
"since somebody else already registered for PF_BRIDGE\n");
/* we cannot make module load fail here, since otherwise
* ebtables userspace would abort */
}
return ret; return ret;
} }
......
...@@ -479,10 +479,8 @@ static int __init ipt_log_init(void) ...@@ -479,10 +479,8 @@ static int __init ipt_log_init(void)
ret = xt_register_target(&ipt_log_reg); ret = xt_register_target(&ipt_log_reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = nf_log_register(PF_INET, &ipt_log_logger); nf_log_register(PF_INET, &ipt_log_logger);
if (ret < 0 && ret != -EEXIST) return 0;
xt_unregister_target(&ipt_log_reg);
return ret;
} }
static void __exit ipt_log_fini(void) static void __exit ipt_log_fini(void)
......
...@@ -493,10 +493,8 @@ static int __init ip6t_log_init(void) ...@@ -493,10 +493,8 @@ static int __init ip6t_log_init(void)
ret = xt_register_target(&ip6t_log_reg); ret = xt_register_target(&ip6t_log_reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = nf_log_register(PF_INET6, &ip6t_logger); nf_log_register(PF_INET6, &ip6t_logger);
if (ret < 0 && ret != -EEXIST) return 0;
xt_unregister_target(&ip6t_log_reg);
return ret;
} }
static void __exit ip6t_log_fini(void) static void __exit ip6t_log_fini(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment