lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1347437245.13103.697.camel@edumazet-glaptop>
Date:	Wed, 12 Sep 2012 10:07:25 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Joe Perches <joe@...ches.com>
Cc:	auto75914331@...hmail.com,
	Bart De Schuymer <bart.de.schuymer@...dora.be>,
	Pablo Neira Ayuso <pablo@...filter.org>,
	Patrick McHardy <kaber@...sh.net>,
	Stephen Hemminger <shemminger@...tta.com>,
	netfilter-devel@...r.kernel.org, netfilter@...r.kernel.org,
	coreteam@...filter.org, bridge@...ts.linux-foundation.org,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] netfilter/iptables: Fix log-level processing

On Wed, 2012-09-12 at 00:46 -0700, Joe Perches wrote:
> auto75914331@...hmail.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@...ches.com>
> cc: auto75914331@...hmail.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,


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