diff options
author | Michael Brown <mcb30@ipxe.org> | 2013-08-26 14:23:54 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2013-09-03 16:30:46 +0100 |
commit | f7f3087cc542d76f19ba6362b0837dcf1baf86b8 (patch) | |
tree | 8d2a920c16a2255f9e9ac57d2b333d8d01edc556 /src/include/ipxe/icmpv6.h | |
parent | 43307b4e39300f6602a975bbb710b443e5fcd2b5 (diff) | |
download | ipxe-f7f3087cc542d76f19ba6362b0837dcf1baf86b8.tar.gz |
[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/icmpv6.h')
-rw-r--r-- | src/include/ipxe/icmpv6.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/include/ipxe/icmpv6.h b/src/include/ipxe/icmpv6.h new file mode 100644 index 000000000..c8f0be05a --- /dev/null +++ b/src/include/ipxe/icmpv6.h @@ -0,0 +1,78 @@ +#ifndef _IPXE_ICMP6_H +#define _IPXE_ICMP6_H + +/** @file + * + * ICMPv6 protocol + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <stdint.h> +#include <ipxe/tables.h> +#include <ipxe/iobuf.h> +#include <ipxe/netdevice.h> + +/** An ICMPv6 header */ +struct icmpv6_header { + /** Type */ + uint8_t type; + /** Code */ + uint8_t code; + /** Checksum */ + uint16_t chksum; +} __attribute__ (( packed )); + +/** An ICMPv6 echo request/reply */ +struct icmpv6_echo { + /** ICMPv6 header */ + struct icmpv6_header icmp; + /** Identifier */ + uint16_t ident; + /** Sequence number */ + uint16_t sequence; + /** Data */ + uint8_t data[0]; +} __attribute__ (( packed )); + +/** An ICMPv6 handler */ +struct icmpv6_handler { + /** Type */ + unsigned int type; + /** Process received packet + * + * @v iobuf I/O buffer + * @v netdev Network device + * @v sin6_src Source socket address + * @v sin6_dest Destination socket address + * @ret rc Return status code + * + * This function takes ownership of the I/O buffer. + */ + int ( * rx ) ( struct io_buffer *iobuf, struct net_device *netdev, + struct sockaddr_in6 *sin6_src, + struct sockaddr_in6 *sin6_dest ); +}; + +/** ICMPv6 handler table */ +#define ICMPV6_HANDLERS __table ( struct icmpv6_handler, "icmpv6_handlers" ) + +/** Declare an ICMPv6 handler */ +#define __icmpv6_handler __table_entry ( ICMPV6_HANDLERS, 01 ) + +/** ICMPv6 echo request */ +#define ICMPV6_ECHO_REQUEST 128 + +/** ICMPv6 echo reply */ +#define ICMPV6_ECHO_REPLY 129 + +/** ICMPv6 neighbour solicitation */ +#define ICMPV6_NDP_NEIGHBOUR_SOLICITATION 135 + +/** ICMPv6 neighbour advertisement */ +#define ICMPV6_NDP_NEIGHBOUR_ADVERTISEMENT 136 + +extern struct tcpip_protocol icmpv6_protocol __tcpip_protocol; + +#endif /* _IPXE_ICMP6_H */ |