Subject: Re: Re: [PATCH] ebtables: Port ebt_[u]log.c to nf[netlink]_log

From: Ingo Oeser <[email-masked]>
Date: Mon, 14 Nov 2005 13:09:37 +0100

Hi Harald,

would you mind merging the prink()s ...

Harald Welte wrote:
> diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
> --- a/net/bridge/netfilter/ebt_log.c
> +++ b/net/bridge/netfilter/ebt_log.c
> @@ -55,17 +57,19 @@ static void print_MAC(unsigned char *p)
>  }
>  
>  #define myNIPQUAD(a) a[0], a[1], a[2], a[3]
> -static void ebt_log(const struct sk_buff *skb, unsigned int hooknr,
> -   const struct net_device *in, const struct net_device *out,
> -   const void *data, unsigned int datalen)
> +static void
> +ebt_log_packet(unsigned int pf, unsigned int hooknum,
> +   const struct sk_buff *skb, const struct net_device *in,
> +   const struct net_device *out, const struct nf_loginfo *loginfo,
> +   const char *prefix)
>  {
> -	struct ebt_log_info *info = (struct ebt_log_info *)data;
>  	char level_string[4] = "< >";
> +	unsigned int bitmask;
>  
> -	level_string[1] = '0' + info->loglevel;
> +	level_string[1] = '0' + loginfo->u.log.level;
>  	spin_lock_bh(&ebt_log_lock);
>  	printk(level_string);
> -	printk("%s IN=%s OUT=%s ", info->prefix, in ? in->name : "",
> +	printk("%s IN=%s OUT=%s ", prefix, in ? in->name : "",
>  	   out ? out->name : "");
>  
>  	printk("MAC source = ");

... here ...

> @@ -75,7 +79,12 @@ static void ebt_log(const struct sk_buff
>  
>  	printk("proto = 0x%04x", ntohs(eth_hdr(skb)->h_proto));
>  

... and here?

> -	if ((info->bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto ==
> +	if (loginfo->type == NF_LOG_TYPE_LOG)
> +		bitmask = loginfo->u.log.logflags;
> +	else
> +		bitmask = NF_LOG_MASK;
> +
> +	if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto ==
>  	   htons(ETH_P_IP)){
>  		struct iphdr _iph, *ih;
>  

I prefer evil printk()s over multiple ones :-)

Regards

Ingo Oeser

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click