diff options
author | Michael Brown <mcb30@ipxe.org> | 2013-10-23 14:00:12 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2013-10-23 14:07:57 +0100 |
commit | 33652880a7b5881d3f2181fea94bed2ba525d44b (patch) | |
tree | 0dc21f0a479a0865155a21866e0a2d3cdcb9291f /src/include/ipxe/ipv6.h | |
parent | 2dca2e6ade6ed89029b2812a0a6f07276cdace76 (diff) | |
download | ipxe-33652880a7b5881d3f2181fea94bed2ba525d44b.tar.gz |
[ipv6] Support stateless address autoconfiguration (SLAAC)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/ipv6.h')
-rw-r--r-- | src/include/ipxe/ipv6.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/include/ipxe/ipv6.h b/src/include/ipxe/ipv6.h index f404ba64e..6a9aa606c 100644 --- a/src/include/ipxe/ipv6.h +++ b/src/include/ipxe/ipv6.h @@ -173,20 +173,18 @@ struct ipv6_miniroute { }; /** - * Construct link-local address (via EUI-64) + * Construct local IPv6 address via EUI-64 * - * @v addr Address to construct + * @v addr Prefix to be completed * @v netdev Network device * @ret prefix_len Prefix length, or negative error */ -static inline int ipv6_link_local ( struct in6_addr *addr, - struct net_device *netdev ) { +static inline int ipv6_eui64 ( struct in6_addr *addr, + struct net_device *netdev ) { struct ll_protocol *ll_protocol = netdev->ll_protocol; const void *ll_addr = netdev->ll_addr; int rc; - memset ( addr, 0, sizeof ( *addr ) ); - addr->s6_addr16[0] = htons ( 0xfe80 ); if ( ( rc = ll_protocol->eui64 ( ll_addr, &addr->s6_addr[8] ) ) != 0 ) return rc; addr->s6_addr[8] ^= 0x02; @@ -194,6 +192,21 @@ static inline int ipv6_link_local ( struct in6_addr *addr, } /** + * Construct link-local address via EUI-64 + * + * @v addr Address to construct + * @v netdev Network device + * @ret prefix_len Prefix length, or negative error + */ +static inline int ipv6_link_local ( struct in6_addr *addr, + struct net_device *netdev ) { + + memset ( addr, 0, sizeof ( *addr ) ); + addr->s6_addr16[0] = htons ( 0xfe80 ); + return ipv6_eui64 ( addr, netdev ); +} + +/** * Construct solicited-node multicast address * * @v addr Address to construct @@ -214,5 +227,7 @@ extern struct list_head ipv6_miniroutes; extern struct net_protocol ipv6_protocol __net_protocol; extern int ipv6_has_addr ( struct net_device *netdev, struct in6_addr *addr ); +extern int ipv6_slaac ( struct net_device *netdev, struct in6_addr *prefix, + unsigned int prefix_len, struct in6_addr *router ); #endif /* _IPXE_IPV6_H */ |