lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 08 Nov 2007 03:48:40 +0900 (JST)
From:	YOSHIFUJI Hideaki / 吉藤英明 
	<yoshfuji@...ux-ipv6.org>
To:	Fred.L.Templin@...ing.com
Cc:	netdev@...eo.de, netdev@...r.kernel.org, yoshfuji@...ux-ipv6.org
Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support

In article <39C363776A4E8C4A94691D2BD9D1C9A1029EDBF2@...-NW-7V2.nw.nos.boeing.com> (at Wed, 7 Nov 2007 10:24:50 -0800), "Templin, Fred L" <Fred.L.Templin@...ing.com> says:

>  
> 
> > -----Original Message-----
> > From: YOSHIFUJI Hideaki / 吉藤英明 [mailto:yoshfuji@...ux-ipv6.org] 
> > Sent: Wednesday, November 07, 2007 10:12 AM
> > To: netdev@...eo.de
> > Cc: Templin, Fred L; netdev@...r.kernel.org; yoshfuji@...ux-ipv6.org
> > Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
> > 
> > Hello.
> > 
> > In article <200711071658.59478.netdev@...eo.de> (at Wed, 7 
> > Nov 2007 16:58:59 +0100), Ingo Oeser <netdev@...eo.de> says:
> > 
> > > > +	eui[0] = 0;
> > > > +
> > > > +	/* Check for RFC3330 global address ranges */
> > > > +	if (((ipv4 >= 0x01000000) && (ipv4 < 0x0a000000)) ||
> > > > +	    ((ipv4 >= 0x0b000000) && (ipv4 < 0x7f000000)) ||
> > > > +	    ((ipv4 >= 0x80000000) && (ipv4 < 0xa9fe0000)) ||
> > > > +	    ((ipv4 >= 0xa9ff0000) && (ipv4 < 0xac100000)) ||
> > > > +	    ((ipv4 >= 0xac200000) && (ipv4 < 0xc0a80000)) ||
> > > > +	    ((ipv4 >= 0xc0a90000) && (ipv4 < 0xc6120000)) ||
> > > > +	    ((ipv4 >= 0xc6140000) && (ipv4 < 0xe0000000))) eui[0] |=
> > > > 0x2;
> > > > +
> > > 
> > > Instead of converting network to host byte order at runtime 
> > > and comparing the results to constants, let the compiler convert
> > > the constants to network byte order and compare in network order.
> > > 
> > > so use:
> > > 
> > >  if (((*addr >= htonl(0x01000000)) && (*addr < 
> > htonl(0x0a000000))) || ....
> > > 
> > > instead. The compiler will notice that "0x01000000" is a 
> > constant and will
> > > use "_constant_htonl()" automatically.
> > 
> > No, you cannot do this.
> > When you check the "range", you need to use host-byte order.
> 
> I think the original poster was correct on this one; the addr comes
> in in network byte order, and the constants are depicted in host
> byte order. So, the suggested fix was to have htonl(const) to make
> all of the constants into network byte order while leaving addr
> alone.

I don't understand.

For example, 1.0.0.11 is valid IPv4 global address.
In little-endian, this is not in the range of
0x00000001 <= addr <= 0x0000000a (addr is 0x0b000001).

--yoshfuji
-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