* Iptables log-level does not work with kernel 3.6-rc
@ 2012-09-12 4:51 auto75914331
2012-09-12 7:46 ` [PATCH] netfilter/iptables: Fix log-level processing Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: auto75914331 @ 2012-09-12 4:51 UTC (permalink / raw)
To: linux-kernel
This rule
$IPTABLES -A RULE_0_in -j LOG --log-level notice --log-prefix "DENY in: "
result with linux 3.6-rc5
Sep 12 06:37:29 xxxxx kernel: <5>DENY in: IN=eth0 OUT= MAC=.......
result with linux 3.5.3 and older:
Sep 9 10:43:01 xxxxx kernel: DENY in: IN=eth0 OUT= MAC......
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] netfilter/iptables: Fix log-level processing
2012-09-12 4:51 Iptables log-level does not work with kernel 3.6-rc auto75914331
@ 2012-09-12 7:46 ` Joe Perches
2012-09-12 8:07 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2012-09-12 7:46 UTC (permalink / raw)
To: auto75914331, Bart De Schuymer, Pablo Neira Ayuso,
Patrick McHardy, Stephen Hemminger
Cc: netfilter-devel, netfilter, coreteam, bridge, netdev, linux-kernel
auto75914331@hushmail.com reports that iptables does not correctly
output the KERN_<level>.
$IPTABLES -A RULE_0_in -j LOG --log-level notice --log-prefix "DENY in: "
result with linux 3.6-rc5
Sep 12 06:37:29 xxxxx kernel: <5>DENY in: IN=eth0 OUT= MAC=.......
result with linux 3.5.3 and older:
Sep 9 10:43:01 xxxxx kernel: DENY in: IN=eth0 OUT= MAC......
commit 04d2c8c83d0
("printk: convert the format for KERN_<LEVEL> to a 2 byte pattern")
updated the syslog header style but did not update netfilter uses.
Do so.
Signed-off-by: Joe Perches <joe@perches.com>
cc: auto75914331@hushmail.com
---
net/bridge/netfilter/ebt_log.c | 4 ++--
net/netfilter/xt_LOG.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
index f88ee53..cb46d2f 100644
--- a/net/bridge/netfilter/ebt_log.c
+++ b/net/bridge/netfilter/ebt_log.c
@@ -80,8 +80,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
unsigned int bitmask;
spin_lock_bh(&ebt_log_lock);
- printk("<%c>%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
- '0' + loginfo->u.log.level, prefix,
+ printk("%c%c%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
+ KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
in ? in->name : "", out ? out->name : "",
eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
ntohs(eth_hdr(skb)->h_proto));
diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c
index ff5f75f..bdc5352 100644
--- a/net/netfilter/xt_LOG.c
+++ b/net/netfilter/xt_LOG.c
@@ -436,8 +436,8 @@ log_packet_common(struct sbuff *m,
const struct nf_loginfo *loginfo,
const char *prefix)
{
- sb_add(m, "<%d>%sIN=%s OUT=%s ", loginfo->u.log.level,
- prefix,
+ sb_add(m, "%c%c%sIN=%s OUT=%s ",
+ KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
in ? in->name : "",
out ? out->name : "");
#ifdef CONFIG_BRIDGE_NETFILTER
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter/iptables: Fix log-level processing
2012-09-12 7:46 ` [PATCH] netfilter/iptables: Fix log-level processing Joe Perches
@ 2012-09-12 8:07 ` Eric Dumazet
2012-09-12 12:04 ` [PATCH V2] " Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2012-09-12 8:07 UTC (permalink / raw)
To: Joe Perches
Cc: auto75914331, Bart De Schuymer, Pablo Neira Ayuso,
Patrick McHardy, Stephen Hemminger, netfilter-devel, netfilter,
coreteam, bridge, netdev, linux-kernel
On Wed, 2012-09-12 at 00:46 -0700, Joe Perches wrote:
> auto75914331@hushmail.com reports that iptables does not correctly
> output the KERN_<level>.
>
> $IPTABLES -A RULE_0_in -j LOG --log-level notice --log-prefix "DENY in: "
>
> result with linux 3.6-rc5
> Sep 12 06:37:29 xxxxx kernel: <5>DENY in: IN=eth0 OUT= MAC=.......
>
> result with linux 3.5.3 and older:
> Sep 9 10:43:01 xxxxx kernel: DENY in: IN=eth0 OUT= MAC......
>
> commit 04d2c8c83d0
> ("printk: convert the format for KERN_<LEVEL> to a 2 byte pattern")
> updated the syslog header style but did not update netfilter uses.
>
> Do so.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> cc: auto75914331@hushmail.com
> ---
> net/bridge/netfilter/ebt_log.c | 4 ++--
> net/netfilter/xt_LOG.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
> index f88ee53..cb46d2f 100644
> --- a/net/bridge/netfilter/ebt_log.c
> +++ b/net/bridge/netfilter/ebt_log.c
> @@ -80,8 +80,8 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
> unsigned int bitmask;
>
> spin_lock_bh(&ebt_log_lock);
> - printk("<%c>%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
> - '0' + loginfo->u.log.level, prefix,
> + printk("%c%c%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
> + KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
> in ? in->name : "", out ? out->name : "",
> eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
> ntohs(eth_hdr(skb)->h_proto));
> diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c
> index ff5f75f..bdc5352 100644
> --- a/net/netfilter/xt_LOG.c
> +++ b/net/netfilter/xt_LOG.c
> @@ -436,8 +436,8 @@ log_packet_common(struct sbuff *m,
> const struct nf_loginfo *loginfo,
> const char *prefix)
> {
> - sb_add(m, "<%d>%sIN=%s OUT=%s ", loginfo->u.log.level,
> - prefix,
> + sb_add(m, "%c%c%sIN=%s OUT=%s ",
> + KERN_SOH_ASCII, '0' + loginfo->u.log.level, prefix,
> in ? in->name : "",
> out ? out->name : "");
> #ifdef CONFIG_BRIDGE_NETFILTER
>
would be better to avoid the %c
->
sb_add(m, KERN_SOH "%c%sIN=%s OUT=%s ",
'0' + loginfo->u.log.level, prefix,
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH V2] netfilter/iptables: Fix log-level processing
2012-09-12 8:07 ` Eric Dumazet
@ 2012-09-12 12:04 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2012-09-12 12:04 UTC (permalink / raw)
To: Eric Dumazet
Cc: auto75914331, Bart De Schuymer, Pablo Neira Ayuso,
Patrick McHardy, Stephen Hemminger, netfilter-devel, netfilter,
coreteam, bridge, netdev, linux-kernel
auto75914331@hushmail.com reports that iptables does not correctly
output the KERN_<level>.
$IPTABLES -A RULE_0_in -j LOG --log-level notice --log-prefix "DENY in: "
result with linux 3.6-rc5
Sep 12 06:37:29 xxxxx kernel: <5>DENY in: IN=eth0 OUT= MAC=.......
result with linux 3.5.3 and older:
Sep 9 10:43:01 xxxxx kernel: DENY in: IN=eth0 OUT= MAC......
commit 04d2c8c83d0
("printk: convert the format for KERN_<LEVEL> to a 2 byte pattern")
updated the syslog header style but did not update netfilter uses.
Do so.
Signed-off-by: Joe Perches <joe@perches.com>
cc: auto75914331@hushmail.com
---
v2: Use KERN_SOH and string concatenation instead of "%c" KERN_SOH_ASCII
as suggested by Eric Dumazet.
net/bridge/netfilter/ebt_log.c | 2 +-
net/netfilter/xt_LOG.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
index f88ee53..92de5e5 100644
--- a/net/bridge/netfilter/ebt_log.c
+++ b/net/bridge/netfilter/ebt_log.c
@@ -80,7 +80,7 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
unsigned int bitmask;
spin_lock_bh(&ebt_log_lock);
- printk("<%c>%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
+ printk(KERN_SOH "%c%s IN=%s OUT=%s MAC source = %pM MAC dest = %pM proto = 0x%04x",
'0' + loginfo->u.log.level, prefix,
in ? in->name : "", out ? out->name : "",
eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c
index ff5f75f..d1609dd 100644
--- a/net/netfilter/xt_LOG.c
+++ b/net/netfilter/xt_LOG.c
@@ -436,8 +436,8 @@ log_packet_common(struct sbuff *m,
const struct nf_loginfo *loginfo,
const char *prefix)
{
- sb_add(m, "<%d>%sIN=%s OUT=%s ", loginfo->u.log.level,
- prefix,
+ sb_add(m, KERN_SOH "%c%sIN=%s OUT=%s ",
+ '0' + loginfo->u.log.level, prefix,
in ? in->name : "",
out ? out->name : "");
#ifdef CONFIG_BRIDGE_NETFILTER
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-12 12:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-12 4:51 Iptables log-level does not work with kernel 3.6-rc auto75914331
2012-09-12 7:46 ` [PATCH] netfilter/iptables: Fix log-level processing Joe Perches
2012-09-12 8:07 ` Eric Dumazet
2012-09-12 12:04 ` [PATCH V2] " Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).