netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 02/05] ipv6: RFC4214 Support
@ 2007-11-07  1:16 Templin, Fred L
  2007-11-07 15:58 ` Ingo Oeser
  0 siblings, 1 reply; 12+ messages in thread
From: Templin, Fred L @ 2007-11-07  1:16 UTC (permalink / raw)
  To: netdev

From: Fred L. Templin <fred.l.templin@boeing.com>

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
"ip" utility with device names beginning with: "isatap".

The following diffs are specific to the Linux 2.6.23
kernel distribution.

Signed-off-by: Fred L. Templin <fred.l.templin@boeing.com>

---

--- linux-2.6.23/include/net/addrconf.h.orig	2007-10-09
13:31:38.000000000 -0700
+++ linux-2.6.23/include/net/addrconf.h	2007-10-26 10:49:40.000000000
-0700
@@ -241,6 +241,34 @@ static inline int ipv6_addr_is_ll_all_ro
 		addr->s6_addr32[3] == htonl(0x00000002));
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+static inline int ipv6_isatap_eui64(u8 *eui, __be32 *addr)
+{
+	__be32 ipv4 = ntohl(*addr);
+
+	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;
+
+	eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+	memcpy (eui+4, addr, 4);
+	return (0);
+}
+
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+	return (addr->s6_addr32[2] == __constant_htonl(0x02005EFE) ||
+		addr->s6_addr32[2] == __constant_htonl(0x00005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07  1:16 [PATCH 02/05] ipv6: RFC4214 Support Templin, Fred L
@ 2007-11-07 15:58 ` Ingo Oeser
  2007-11-07 16:12   ` Templin, Fred L
  2007-11-07 18:12   ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 2 replies; 12+ messages in thread
From: Ingo Oeser @ 2007-11-07 15:58 UTC (permalink / raw)
  To: Templin, Fred L; +Cc: netdev

Hi Fred,

some comments.

Templin, Fred L schrieb:
> From: Fred L. Templin <fred.l.templin@boeing.com>
> 
> This is experimental support for the Intra-Site Automatic
> Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
> the SIT module, and is configured using the unmodified
> "ip" utility with device names beginning with: "isatap".
> 
> The following diffs are specific to the Linux 2.6.23
> kernel distribution.
> 
> Signed-off-by: Fred L. Templin <fred.l.templin@boeing.com>
> 
> ---
> 
> --- linux-2.6.23/include/net/addrconf.h.orig	2007-10-09
> 13:31:38.000000000 -0700
> +++ linux-2.6.23/include/net/addrconf.h	2007-10-26 10:49:40.000000000
> -0700
> @@ -241,6 +241,34 @@ static inline int ipv6_addr_is_ll_all_ro
>  		addr->s6_addr32[3] == htonl(0x00000002));
>  }
>  
> +#if defined(CONFIG_IPV6_ISATAP)
> +static inline int ipv6_isatap_eui64(u8 *eui, __be32 *addr)
"addr" is only used for reading, not writing. No need to pass it as a pointer.

> +{
> +	__be32 ipv4 = ntohl(*addr);

ntohl(be32_value) != be32_value, so the _be32 attribution of ipv4 
is wrong here and sparse will scream.

> +
> +	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.


> +	eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
> +	memcpy (eui+4, addr, 4);
> +	return (0);
> +}

Nitpick: 
	"return" is not a function. Please write "return 0;" instead.

> +
> +static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
> +{
> +       return (addr->s6_addr32[2] == __constant_htonl(0x02005EFE) ||
> +               addr->s6_addr32[2] == __constant_htonl(0x00005EFE));
> +}
> +#endif

The compiler will notice that "0x01000000" is a constant and will
use "_constant_htonl()" automatically. Please use simply htonl().


Best Regards

Ingo Oeser

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 15:58 ` Ingo Oeser
@ 2007-11-07 16:12   ` Templin, Fred L
  2007-11-07 18:12   ` YOSHIFUJI Hideaki / 吉藤英明
  1 sibling, 0 replies; 12+ messages in thread
