Skip to content

Commit 3b5018d

Browse files
kaberDavid S. Miller
authored andcommitted
[NETFILTER]: {eb,ip6,ip}t_LOG: remove remains of LOG target overloading
All LOG targets always use their internal logging function nowadays, so remove the incorrect error message and handle real errors (!= -EEXIST) by failing to load. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fe6092e commit 3b5018d

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

net/bridge/netfilter/ebt_log.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,10 @@ static int __init ebt_log_init(void)
196196
ret = ebt_register_watcher(&log);
197197
if (ret < 0)
198198
return ret;
199-
if (nf_log_register(PF_BRIDGE, &ebt_log_logger) < 0) {
200-
printk(KERN_WARNING "ebt_log: not logging via system console "
201-
"since somebody else already registered for PF_INET\n");
202-
/* we cannot make module load fail here, since otherwise
203-
* ebtables userspace would abort */
204-
}
205-
206-
return 0;
199+
ret = nf_log_register(PF_BRIDGE, &ebt_log_logger);
200+
if (ret < 0 && ret != -EEXIST)
201+
ebt_unregister_watcher(&log);
202+
return ret;
207203
}
208204

209205
static void __exit ebt_log_fini(void)

net/ipv4/netfilter/ipt_LOG.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,10 @@ static int __init ipt_log_init(void)
477477
ret = xt_register_target(&ipt_log_reg);
478478
if (ret < 0)
479479
return ret;
480-
if (nf_log_register(PF_INET, &ipt_log_logger) < 0) {
481-
printk(KERN_WARNING "ipt_LOG: not logging via system console "
482-
"since somebody else already registered for PF_INET\n");
483-
/* we cannot make module load fail here, since otherwise
484-
* iptables userspace would abort */
485-
}
486-
487-
return 0;
480+
ret = nf_log_register(PF_INET, &ipt_log_logger);
481+
if (ret < 0 && ret != -EEXIST)
482+
xt_unregister_target(&ipt_log_reg);
483+
return ret;
488484
}
489485

490486
static void __exit ipt_log_fini(void)

net/ipv6/netfilter/ip6t_LOG.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,10 @@ static int __init ip6t_log_init(void)
490490
ret = xt_register_target(&ip6t_log_reg);
491491
if (ret < 0)
492492
return ret;
493-
if (nf_log_register(PF_INET6, &ip6t_logger) < 0) {
494-
printk(KERN_WARNING "ip6t_LOG: not logging via system console "
495-
"since somebody else already registered for PF_INET6\n");
496-
/* we cannot make module load fail here, since otherwise
497-
* ip6tables userspace would abort */
498-
}
499-
500-
return 0;
493+
ret = nf_log_register(PF_INET6, &ip6t_logger);
494+
if (ret < 0 && ret != -EEXIST)
495+
xt_unregister_target(&ip6t_log_reg);
496+
return ret;
501497
}
502498

503499
static void __exit ip6t_log_fini(void)

0 commit comments

Comments
 (0)