IPv6: ipv6_addr_type() doesn't know about RFC4193 addresses
Subsystems (3)
David Miller
maintainerFrom: Dave Johnson <[email protected]>
Date: Wed, 25 Jul 2007 19:49:09 -0400
Quoted 10 lines
ipv6_addr_type()doesn't check for 'Unique Local IPv6 Unicast Addresses' (RFC4193) and returnsIPV6_ADDR_RESERVEDfor that range.SCTP uses this function and will fail
bind()andconnect()calls that use RFC4193 addresses, SCTP will also ignore inbound connections from RFC4193 addresses if listening onIPV6_ADDR_ANY.There may be other users of
ipv6_addr_type()that could also have problems.
Contrarily, there may be ipv6_addr_type() call sites that really do want to reject rfc4193 addresses.
PATCH 1/1 IPv6: ipv6_addr_type() doesn't know about RFC4193 addresses
ipv6_addr_type() doesn't check for 'Unique Local IPv6 Unicast Addresses' (RFC4193) and returns IPV6_ADDR_RESERVED for that range.
SCTP uses this function and will fail bind() and connect() calls that use RFC4193 addresses, SCTP will also ignore inbound connections from RFC4193 addresses if listening on IPV6_ADDR_ANY.
There may be other users of ipv6_addr_type() that could also have problems.
===== net/ipv6/addrconf_core.c 1.2 vs edited =====
net/ipv6/addrconf_core.c +3 -0
@@ -50,6 +50,9 @@if ((st &htonl (0xFFC00000 )) ==htonl (0xFEC00000 ))return (IPV6_ADDR_SITELOCAL |IPV6_ADDR_UNICAST |IPV6_ADDR_SCOPE_TYPE (IPV6_ADDR_SCOPE_SITELOCAL ));/* addr-select 3.1 */ +if ((st &htonl (0xFE000000 )) ==htonl (0xFC000000 )) +return (IPV6_ADDR_UNICAST | +IPV6_ADDR_SCOPE_TYPE (IPV6_ADDR_SCOPE_GLOBAL ));/* RFC 4193 */ if ((addr->s6_addr32[0 ] | addr->s6_addr32[1 ]) ==0 ) {if (addr->s6_addr32[2 ] ==0 ) {
Quoted 2 lines · David Miller
Contrarily, there may be
ipv6_addr_type()call sites that really do want to reject rfc4193 addresses.
A quick look through the callers and only these functions should be effected, they check either RESERVED or UNICAST from ipv6_addr_type():
net/ipv6/addrconf.c: ipv6_dev_get_saddr() net/ipv6/exthdrs.c: ipv6_dest_hao() net/ipv6/ip6_tunnel.c: ip6_tnl_set_cap() net/ipv6/netfilter/ip6t_REJECT.c: send_reset() net/ipv6/route.c: ip6_route_add() net/ipv6/route.c: ip6_pkt_drop() net/sctp/ipv6.c: sctp_v6_available() net/sctp/ipv6.c: sctp_v6_addr_valid()
Signature · 2 lines
Dave Johnson Starent Networks
net/ipv6/addrconf_core.c line 55
Quoted 6 lines · Dave Johnson
ipv6_addr_type()doesn't check for 'Unique Local IPv6 Unicast Addresses' (RFC4193) and returnsIPV6_ADDR_RESERVEDfor that range.net/ipv6/addrconf_core.c +3
-0+if ((st &htonl (0xFE000000 )) ==htonl (0xFC000000 )) +return (IPV6_ADDR_UNICAST | +IPV6_ADDR_SCOPE_TYPE (IPV6_ADDR_SCOPE_GLOBAL ));/* RFC 4193 */
But ULA's scope isn't global, shouldn't it be IPV6_ADDR_SCOPE_ORGLOCAL ?
Signature · 1 line
Simon Arlott
Quoted 7 lines · Dave Johnson
Quoted 2 lines · David Miller
Contrarily, there may be
ipv6_addr_type()call sites that really do want to reject rfc4193 addresses.A quick look through the callers and only these functions should be effected, they check either RESERVED or UNICAST from
ipv6_addr_type():
Quoted 9 lines
net/ipv6/addrconf.c: ipv6_dev_get_saddr() net/ipv6/exthdrs.c: ipv6_dest_hao() net/ipv6/ip6_tunnel.c: ip6_tnl_set_cap() net/ipv6/netfilter/ip6t_REJECT.c: send_reset() net/ipv6/route.c: ip6_route_add() net/ipv6/route.c: ip6_pkt_drop() net/sctp/ipv6.c: sctp_v6_available() net/sctp/ipv6.c: sctp_v6_addr_valid()
Well, it's not just for SCTP. ULA address are considered of Global scope. See this message
http://marc.info/?l=linux-netdev&m=118492205915816&w=2
-vlad
Quoted 1 line · Simon Arlott
But ULA's scope isn't global, shouldn't it be
IPV6_ADDR_SCOPE_ORGLOCAL?
Isn't ORGLOCAL defined for multicast only?
rfc4193 section 3.3 says:
Quoted 4 lines
3.3. Scope Definition
By default, the scope of these addresses is global. That is, they are not limited by ambiguity like the site-local addresses defined in [ADDARCH].
Signature · 2 lines
Dave Johnson Starent Networks
Quoted 9 lines · On Thursday 26 July 2007 20:21:59 Simon Arlott wrote:
net/ipv6/addrconf_core.c line 55
Quoted 6 lines · Dave Johnson
ipv6_addr_type()doesn't check for 'Unique Local IPv6 Unicast Addresses' (RFC4193) and returnsIPV6_ADDR_RESERVEDfor that range.net/ipv6/addrconf_core.c +3
-0+if ((st &htonl (0xFE000000 )) ==htonl (0xFC000000 )) +return (IPV6_ADDR_UNICAST | +IPV6_ADDR_SCOPE_TYPE (IPV6_ADDR_SCOPE_GLOBAL ));/* RFC 4193 */ But ULA's scope isn't global, shouldn't it be
IPV6_ADDR_SCOPE_ORGLOCAL?
Yes it is - global.
Signature · 1 line
Rémi Denis-Courmont
Quoted 4 lines · Dave Johnson
Quoted 1 line · Simon Arlott
But ULA's scope isn't global, shouldn't it be
IPV6_ADDR_SCOPE_ORGLOCAL?Isn't ORGLOCAL defined for multicast only?
Yes, it's only for multicast. Unicast addresses only have 2 scopes any more: Global and Link-Local.
-vlad
Quoted 9 lines
rfc4193 section 3.3 says:
Quoted 4 lines
3.3. Scope Definition
By default, the scope of these addresses is global. That is, they are not limited by ambiguity like the site-local addresses defined in [ADDARCH].
Hello.
In article <[email protected]> (at Wed, 25 Jul 2007 19:49:09 -0400), Dave Johnson <[email protected]> says:
Quoted 2 lines
ipv6_addr_type()doesn't check for 'Unique Local IPv6 Unicast Addresses' (RFC4193) and returnsIPV6_ADDR_RESERVEDfor that range.
I would say, it would be better to add IPV6_ADDR_UNICAST as well for "reserved" addresses unless we have good reason not to do it, anyway.
Signature · 2 lines
YOSHIFUJI Hideaki @ USAGI Project <[email protected]> GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
In article <[email protected]> (at Wed, 25 Jul 2007 17:12:03 -0700 (PDT)), David Miller <[email protected]> says:
Quoted 2 lines
Contrarily, there may be
ipv6_addr_type()call sites that really do want to reject rfc4193 addresses.
I do not think we have such users.
--yoshfuji
David Miller
maintainerFrom: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Thu, 26 Jul 2007 13:34:52 -0500 (CDT)
Quoted 6 lines
In article <[email protected]> (at Wed, 25 Jul 2007 19:49:09 -0400), Dave Johnson <[email protected]> says:
Quoted 2 lines
ipv6_addr_type()doesn't check for 'Unique Local IPv6 Unicast Addresses' (RFC4193) and returnsIPV6_ADDR_RESERVEDfor that range.
Ok, I've applied Dave's patch.
Dave, although it's customary and fine to use "+foo-list" email addresses for mailing list subscriptions and discussions, I ask that you don't add that cookie to your signoff lines in patch submissions and I've removed it from your's in this patch.
Thanks a lot.