From: Templin, Fred L @ 2007-11-07 16:12 UTC (permalink / raw)
  To: Ingo Oeser; +Cc: netdev

Thanks for these, Ingo. Will fix and test immediately.

Fred
fred.l.templin@boeing.com 

> -----Original Message-----
> From: Ingo Oeser [mailto:netdev@axxeo.de] 
> Sent: Wednesday, November 07, 2007 7:59 AM
> To: Templin, Fred L
> Cc: netdev@vger.kernel.org
> Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
> 
> Hi Fred,
> 
> some comments.
> 
> Templin, Fred L schrieb:
> > From: Fred L. Templin <fred.l.templin@boeing.com>
> > 
> > This is experimental support for the Intra-Site Automatic
> > Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
> > the SIT module, and is configured using the unmodified
> > "ip" utility with device names beginning with: "isatap".
> > 
> > The following diffs are specific to the Linux 2.6.23
> > kernel distribution.
> > 
> > Signed-off-by: Fred L. Templin <fred.l.templin@boeing.com>
> > 
> > ---
> > 
> > --- linux-2.6.23/include/net/addrconf.h.orig	2007-10-09
> > 13:31:38.000000000 -0700
> > +++ linux-2.6.23/include/net/addrconf.h	2007-10-26 
> 10:49:40.000000000
> > -0700
> > @@ -241,6 +241,34 @@ static inline int ipv6_addr_is_ll_all_ro
> >  		addr->s6_addr32[3] == htonl(0x00000002));
> >  }
> >  
> > +#if defined(CONFIG_IPV6_ISATAP)
> > +static inline int ipv6_isatap_eui64(u8 *eui, __be32 *addr)
> "addr" is only used for reading, not writing. No need to pass 
> it as a pointer.
> 
> > +{
> > +	__be32 ipv4 = ntohl(*addr);
> 
> ntohl(be32_value) != be32_value, so the _be32 attribution of ipv4 
> is wrong here and sparse will scream.
> 
> > +
> > +	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.
> 
> 
> > +	eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
> > +	memcpy (eui+4, addr, 4);
> > +	return (0);
> > +}
> 
> Nitpick: 
> 	"return" is not a function. Please write "return 0;" instead.
> 
> > +
> > +static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
> > +{
> > +       return (addr->s6_addr32[2] == 
> __constant_htonl(0x02005EFE) ||
> > +               addr->s6_addr32[2] == __constant_htonl(0x00005EFE));
> > +}
> > +#endif
> 
> The compiler will notice that "0x01000000" is a constant and will
> use "_constant_htonl()" automatically. Please use simply htonl().
> 
> 
> Best Regards
> 
> Ingo Oeser
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 15:58 ` Ingo Oeser
  2007-11-07 16:12   ` Templin, Fred L
@ 2007-11-07 18:12   ` YOSHIFUJI Hideaki / 吉藤英明
  2007-11-07 18:24     ` Templin, Fred L
  1 sibling, 1 reply; 12+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-11-07 18:12 UTC (permalink / raw)
  To: netdev; +Cc: Fred.L.Templin, netdev, yoshfuji

Hello.

In article <200711071658.59478.netdev@axxeo.de> (at Wed, 7 Nov 2007 16:58:59 +0100), Ingo Oeser <netdev@axxeo.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.

> > +
> > +static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
> > +{
> > +       return (addr->s6_addr32[2] == __constant_htonl(0x02005EFE) ||
> > +               addr->s6_addr32[2] == __constant_htonl(0x00005EFE));
> > +}
> > +#endif
> 
> The compiler will notice that "0x01000000" is a constant and will
> use "_constant_htonl()" automatically. Please use simply htonl().

Right.  And, maybe, you can write as follows:
	return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE));

