[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 2/2] libxl: made vm mac address assignment deterministic



On Wed, Sep 12, 2018 at 05:40:37PM +0000, Joshua Perrett wrote:
[...]
> +int libxl__get_host_mac(libxl__gc *gc, unsigned char *buf)
> +{
> +    int rc = ERROR_FAIL;
> +
> +    struct ifaddrs *iface_list;
> +    uint8_t largest[6] = {0};
> +
> +    if (getifaddrs(&iface_list) == 0) {
> +        for (struct ifaddrs *iface = iface_list;
> +            iface != NULL; iface = iface->ifa_next) {
> +            if (iface->ifa_addr && iface->ifa_addr->sa_family == AF_PACKET) {
> +                struct sockaddr_ll *s = (struct sockaddr_ll 
> *)iface->ifa_addr;
> +                if (s->sll_halen == 6) {
> +                    if (memcmp(s->sll_addr, largest, s->sll_halen) > 0) {
> +                        memcpy(buf, s->sll_addr, s->sll_halen);
> +                        memcpy(largest, s->sll_addr, s->sll_halen);
> +                        rc = 0;

Sorry I didn't participate in the conversation IRL.

What is the resolution here?

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.