summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/in.h
diff options
context:
space:
mode:
authorMichael Brown2013-08-26 15:23:54 +0200
committerMichael Brown2013-09-03 17:30:46 +0200
commitf7f3087cc542d76f19ba6362b0837dcf1baf86b8 (patch)
tree8d2a920c16a2255f9e9ac57d2b333d8d01edc556 /src/include/ipxe/in.h
parent[ipv4] Abstract out protocol-specific portions of "route" command (diff)
downloadipxe-f7f3087cc542d76f19ba6362b0837dcf1baf86b8.tar.gz
ipxe-f7f3087cc542d76f19ba6362b0837dcf1baf86b8.tar.xz
ipxe-f7f3087cc542d76f19ba6362b0837dcf1baf86b8.zip
[ipv6] Replace IPv6 stack
Replace the existing partially-implemented IPv6 stack with a fresh implementation. This implementation is not yet complete. The IPv6 transmit and receive datapaths are functional (including fragment reassembly and parsing of arbitrary extension headers). NDP neighbour solicitations and advertisements are supported. ICMPv6 echo is supported. At present, only link-local addresses may be used, and there is no way to specify an IPv6 address as part of a URI (either directly or via a DNS lookup). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/in.h')
-rw-r--r--src/include/ipxe/in.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/include/ipxe/in.h b/src/include/ipxe/in.h
index eee9159f..a1821b1f 100644
--- a/src/include/ipxe/in.h
+++ b/src/include/ipxe/in.h
@@ -50,6 +50,13 @@ struct in6_addr {
#define s6_addr32 in6_u.u6_addr32
};
+#define IN6_IS_ADDR_MULTICAST( addr ) \
+ ( *( ( const uint8_t * ) (addr) ) == 0xff )
+
+#define IN6_IS_ADDR_LINKLOCAL( addr ) \
+ ( ( *( ( const uint16_t * ) (addr) ) & htons ( 0xffc0 ) ) == \
+ htonl ( 0xfe80 ) )
+
/**
* IPv4 socket address
*/
@@ -90,9 +97,13 @@ struct sockaddr_in6 {
uint16_t sin6_flags;
/** TCP/IP port (part of struct @c sockaddr_tcpip) */
uint16_t sin6_port;
- uint32_t sin6_flowinfo; /* Flow number */
- struct in6_addr sin6_addr; /* 128-bit destination address */
- uint32_t sin6_scope_id; /* Scope ID */
+ /** Scope ID
+ *
+ * For link-local addresses, this is the network device index.
+ */
+ uint16_t sin6_scope_id;
+ /** IPv6 address */
+ struct in6_addr sin6_addr;
/** Padding
*
* This ensures that a struct @c sockaddr_in6 is large
@@ -103,20 +114,12 @@ struct sockaddr_in6 {
( sizeof ( sa_family_t ) /* sin6_family */ +
sizeof ( uint16_t ) /* sin6_flags */ +
sizeof ( uint16_t ) /* sin6_port */ +
- sizeof ( uint32_t ) /* sin6_flowinfo */ +
- sizeof ( struct in6_addr ) /* sin6_addr */ +
- sizeof ( uint32_t ) /* sin6_scope_id */ ) ];
+ sizeof ( uint16_t ) /* sin6_scope_id */ +
+ sizeof ( struct in6_addr ) /* sin6_addr */ ) ];
} __attribute__ (( may_alias ));
extern int inet_aton ( const char *cp, struct in_addr *inp );
extern char * inet_ntoa ( struct in_addr in );
-
-/* Adding the following for IP6 support
- *
-
-extern int inet6_aton ( const char *cp, struct in6_addr *inp );
-extern char * inet6_ntoa ( struct in_addr in );
-
- */
+extern char * inet6_ntoa ( const struct in6_addr *in6 );
#endif /* _IPXE_IN_H */