--yoshfuji

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 18:12   ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-11-07 18:24     ` Templin, Fred L
  2007-11-07 18:48       ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 12+ messages in thread
From: Templin, Fred L @ 2007-11-07 18:24 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明, netdev; +Cc: netdev

 

> -----Original Message-----
> From: YOSHIFUJI Hideaki / 吉藤英明 [mailto:yoshfuji@linux-ipv6.org] 
> Sent: Wednesday, November 07, 2007 10:12 AM
> To: netdev@axxeo.de
> Cc: Templin, Fred L; netdev@vger.kernel.org; yoshfuji@linux-ipv6.org
> Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
> 
> Hello.
> 
> In article <200711071658.59478.netdev@axxeo.de> (at Wed, 7 
> Nov 2007 16:58:59 +0100), Ingo Oeser <netdev@axxeo.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.

> > > +
> > > +static inline int ipv6_addr_is_isatap(const struct 
> in6_addr *addr)
> > > +{
> > > +       return (addr->s6_addr32[2] == 
> __constant_htonl(0x02005EFE) ||
> > > +               addr->s6_addr32[2] == 
> __constant_htonl(0x00005EFE));
> > > +}
> > > +#endif
> > 
> > The compiler will notice that "0x01000000" is a constant and will
> > use "_constant_htonl()" automatically. Please use simply htonl().
> 
> Right.  And, maybe, you can write as follows:
> 	return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE));

This looks good, and the change will be made.

Fred
fred.l.templin@boeing.com

> 
> --yoshfuji
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 18:24     ` Templin, Fred L
@ 2007-11-07 18:48       ` YOSHIFUJI Hideaki / 吉藤英明
  2007-11-07 18:52         ` Templin, Fred L
  0 siblings, 1 reply; 12+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-11-07 18:48 UTC (permalink / raw)
  To: Fred.L.Templin; +Cc: netdev, netdev, yoshfuji

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

>  
> 
> > -----Original Message-----
> > From: YOSHIFUJI Hideaki / 吉藤英明 [mailto:yoshfuji@linux-ipv6.org] 
> > Sent: Wednesday, November 07, 2007 10:12 AM
> > To: netdev@axxeo.de
> > Cc: Templin, Fred L; netdev@vger.kernel.org; yoshfuji@linux-ipv6.org
> > Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
> > 
> > Hello.
> > 
> > In article <200711071658.59478.netdev@axxeo.de> (at Wed, 7 
> > Nov 2007 16:58:59 +0100), Ingo Oeser <netdev@axxeo.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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 18:48       ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-11-07 18:52         ` Templin, Fred L
  2007-11-07 19:01           ` Simon Arlott
  2007-11-07 19:47           ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 2 replies; 12+ messages in thread
From: Templin, Fred L @ 2007-11-07 18:52 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: netdev, netdev

 

> -----Original Message-----
> From: YOSHIFUJI Hideaki / 吉藤英明 [mailto:yoshfuji@linux-ipv6.org] 
> Sent: Wednesday, November 07, 2007 10:49 AM
> To: Templin, Fred L
> Cc: netdev@axxeo.de; netdev@vger.kernel.org; yoshfuji@linux-ipv6.org
> Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
> 
> In article 
> <39C363776A4E8C4A94691D2BD9D1C9A1029EDBF2@XCH-NW-7V2.nw.nos.bo
> eing.com> (at Wed, 7 Nov 2007 10:24:50 -0800), "Templin, Fred 
> L" <Fred.L.Templin@boeing.com> says:
> 
> >  
> > 
> > > -----Original Message-----
> > > From: YOSHIFUJI Hideaki / 吉藤英明 [mailto:yoshfuji@linux-ipv6.org] 
> > > Sent: Wednesday, November 07, 2007 10:12 AM
> > > To: netdev@axxeo.de
> > > Cc: Templin, Fred L; netdev@vger.kernel.org; 
> yoshfuji@linux-ipv6.org
> > > Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
> > > 
> > > Hello.
> > > 
> > > In article <200711071658.59478.netdev@axxeo.de> (at Wed, 7 
> > > Nov 2007 16:58:59 +0100), Ingo Oeser <netdev@axxeo.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).

