diff options
author | Patrick McHardy <kaber@trash.net> | 2007-07-24 18:29:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-07-24 18:29:55 -0400 |
commit | 7e2acc7e2711d51705373ac201333c9a0ebd3950 (patch) | |
tree | 06bd3d776970a2e09bfca5c67dad4490fd1ea7c0 /net | |
parent | ca983cefd950ec929582dd95ba6e46d12c2c6959 (diff) |
[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: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/netfilter/ebt_log.c | 6 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_ulog.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_LOG.c | 6 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_LOG.c | 6 |
4 files changed, 8 insertions, 18 deletions
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c index 031bfa4a51fc..984e9c64fb80 100644 --- a/net/bridge/netfilter/ebt_log.c +++ b/net/bridge/netfilter/ebt_log.c | |||
@@ -196,10 +196,8 @@ static int __init ebt_log_init(void) | |||
196 | ret = ebt_register_watcher(&log); | 196 | ret = ebt_register_watcher(&log); |
197 | if (ret < 0) | 197 | if (ret < 0) |
198 | return ret; | 198 | return ret; |
199 | ret = nf_log_register(PF_BRIDGE, &ebt_log_logger); | 199 | nf_log_register(PF_BRIDGE, &ebt_log_logger); |
200 | if (ret < 0 && ret != -EEXIST) | 200 | return 0; |
201 | ebt_unregister_watcher(&log); | ||
202 | return ret; | ||
203 | } | 201 | } |
204 | 202 | ||
205 | static void __exit ebt_log_fini(void) | 203 | static void __exit ebt_log_fini(void) |
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 9411db625917..6fec35225699 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -308,12 +308,8 @@ static int __init ebt_ulog_init(void) | |||
308 | else if ((ret = ebt_register_watcher(&ulog))) | 308 | else if ((ret = ebt_register_watcher(&ulog))) |
309 | sock_release(ebtulognl->sk_socket); | 309 | sock_release(ebtulognl->sk_socket); |
310 | 310 | ||
311 | if (nf_log_register(PF_BRIDGE, &ebt_ulog_logger) < 0) { | 311 | if (ret == 0) |
312 | printk(KERN_WARNING "ebt_ulog: not logging via ulog " | 312 | nf_log_register(PF_BRIDGE, &ebt_ulog_logger); |
313 | "since somebody else already registered for PF_BRIDGE\n"); | ||
314 | /* we cannot make module load fail here, since otherwise | ||
315 | * ebtables userspace would abort */ | ||
316 | } | ||
317 | 313 | ||
318 | return ret; | 314 | return ret; |
319 | } | 315 | } |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index 5937ad150b9f..127a5e89bf14 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -479,10 +479,8 @@ static int __init ipt_log_init(void) | |||
479 | ret = xt_register_target(&ipt_log_reg); | 479 | ret = xt_register_target(&ipt_log_reg); |
480 | if (ret < 0) | 480 | if (ret < 0) |
481 | return ret; | 481 | return ret; |
482 | ret = nf_log_register(PF_INET, &ipt_log_logger); | 482 | nf_log_register(PF_INET, &ipt_log_logger); |
483 | if (ret < 0 && ret != -EEXIST) | 483 | return 0; |
484 | xt_unregister_target(&ipt_log_reg); | ||
485 | return ret; | ||
486 | } | 484 | } |
487 | 485 | ||
488 | static void __exit ipt_log_fini(void) | 486 | static void __exit ipt_log_fini(void) |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index b05327ebd332..6ab99001dccc 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -493,10 +493,8 @@ static int __init ip6t_log_init(void) | |||
493 | ret = xt_register_target(&ip6t_log_reg); | 493 | ret = xt_register_target(&ip6t_log_reg); |
494 | if (ret < 0) | 494 | if (ret < 0) |
495 | return ret; | 495 | return ret; |
496 | ret = nf_log_register(PF_INET6, &ip6t_logger); | 496 | nf_log_register(PF_INET6, &ip6t_logger); |
497 | if (ret < 0 && ret != -EEXIST) | 497 | return 0; |
498 | xt_unregister_target(&ip6t_log_reg); | ||
499 | return ret; | ||
500 | } | 498 | } |
501 | 499 | ||
502 | static void __exit ip6t_log_fini(void) | 500 | static void __exit ip6t_log_fini(void) |