summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown2013-10-24 15:06:33 +0200
committerMichael Brown2013-10-25 18:29:25 +0200
commitb15dbc9cc65e8385a30513554129d7640bc8a0f9 (patch)
tree0940b32e4dff9afa6c938a1922cfe1174bd3670b /src/include/ipxe
parent[pxe] Always retrieve cached DHCPACK and apply to relevant network device (diff)
downloadipxe-b15dbc9cc65e8385a30513554129d7640bc8a0f9.tar.gz
ipxe-b15dbc9cc65e8385a30513554129d7640bc8a0f9.tar.xz
ipxe-b15dbc9cc65e8385a30513554129d7640bc8a0f9.zip
[ipv6] Add ndp_tx_router_solicitation() to send router solicitations
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/icmpv6.h3
-rw-r--r--src/include/ipxe/ipv6.h16
-rw-r--r--src/include/ipxe/ndp.h14
3 files changed, 29 insertions, 4 deletions
diff --git a/src/include/ipxe/icmpv6.h b/src/include/ipxe/icmpv6.h
index 15f8edd83..b5ea54eab 100644
--- a/src/include/ipxe/icmpv6.h
+++ b/src/include/ipxe/icmpv6.h
@@ -46,6 +46,9 @@ struct icmpv6_handler {
/** ICMPv6 echo reply */
#define ICMPV6_ECHO_REPLY 129
+/** ICMPv6 router solicitation */
+#define ICMPV6_ROUTER_SOLICITATION 133
+
/** ICMPv6 router advertisement */
#define ICMPV6_ROUTER_ADVERTISEMENT 134
diff --git a/src/include/ipxe/ipv6.h b/src/include/ipxe/ipv6.h
index 6a9aa606c..3cb878262 100644
--- a/src/include/ipxe/ipv6.h
+++ b/src/include/ipxe/ipv6.h
@@ -194,14 +194,13 @@ static inline int ipv6_eui64 ( struct in6_addr *addr,
/**
* Construct link-local address via EUI-64
*
- * @v addr Address to construct
+ * @v addr Zeroed 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 );
}
@@ -209,19 +208,28 @@ static inline int ipv6_link_local ( struct in6_addr *addr,
/**
* Construct solicited-node multicast address
*
- * @v addr Address to construct
+ * @v addr Zeroed address to construct
* @v unicast Unicast address
*/
static inline void ipv6_solicited_node ( struct in6_addr *addr,
const struct in6_addr *unicast ) {
- memset ( addr, 0, sizeof ( *addr ) );
addr->s6_addr16[0] = htons ( 0xff02 );
addr->s6_addr[11] = 1;
addr->s6_addr[12] = 0xff;
memcpy ( &addr->s6_addr[13], &unicast->s6_addr[13], 3 );
}
+/**
+ * Construct all-routers multicast address
+ *
+ * @v addr Zeroed address to construct
+ */
+static inline void ipv6_all_routers ( struct in6_addr *addr ) {
+ addr->s6_addr16[0] = htons ( 0xff02 );
+ addr->s6_addr[15] = 2;
+}
+
extern struct list_head ipv6_miniroutes;
extern struct net_protocol ipv6_protocol __net_protocol;
diff --git a/src/include/ipxe/ndp.h b/src/include/ipxe/ndp.h
index 4edd96a40..f8c7e3fb3 100644
--- a/src/include/ipxe/ndp.h
+++ b/src/include/ipxe/ndp.h
@@ -124,12 +124,24 @@ struct ndp_router_advertisement_header {
/** NDP other configuration */
#define NDP_ROUTER_OTHER 0x40
+/** An NDP router solicitation header */
+struct ndp_router_solicitation_header {
+ /** ICMPv6 header */
+ struct icmp_header icmp;
+ /** Reserved */
+ uint32_t reserved;
+ /** Options */
+ union ndp_option option[0];
+} __attribute__ (( packed ));
+
/** An NDP header */
union ndp_header {
/** ICMPv6 header */
struct icmp_header icmp;
/** Neighbour solicitation or advertisement header */
struct ndp_neighbour_header neigh;
+ /** Router solicitation header */
+ struct ndp_router_solicitation_header rsol;
/** Router advertisement header */
struct ndp_router_advertisement_header radv;
} __attribute__ (( packed ));
@@ -154,4 +166,6 @@ static inline int ndp_tx ( struct io_buffer *iobuf, struct net_device *netdev,
&ndp_discovery, net_source, ll_source );
}
+extern int ndp_tx_router_solicitation ( struct net_device *netdev );
+
#endif /* _IPXE_NDP_H */