[ipv6] Extract link layer addresses from router advertisements

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-10-22 23:39:29 +01:00
parent 595e32d7ab
commit 2dca2e6ade
3 changed files with 188 additions and 54 deletions

View File

@@ -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;

View File

@@ -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