diff options
author | Don Dugger <n0ano@n0ano.com> | 2016-06-03 03:33:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-06-03 03:33:23 +0000 |
commit | da27230f80795d0028333713f036d44c53cb0e68 (patch) | |
tree | b3d379eaf000adf72b36cb01cdf4d79c3e3f064c /qemu/roms/ipxe/src/net/ipv6.c | |
parent | 0e68cb048bb8aadb14675f5d4286d8ab2fc35449 (diff) | |
parent | 437fd90c0250dee670290f9b714253671a990160 (diff) |
Merge "These changes are the raw update to qemu-2.6."
Diffstat (limited to 'qemu/roms/ipxe/src/net/ipv6.c')
-rw-r--r-- | qemu/roms/ipxe/src/net/ipv6.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/qemu/roms/ipxe/src/net/ipv6.c b/qemu/roms/ipxe/src/net/ipv6.c index 3c374168c..a75e72ddb 100644 --- a/qemu/roms/ipxe/src/net/ipv6.c +++ b/qemu/roms/ipxe/src/net/ipv6.c @@ -290,8 +290,7 @@ static struct ipv6_miniroute * ipv6_route ( unsigned int scope_id, if ( ! ( miniroute->flags & IPV6_HAS_ADDRESS ) ) continue; - if ( IN6_IS_ADDR_LINKLOCAL ( *dest ) || - IN6_IS_ADDR_MULTICAST ( *dest ) ) { + if ( IN6_IS_ADDR_NONGLOBAL ( *dest ) ) { /* If destination is non-global, and the scope ID * matches this network device, then use this route. @@ -901,7 +900,7 @@ static const char * ipv6_sock_ntoa ( struct sockaddr *sa ) { const char *netdev_name; /* Identify network device, if applicable */ - if ( IN6_IS_ADDR_LINKLOCAL ( in ) || IN6_IS_ADDR_MULTICAST ( in ) ) { + if ( IN6_IS_ADDR_NONGLOBAL ( in ) ) { netdev = find_netdev_by_index ( sin6->sin6_scope_id ); netdev_name = ( netdev ? netdev->name : "UNKNOWN" ); } else { @@ -956,14 +955,26 @@ static int ipv6_sock_aton ( const char *string, struct sockaddr *sa ) { if ( ( rc = inet6_aton ( in_string, &in ) ) != 0 ) goto err_inet6_aton; - /* Parse network device name, if present */ + /* Parse scope ID, if applicable */ if ( netdev_string ) { + + /* Parse explicit network device name, if present */ netdev = find_netdev ( netdev_string ); if ( ! netdev ) { rc = -ENODEV; goto err_find_netdev; } sin6->sin6_scope_id = netdev->index; + + } else if ( IN6_IS_ADDR_NONGLOBAL ( &in ) ) { + + /* If no network device is explicitly specified for a + * link-local or multicast address, default to using + * "netX" (if existent). + */ + netdev = last_opened_netdev(); + if ( netdev ) + sin6->sin6_scope_id = netdev->index; } /* Copy IPv6 address portion to socket address */ @@ -1104,6 +1115,9 @@ struct net_driver ipv6_driver __net_driver = { .remove = ipv6_remove, }; +/* Drag in objects via ipv6_protocol */ +REQUIRING_SYMBOL ( ipv6_protocol ); + /* Drag in ICMPv6 */ REQUIRE_OBJECT ( icmpv6 ); |