netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Stevens <dlstevens@us.ibm.com>,
	"Fred L. Templin" <fred.l.templin@boeing.com>
Cc: 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 17:54:05 -0800	[thread overview]
Message-ID: <1195091645.27053.1.camel@localhost> (raw)
In-Reply-To: <OF456A1240.FCBC428E-ON88257393.005C5D94-88257393.005CA64F@us.ibm.com>

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)

Fred Templin has some patches that add several more macros
to in.h.  I just forwarded my patches to him too.

is_ip4_multicast seems a lot more readable to me than MULTICAST(x)
I prefer to eliminate the current use of macros for ip address tests
and also get no new macros added.  The old macros are just for
compatibility until the exis

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


  reply	other threads:[~2007-11-15  1:56 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 [this message]
2007-11-15  2:09     ` Joe Perches
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=1195091645.27053.1.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).