ipv6: RFC4214 Support (2)
Subsystems (3)
PATCH 2/5 ipv6: RFC4214 Support (2)
From: Fred L. Templin <[email protected]>
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.24-rc2 kernel distribution.
---
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 renamed from include/net/addrconf.h.orig 2007-11-08 12:06:17.000000000 -0800 +31 -0
@@ -241,6 +241,37 @@ 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) +{ + + /* RFC3330 Special-Use IPv4 Addresses */ + eui[0] = (((addr & htonl(0xFF000000)) == htonl(0x00000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x0A000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x0D000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x18000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x7F000000)) || + ((addr & htonl(0xFFFF0000)) == htonl(0xA9FE0000)) || + ((addr & htonl(0xFFF00000)) == htonl(0xAC100000)) || + ((addr & htonl(0xFFFFFF00)) == htonl(0xC0000200)) || + ((addr & htonl(0xFFFFFF00)) == htonl(0xC0586300)) || + ((addr & htonl(0xFFFF0000)) == htonl(0xC0A80000)) || + ((addr & htonl(0xFFFE0000)) == htonl(0xC6120000)) || + ((addr & htonl(0xF0000000)) == htonl(0xE0000000)) || + ((addr & htonl(0xF0000000)) == htonl(0xF0000000))) ? + 0x00 : 0x02; + + 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] | htonl(0x02000000)) == htonl(0x02005EFE)); +} +#endif + #ifdef CONFIG_PROC_FS extern int if6_proc_init(void); extern void if6_proc_exit(void);
In article <[email protected]> (at Thu, 08 Nov 2007 12:41:39 -0800), osprey67 <[email protected]> says:
Quoted 11 lines
From: Fred L. Templin <[email protected]>
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.24-rc2 kernel distribution.
Signed-off-by Fred L. Templin <[email protected]>
Hmm...tabs are still mangled, and it's better to have your official address. Anyway...
Quoted 21 lines
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 renamed from include/net/addrconf.h.orig 2007-11-08 12:06:17.000000000 -0800 +15
-0@@ -241,6 +241,37 @@ 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) +{ + + /* RFC3330 Special-Use IPv4 Addresses */ + eui[0] = (((addr & htonl(0xFF000000)) == htonl(0x00000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x0A000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x0D000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x18000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x7F000000)) || + ((addr & htonl(0xFFFF0000)) == htonl(0xA9FE0000)) || + ((addr & htonl(0xFFF00000)) == htonl(0xAC100000)) || + ((addr & htonl(0xFFFFFF00)) == htonl(0xC0000200)) || + ((addr & htonl(0xFFFFFF00)) == htonl(0xC0586300)) || + ((addr & htonl(0xFFFF0000)) == htonl(0xC0A80000)) ||
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 static inline int ipv6_addr_is_ll_all_ro · line 268
Quoted 10 lines
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 renamed from include/net/addrconf.h.orig 2007-11-08 12:06:17.000000000 -0800 +10
-0+ ((addr & htonl(0xFFFE0000)) == htonl(0xC6120000)) || + ((addr & htonl(0xF0000000)) == htonl(0xE0000000)) || + ((addr & htonl(0xF0000000)) == htonl(0xF0000000))) ? + 0x00 : 0x02; + + eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE; + memcpy (eui+4, &addr, 4); + return 0; +} +
Please put this function in net/ipv6/addrconf.c as addrconf_ifid_isatap().
Please use MULTICAST, LOCALNET etc. (and probaly introduce new macro for others). IMHO, it's better to add a comment for each entry, e.g.,
MULTICAST(addr) || /* 224.0.0.0/4 */ instead of ((addr & htonl(0xF0000000)) == htonl(0xE0000000)) ||
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 static inline int ipv6_addr_is_ll_all_ro · line 274
Quoted 6 lines
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 renamed from include/net/addrconf.h.orig 2007-11-08 12:06:17.000000000 -0800 +6
-0+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) +{ + return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE)); +} +#endif +
ipv6_addr_isatap(), maybe (to align with ipv6_addr_any() etc.).
--yoshfuji
Quoted 9 lines · YOSHIFUJI Hideaki / 吉藤英明
In article <[email protected]> (at Thu, 08 Nov 2007 12:41:39 -0800), osprey67 <[email protected]> says:
Quoted 7 lines
From: Fred L. Templin <[email protected]>
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".
Quoted 7 lines
Quoted 4 lines
The following diffs are specific to the Linux 2.6.24-rc2 kernel distribution.
Signed-off-by Fred L. Templin <[email protected]>Hmm...tabs are still mangled, and it's better to have your official address. Anyway...
I have switched over to Thunderbird and POP mail. I submitted the patches by cutting and pasting from a text file into the mail message. Is there a way to stop it from clobbering tabs?
Quoted 34 lines
Quoted 21 lines
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 renamed from include/net/addrconf.h.orig 2007-11-08 12:06:17.000000000 -0800 +15
-0@@ -241,6 +241,37 @@ 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) +{ + + /* RFC3330 Special-Use IPv4 Addresses */ + eui[0] = (((addr & htonl(0xFF000000)) == htonl(0x00000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x0A000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x0D000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x18000000)) || + ((addr & htonl(0xFF000000)) == htonl(0x7F000000)) || + ((addr & htonl(0xFFFF0000)) == htonl(0xA9FE0000)) || + ((addr & htonl(0xFFF00000)) == htonl(0xAC100000)) || + ((addr & htonl(0xFFFFFF00)) == htonl(0xC0000200)) || + ((addr & htonl(0xFFFFFF00)) == htonl(0xC0586300)) || + ((addr & htonl(0xFFFF0000)) == htonl(0xC0A80000)) ||include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 static inline int ipv6_addr_is_ll_all_ro · line 268
Quoted 10 lines
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 renamed from include/net/addrconf.h.orig 2007-11-08 12:06:17.000000000 -0800 +10
-0+ ((addr & htonl(0xFFFE0000)) == htonl(0xC6120000)) || + ((addr & htonl(0xF0000000)) == htonl(0xE0000000)) || + ((addr & htonl(0xF0000000)) == htonl(0xF0000000))) ? + 0x00 : 0x02; + + eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE; + memcpy (eui+4, &addr, 4); + return 0; +} +Please put this function in
net/ipv6/addrconf.casaddrconf_ifid_isatap().
Quoted 5 lines
Please use MULTICAST, LOCALNET etc. (and probaly introduce new macro for others). IMHO, it's better to add a comment for each entry, e.g.,
MULTICAST(addr) || /* 224.0.0.0/4 */ instead of ((addr & htonl(0xF0000000)) == htonl(0xE0000000)) ||
OK - will do.
Quoted 8 lines
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 static inline int ipv6_addr_is_ll_all_ro · line 274
Quoted 6 lines
include/net/addrconf.h 2007-11-08 08:27:24.000000000 -0800 renamed from include/net/addrconf.h.orig 2007-11-08 12:06:17.000000000 -0800 +6
-0+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) +{ + return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE)); +} +#endif +
ipv6_addr_isatap(), maybe (to align withipv6_addr_any()etc.).
Well, if you look in addrconf.h immediately above this the convention seems to be to call it as "*_is_*" if it is testing an address and to omit the "*_is_*" if it is setting an address. Since this is an address test, maybe more consistent to keep the "*_is_*"?
Thanks - Fred
[email protected]
Quoted 3 lines
--yoshfuji