Maybe it is I who did not understand. Can you suggest a clean solution?

Fred
fred.l.templin@boeing.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 18:52         ` Templin, Fred L
@ 2007-11-07 19:01           ` Simon Arlott
  2007-11-07 19:32             ` Templin, Fred L
  2007-11-07 19:47           ` YOSHIFUJI Hideaki / 吉藤英明
  1 sibling, 1 reply; 12+ messages in thread
From: Simon Arlott @ 2007-11-07 19:01 UTC (permalink / raw)
  To: Templin, Fred L
  Cc: YOSHIFUJI Hideaki / 吉藤英明, netdev,
	netdev

On 07/11/07 18:52, Templin, Fred L wrote:
>> > > > > +	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;
>> 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).
> 
> Maybe it is I who did not understand. Can you suggest a clean solution?

((ipv4 & htonl(0xFF000000)) == htonl(0x0A000000)) etc.?

-- 
Simon Arlott

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 19:01           ` Simon Arlott
@ 2007-11-07 19:32             ` Templin, Fred L
  2007-11-07 19:38               ` Simon Arlott
  0 siblings, 1 reply; 12+ messages in thread
From: Templin, Fred L @ 2007-11-07 19:32 UTC (permalink / raw)
  To: Simon Arlott
  Cc: YOSHIFUJI Hideaki / 吉藤英明, netdev,
	netdev

 

> -----Original Message-----
> From: Simon Arlott [mailto:simon@fire.lp0.eu] 
> Sent: Wednesday, November 07, 2007 11:02 AM
> To: Templin, Fred L
> Cc: YOSHIFUJI Hideaki / 吉藤英明; netdev@axxeo.de; netdev@vger.kernel.org
> Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
> 
> On 07/11/07 18:52, Templin, Fred L wrote:
> >> > > > > +	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;
> >> 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).
> > 
> > Maybe it is I who did not understand. Can you suggest a 
> clean solution?
> 
> ((ipv4 & htonl(0xFF000000)) == htonl(0x0A000000)) etc.?

I'm not sure this works when we consider disjoint ranges
of globally-unique IP prefixes. Do you have a vision for
how the entire conditional would look like?

Thanks - Fred
fred.l.templin@boeing.com

> Simon Arlott

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 19:32             ` Templin, Fred L
@ 2007-11-07 19:38               ` Simon Arlott
  0 siblings, 0 replies; 12+ messages in thread
From: Simon Arlott @ 2007-11-07 19:38 UTC (permalink / raw)
  To: Templin, Fred L
  Cc: YOSHIFUJI Hideaki / 吉藤英明, netdev,
	netdev

On 07/11/07 19:32, Templin, Fred L wrote:
>  
> 
>> -----Original Message-----
>> From: Simon Arlott [mailto:simon@fire.lp0.eu] 
>> Sent: Wednesday, November 07, 2007 11:02 AM
>> To: Templin, Fred L
>> Cc: YOSHIFUJI Hideaki / 吉藤英明; netdev@axxeo.de; netdev@vger.kernel.org
>> Subject: Re: [PATCH 02/05] ipv6: RFC4214 Support
>> 
>> On 07/11/07 18:52, Templin, Fred L wrote:
>> >> > > > > +	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;
>> >> 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).
>> > 
>> > Maybe it is I who did not understand. Can you suggest a 
>> clean solution?
>> 
>> ((ipv4 & htonl(0xFF000000)) == htonl(0x0A000000)) etc.?
> 
> I'm not sure this works when we consider disjoint ranges
> of globally-unique IP prefixes. Do you have a vision for
> how the entire conditional would look like?

You need to match RFC3330 addresses, not anything that isn't.

((ipv4 & htonl(0xFF000000)) == htonl(0x0A000000))
|| ((ipv4 & htonl(0xFFFF0000)) == htonl(0xC0A80000))
|| ((ipv4 & htonl(0xFF000000)) == htonl(0x80000000))
etc.

-- 
Simon Arlott

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 18:52         ` Templin, Fred L
  2007-11-07 19:01           ` Simon Arlott
@ 2007-11-07 19:47           ` YOSHIFUJI Hideaki / 吉藤英明
  2007-11-09 18:12             ` Ingo Oeser
  1 sibling, 1 reply; 12+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-11-07 19:47 UTC (permalink / raw)
  To: Fred.L.Templin; +Cc: netdev, netdev, yoshfuji

In article <39C363776A4E8C4A94691D2BD9D1C9A1029EDBF4@XCH-NW-7V2.nw.nos.boeing.com> (at Wed, 7 Nov 2007 10:52:47 -0800), "Templin, Fred L" <Fred.L.Templin@boeing.com> says:

> > > > > > +	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;

> Maybe it is I who did not understand. Can you suggest a clean solution?

You could write each element as LOOPBACK(), MULTICAST()
etc.
	eui[0] = (!ZERONETO(a) &&
	          !PRIVATE_10(a) &&
		  !LINKLOCAL(a) &&
		  !PRIVATE_172(a) &&
		  !PRIVATE_192(a) &&
		  !NETICDEVBENCH(a) &&
		  !MULTICAST(a)) ? 2 : 0;

--yoshfuji

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 02/05] ipv6: RFC4214 Support
  2007-11-07 19:47           ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-11-09 18:12             ` Ingo Oeser
  0 siblings, 0 replies; 12+ messages in thread
