0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x02 } } }
+/*
+ * With IPv6, the broadcast MAC address is not used. Instead, it should use
+ * the multicast address (see RFC RFC2464 section 7)
+ */
+#define IPV6_ALL_NODE_ETH_ADDR(_ip6_addr) {0x33, \
+ 0x33, \
+ _ip6_addr.in6_u.u6_addr8[12], \
+ _ip6_addr.in6_u.u6_addr8[13], \
+ _ip6_addr.in6_u.u6_addr8[14], \
+ _ip6_addr.in6_u.u6_addr8[15]}
#define IPV6_LINK_LOCAL_PREFIX 0xfe80
#define IPV6_LINK_LOCAL_MASK 0xffb0 /* The first 10-bit of address mask. */
int updated_sol_max_rt_ms = SOL_MAX_RT_MS;
/* state machine parameters/variables */
struct dhcp6_sm_params sm_params;
+/* DHCPv6 all server IP6 address */
+const struct in6_addr dhcp_mcast_ip6 = DHCP6_MULTICAST_ADDR;
+/* IPv6 multicast ethernet address */
+const u8 net_dhcp6_mcast_ethaddr[6] = IPV6_ALL_NODE_ETH_ADDR(dhcp_mcast_ip6);
static void dhcp6_state_machine(bool timeout, uchar *rx_pkt, unsigned int len);
*/
static void dhcp6_send_solicit_packet(void)
{
- struct in6_addr dhcp_bcast_ip6;
int len = 0;
uchar *pkt;
uchar *dhcp_pkt_start_ptr;
len = pkt - dhcp_pkt_start_ptr;
/* send UDP packet to DHCP6 multicast address */
- string_to_ip6(DHCP6_MULTICAST_ADDR, sizeof(DHCP6_MULTICAST_ADDR), &dhcp_bcast_ip6);
net_set_udp_handler(dhcp6_handler);
- net_send_udp_packet6((uchar *)net_bcast_ethaddr, &dhcp_bcast_ip6,
+ net_send_udp_packet6((uchar *)net_dhcp6_mcast_ethaddr, (struct in6_addr *)&dhcp_mcast_ip6,
PORT_DHCP6_S, PORT_DHCP6_C, len);
}
*/
static void dhcp6_send_request_packet(void)
{
- struct in6_addr dhcp_bcast_ip6;
int len = 0;
uchar *pkt;
uchar *dhcp_pkt_start_ptr;
len = pkt - dhcp_pkt_start_ptr;
/* send UDP packet to DHCP6 multicast address */
- string_to_ip6(DHCP6_MULTICAST_ADDR, strlen(DHCP6_MULTICAST_ADDR), &dhcp_bcast_ip6);
net_set_udp_handler(dhcp6_handler);
- net_send_udp_packet6((uchar *)net_bcast_ethaddr, &dhcp_bcast_ip6,
+ net_send_udp_packet6((uchar *)net_dhcp6_mcast_ethaddr, (struct in6_addr *)&dhcp_mcast_ip6,
PORT_DHCP6_S, PORT_DHCP6_C, len);
}
/* vendor-class-data to send in vendor clas option */
#define DHCP6_VCI_STRING "U-Boot"
-#define DHCP6_MULTICAST_ADDR "ff02::1:2" /* DHCP multicast address */
+/*
+ * All-DHCPv6 server multicast address
+ */
+#define DHCP6_MULTICAST_ADDR { { { 0xFF, 0x02, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x01, 0x00, 0x02 } } }
/* DHCP6 States supported */
enum dhcp6_state {