From: Joe Perches <joe@perches.com>
To: David Stevens <dlstevens@us.ibm.com>
Cc: "Fred L. Templin" <fred.l.templin@boeing.com>,
David Miller <davem@davemloft.net>,
James Morris <jmorris@namei.org>,
Patrick McHardy <kaber@coreworks.de>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
netdev <netdev@vger.kernel.org>,
netdev-owner@vger.kernel.org,
"Pekka Savola (ipv6)" <pekkas@netcore.fi>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Subject: Re: [PATCH net-2.6.25 1/4] include - Convert IP4 address class macros to inline functions
Date: Wed, 14 Nov 2007 18:09:41 -0800 [thread overview]
Message-ID: <1195092581.27113.9.camel@localhost> (raw)
In-Reply-To: <1195091645.27053.1.camel@localhost>
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
next prev parent reply other threads:[~2007-11-15 2:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-14 15:53 [PATCH net-2.6.25 1/4] include - Convert IP4 address class macros to inline functions Joe Perches
2007-11-14 16:53 ` David Stevens
2007-11-15 1:54 ` Joe Perches
2007-11-15 2:09 ` Joe Perches [this message]
2007-11-20 5:46 ` David Miller
2007-11-20 5:59 ` Joe Perches
2007-11-20 6:18 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2007-11-20 6:41 Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1195092581.27113.9.camel@localhost \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=dlstevens@us.ibm.com \
--cc=fred.l.templin@boeing.com \
--cc=jmorris@namei.org \
--cc=kaber@coreworks.de \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev-owner@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pekkas@netcore.fi \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).