rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / network / dnsmasq / patches / 03_client_mac.patch
blobad2d36a87372169c4216e8799fe28ae342fd794e
1 Solaris doesn't have an easy way to retrieve the MAC address of the client
2 that is soliciting the DHCPv6 IP address. This fix uses a simple way to
3 retrieve the client MAC address from the client's EUI64 link-local address.
5 diff --git a/src/dhcp6.c b/src/dhcp6.c
6 index 9901e1b..49a092b 100644
7 --- a/src/dhcp6.c
8 +++ b/src/dhcp6.c
9 @@ -261,6 +261,23 @@ void dhcp6_packet(time_t now)
11 void get_client_mac(struct in6_addr *client, int iface, unsigned char *mac, unsigned int *maclenp, unsigned int *mactypep, time_t now)
13 +#ifdef HAVE_SOLARIS_NETWORK
14 +/* Solaris does not have an easy way to retrieve MAC address for a given IPv6 address from the kernel.
15 + For now the following workaround should work for OpenStack's needs. */
16 + uint8_t *addr6;
18 + *maclenp = ETHER_ADDR_LEN;
19 + *mactypep = ARPHRD_ETHER;
20 + /* Take the EUI64 based client's link-local address and convert it to client's MAC address.
21 + For example: from fe80::f816:3eff:fe5c:df43 link-local address we arrive at fa:16:3e:5c:df:43 */
22 + addr6 = client->s6_addr;
23 + mac[0] = addr6[8] ^ 0x2;
24 + mac[1] = addr6[9];
25 + mac[2] = addr6[10];
26 + mac[3] = addr6[13];
27 + mac[4] = addr6[14];
28 + mac[5]= addr6[15];
29 +#else
30 /* Receiving a packet from a host does not populate the neighbour
31 cache, so we send a neighbour discovery request if we can't
32 find the sender. Repeat a few times in case of packet loss. */
33 @@ -301,6 +318,7 @@ void get_client_mac(struct in6_addr *client, int iface, unsigned char *mac, unsi
35 *maclenp = maclen;
36 *mactypep = ARPHRD_ETHER;
37 +#endif /* HAVE_SOLARIS_NETWORK */
40 static int complete_context6(struct in6_addr *local, int prefix,