[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1195092581.27113.9.camel@localhost>
Date: Wed, 14 Nov 2007 18:09:41 -0800
From: Joe Perches <joe@...ches.com>
To: David Stevens <dlstevens@...ibm.com>
Cc: "Fred L. Templin" <fred.l.templin@...ing.com>,
David Miller <davem@...emloft.net>,
James Morris <jmorris@...ei.org>,
Patrick McHardy <kaber@...eworks.de>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
netdev <netdev@...r.kernel.org>, netdev-owner@...r.kernel.org,
"Pekka Savola (ipv6)" <pekkas@...core.fi>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>
Subject: Re: [PATCH net-2.6.25 1/4] include - Convert IP4 address class
macros to inline functions
Sorry, evolution died sending my mail and I didn't fully
read the "recovered" mail before hitting send.
Here's a more readable one.
---------
On Wed, 2007-11-14 at 08:53 -0800, David Stevens wrote:
> Maybe I'm more used to hex, but I personally don't think those are
> more readable. It replaces 1-line macroes with 4-line functions, and
> I think more vgrepping to pick out the relevant constant data.
The rfcs generally use decimal octets.
To me htonl(0xC0586300) isn't as readable as ip4_addr_octets(192,88,99,0)
is_ip4_multicast(addr) more intelligible than MULTICAST(x).
I hope to eliminate the current use of macros for ip address tests
and have no new macros added. The existing macros are just for
compatibility until the current code uses are converted.
Fred Templin has some patches that add several more macros
to in.h. I just forwarded my patches to him too.
http://marc.info/?l=linux-netdev&m=119490504022261&w=2
His patch adds:
+#define PRIVATE_10(x) (((x) & htonl(0xff000000)) == htonl(0x0A000000))
+#define LINKLOCAL_169(x) (((x) & htonl(0xffff0000)) == htonl(0xA9FE0000))
+#define PRIVATE_172(x) (((x) & htonl(0xfff00000)) == htonl(0xAC100000))
+#define TEST_192(x) (((x) & htonl(0xffffff00)) == htonl(0xC0000200))
+#define ANYCAST_6TO4(x) (((x) & htonl(0xffffff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x) & htonl(0xffff0000)) == htonl(0xC0A80000))
+#define TEST_198(x) (((x) & htonl(0xfffe0000)) == htonl(0xC6120000))
cheers, Joe
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists