[ovs-dev] [PATCH] OVN: select a random mac_prefix if not provided

Ben Pfaff blp at ovn.org
Fri Feb 22 18:25:55 UTC 2019


On Wed, Feb 20, 2019 at 04:53:45PM +0100, Lorenzo Bianconi wrote:
> Select a random IPAM mac_prefix if it has not been provided by the user.
> With this patch the admin can avoid to configure mac_prefix in order to
> avoid L2 address collisions if multiple OVN deployments share the same
> broadcast domain.
> Remove MAC_ADDR_PREFIX definitions/occurrences since now mac_prefix is
> always provided to ovn-northd
> 
> Tested-by: Miguel Duarte de Mora Barroso <mdbarroso at redhat.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>

It's really not a good idea to modify an idl object in-place like this.
That's why they're all 'const'!  The IDL doesn't expect this kind of
thing and if it's not causing trouble now it could easily do so later:
> +    } else {
> +        eth_addr_random(&mac_prefix);
> +        memset(&mac_prefix.ea[3], 0, 3);
> +
> +        char *addr_prefix = xasprintf(ETH_ADDR_FMT, ETH_ADDR_ARGS(mac_prefix));
> +        smap_add((struct smap *)&nb->options, "mac_prefix", addr_prefix);
> +        nbrec_nb_global_set_options(nb, &nb->options);
> +        free(addr_prefix);
>      }



More information about the dev mailing list