components/dnsmasq/patches/03_client_mac.patch
branchs11u2-sru
changeset 4156 4b1def16fe9b
equal deleted inserted replaced
4146:097063f324c0 4156:4b1def16fe9b
       
     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.
       
     4 
       
     5 
       
     6 *** dnsmasq-2.68/src/dhcp6.c	2013-12-08 07:58:29.000000000 -0800
       
     7 --- NEW/src/dhcp6.c	2015-02-23 18:33:30.937299563 -0800
       
     8 ***************
       
     9 *** 231,236 ****
       
    10 --- 231,253 ----
       
    11   
       
    12   void get_client_mac(struct in6_addr *client, int iface, unsigned char *mac, unsigned int *maclenp, unsigned int *mactypep)
       
    13   {
       
    14 + #ifdef HAVE_SOLARIS_NETWORK
       
    15 + /* Solaris does not have an easy way to retrieve MAC address for a given IPv6 address from the kernel.
       
    16 +    For now the following workaround should work for OpenStack's needs. */
       
    17 +   uint8_t *addr6;
       
    18 + 
       
    19 +   *maclenp = ETHER_ADDR_LEN;
       
    20 +   *mactypep = ARPHRD_ETHER;
       
    21 +   /* Take the EUI64 based client's link-local address and convert it to client's MAC address.
       
    22 +      For example: from fe80::f816:3eff:fe5c:df43 link-local address we arrive at fa:16:3e:5c:df:43 */
       
    23 +   addr6 = client->s6_addr;
       
    24 +   mac[0] = addr6[8] ^ 0x2;
       
    25 +   mac[1] = addr6[9];
       
    26 +   mac[2] = addr6[10];
       
    27 +   mac[3] = addr6[13];
       
    28 +   mac[4] = addr6[14];
       
    29 +   mac[5]= addr6[15];
       
    30 + #else
       
    31     /* Recieving a packet from a host does not populate the neighbour
       
    32        cache, so we send a neighbour discovery request if we can't 
       
    33        find the sender. Repeat a few times in case of packet loss. */
       
    34 ***************
       
    35 *** 276,281 ****
       
    36 --- 293,299 ----
       
    37   
       
    38     *maclenp = mac_param.maclen;
       
    39     *mactypep = ARPHRD_ETHER;
       
    40 + #endif /* HAVE_SOLARIS_NETWORK */
       
    41   }
       
    42       
       
    43   static int find_mac(int family, char *addrp, char *mac, size_t maclen, void *parmv)