From: Ingo Oeser @ 2007-11-09 18:12 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明
  Cc: Fred.L.Templin, netdev

YOSHIFUJI Hideaki / 吉藤英明 schrieb:
> In article <39C363776A4E8C4A94691D2BD9D1C9A1029EDBF4@XCH-NW-7V2.nw.nos.boeing.com> (at Wed, 7 Nov 2007 10:52:47 -0800), "Templin, Fred L" <Fred.L.Templin@boeing.com> says:
> 
> > > > > > > +	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;
> 
> > Maybe it is I who did not understand. Can you suggest a clean solution?
> 
> You could write each element as LOOPBACK(), MULTICAST()
> etc.
> 	eui[0] = (!ZERONETO(a) &&
> 	          !PRIVATE_10(a) &&
> 		  !LINKLOCAL(a) &&
> 		  !PRIVATE_172(a) &&
> 		  !PRIVATE_192(a) &&
> 		  !NETICDEVBENCH(a) &&
> 		  !MULTICAST(a)) ? 2 : 0;

Oh, yes that's great! Now even *I* can read what this is all about 
without reading any RFC :-)

Please Fred, try to do it that way.


Best Regards

Ingo Oeser

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-11-09 18:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07  1:16 [PATCH 02/05] ipv6: RFC4214 Support Templin, Fred L
2007-11-07 15:58 ` Ingo Oeser
2007-11-07 16:12   ` Templin, Fred L
2007-11-07 18:12   ` YOSHIFUJI Hideaki / 吉藤英明
2007-11-07 18:24     ` Templin, Fred L
2007-11-07 18:48       ` YOSHIFUJI Hideaki / 吉藤英明
2007-11-07 18:52         ` Templin, Fred L
2007-11-07 19:01           ` Simon Arlott
2007-11-07 19:32             ` Templin, Fred L
2007-11-07 19:38               ` Simon Arlott
2007-11-07 19:47           ` YOSHIFUJI Hideaki / 吉藤英明
2007-11-09 18:12             ` Ingo Oeser

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).