diff options
| author | Michael Brown | 2013-10-23 00:39:29 +0200 |
|---|---|---|
| committer | Michael Brown | 2013-10-23 15:07:56 +0200 |
| commit | 2dca2e6ade6ed89029b2812a0a6f07276cdace76 (patch) | |
| tree | a761ba75bbd11190cceb8b1ebb25f7463b4fad4c /src/include/ipxe | |
| parent | [ipv6] Handle IPv6 option length correctly (diff) | |
| download | ipxe-2dca2e6ade6ed89029b2812a0a6f07276cdace76.tar.gz ipxe-2dca2e6ade6ed89029b2812a0a6f07276cdace76.tar.xz ipxe-2dca2e6ade6ed89029b2812a0a6f07276cdace76.zip | |
[ipv6] Extract link layer addresses from router advertisements
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
| -rw-r--r-- | src/include/ipxe/icmpv6.h | 7 | ||||
| -rw-r--r-- | src/include/ipxe/ndp.h | 44 |
2 files changed, 44 insertions, 7 deletions
diff --git a/src/include/ipxe/icmpv6.h b/src/include/ipxe/icmpv6.h index c09a71a02..15f8edd83 100644 --- a/src/include/ipxe/icmpv6.h +++ b/src/include/ipxe/icmpv6.h @@ -46,11 +46,14 @@ struct icmpv6_handler { /** ICMPv6 echo reply */ #define ICMPV6_ECHO_REPLY 129 +/** ICMPv6 router advertisement */ +#define ICMPV6_ROUTER_ADVERTISEMENT 134 + /** ICMPv6 neighbour solicitation */ -#define ICMPV6_NDP_NEIGHBOUR_SOLICITATION 135 +#define ICMPV6_NEIGHBOUR_SOLICITATION 135 /** ICMPv6 neighbour advertisement */ -#define ICMPV6_NDP_NEIGHBOUR_ADVERTISEMENT 136 +#define ICMPV6_NEIGHBOUR_ADVERTISEMENT 136 extern struct tcpip_protocol icmpv6_protocol __tcpip_protocol; diff --git a/src/include/ipxe/ndp.h b/src/include/ipxe/ndp.h index 1f05e9abe..92f6da592 100644 --- a/src/include/ipxe/ndp.h +++ b/src/include/ipxe/ndp.h @@ -28,8 +28,8 @@ struct ndp_option { /** NDP option block size */ #define NDP_OPTION_BLKSZ 8 -/** An NDP header */ -struct ndp_header { +/** An NDP neighbour solicitation or advertisement header */ +struct ndp_neighbour_header { /** ICMPv6 header */ struct icmp_header icmp; /** Flags */ @@ -43,13 +43,47 @@ struct ndp_header { } __attribute__ (( packed )); /** NDP router flag */ -#define NDP_ROUTER 0x80 +#define NDP_NEIGHBOUR_ROUTER 0x80 /** NDP solicited flag */ -#define NDP_SOLICITED 0x40 +#define NDP_NEIGHBOUR_SOLICITED 0x40 /** NDP override flag */ -#define NDP_OVERRIDE 0x20 +#define NDP_NEIGHBOUR_OVERRIDE 0x20 + +/** An NDP router advertisement header */ +struct ndp_router_advertisement_header { + /** ICMPv6 header */ + struct icmp_header icmp; + /** Current hop limit */ + uint8_t hop_limit; + /** Flags */ + uint8_t flags; + /** Router lifetime */ + uint16_t lifetime; + /** Reachable time */ + uint32_t reachable; + /** Retransmission timer */ + uint32_t retransmit; + /** Options */ + struct ndp_option option[0]; +} __attribute__ (( packed )); + +/** NDP managed address configuration */ +#define NDP_ROUTER_MANAGED 0x80 + +/** NDP other configuration */ +#define NDP_ROUTER_OTHER 0x40 + +/** An NDP header */ +union ndp_header { + /** ICMPv6 header */ + struct icmp_header icmp; + /** Neighbour solicitation or advertisement header */ + struct ndp_neighbour_header neigh; + /** Router advertisement header */ + struct ndp_router_advertisement_header radv; +} __attribute__ (( packed )); /** NDP source link-layer address option */ #define NDP_OPT_LL_SOURCE 1 |
