From 33652880a7b5881d3f2181fea94bed2ba525d44b Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 23 Oct 2013 14:00:12 +0100 Subject: [ipv6] Support stateless address autoconfiguration (SLAAC) Signed-off-by: Michael Brown --- src/include/ipxe/ipv6.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/include/ipxe/ipv6.h') diff --git a/src/include/ipxe/ipv6.h b/src/include/ipxe/ipv6.h index f404ba6..6a9aa60 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 */ -- cgit v1.1