Re: [patch] repost of netfilter/NIPQUAD patches

From: David Ford (david@kalifornia.com)
Date: Fri Apr 14 2000 - 16:40:12 EST


Olaf Titz wrote:

> The quadrupled %u is ugly, conceptually unlogical[1], harder to write,
> more prone to errors in how many arguments the printk actually has
> (even if the compiler catches those), and most important, it is common
> code repeating over and over again. Library functions are there
> exactly to ease this.
> Why have strchr() when we can always write
> while (*p && *p!='x') p++;

and has a much heavier impact when called repeated in the fast path.

> PS. I hope this atrocity (net/ipv6/icmp.c)
>
> printk(KERN_DEBUG "ICMPv6 checksum failed [%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x > %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]\n",
> ntohs(saddr->in6_u.u6_addr16[0]),
> ntohs(saddr->in6_u.u6_addr16[1]),
> ntohs(saddr->in6_u.u6_addr16[2]),
> ntohs(saddr->in6_u.u6_addr16[3]),
> ntohs(saddr->in6_u.u6_addr16[4]),
> ntohs(saddr->in6_u.u6_addr16[5]),
> ntohs(saddr->in6_u.u6_addr16[6]),
> ntohs(saddr->in6_u.u6_addr16[7]),
> ntohs(daddr->in6_u.u6_addr16[0]),
> ntohs(daddr->in6_u.u6_addr16[1]),
> ntohs(daddr->in6_u.u6_addr16[2]),
> ntohs(daddr->in6_u.u6_addr16[3]),
> ntohs(daddr->in6_u.u6_addr16[4]),
> ntohs(daddr->in6_u.u6_addr16[5]),
> ntohs(daddr->in6_u.u6_addr16[6]),
> ntohs(daddr->in6_u.u6_addr16[7]));
>
> remains an isolated incident.

Unfortunately it is far from isolated. When I made the diff using the NIPQUAD macro, I came across numerous instances like this. It's very ugly and error
prone.

-d

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



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:25 EST