Commit 16af511a authored by Joe Perches's avatar Joe Perches Committed by Pablo Neira Ayuso

netfilter: log: Fix log-level processing

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 04d2c8c8
("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.

Use KERN_SOH and string concatenation instead of "%c" KERN_SOH_ASCII
as suggested by Eric Dumazet.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
cc: auto75914331@hushmail.com
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 4a70bbfa
...@@ -80,7 +80,7 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum, ...@@ -80,7 +80,7 @@ ebt_log_packet(u_int8_t pf, unsigned int hooknum,
unsigned int bitmask; unsigned int bitmask;
spin_lock_bh(&ebt_log_lock); 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, '0' + loginfo->u.log.level, prefix,
in ? in->name : "", out ? out->name : "", in ? in->name : "", out ? out->name : "",
eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
......
...@@ -443,8 +443,8 @@ log_packet_common(struct sbuff *m, ...@@ -443,8 +443,8 @@ log_packet_common(struct sbuff *m,
const struct nf_loginfo *loginfo, const struct nf_loginfo *loginfo,
const char *prefix) const char *prefix)
{ {
sb_add(m, "<%d>%sIN=%s OUT=%s ", loginfo->u.log.level, sb_add(m, KERN_SOH "%c%sIN=%s OUT=%s ",
prefix, '0' + loginfo->u.log.level, prefix,
in ? in->name : "", in ? in->name : "",
out ? out->name : ""); out ? out->name : "");
#ifdef CONFIG_BRIDGE_NETFILTER #ifdef CONFIG_BRIDGE_NETFILTER
......
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