[ovs-dev] [PATCH v4] OVN: select a random mac_prefix if not provided
Ben Pfaff
blp at ovn.org
Tue Mar 5 23:49:50 UTC 2019
On Tue, Mar 05, 2019 at 02:22:50PM +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
>
> Acked-by: Numan Siddique <nusiddiq at redhat.com>
> Tested-by: Miguel Duarte de Mora Barroso <mdbarroso at redhat.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
Thanks.
I applied this to master. I folded in the following incremental to save
a string copy and free.
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 69c33ad9f20d..3661681dc33b 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -7291,14 +7291,13 @@ ovnnb_db_run(struct northd_context *ctx,
eth_addr_random(&mac_prefix);
memset(&mac_prefix.ea[3], 0, 3);
- char *addr_prefix = xasprintf("%02"PRIx8":%02"PRIx8":%02"PRIx8,
- mac_prefix.ea[0], mac_prefix.ea[1],
- mac_prefix.ea[2]);
- smap_add(&options, "mac_prefix", addr_prefix);
+ smap_add_format(&options, "mac_prefix",
+ "%02"PRIx8":%02"PRIx8":%02"PRIx8,
+ mac_prefix.ea[0], mac_prefix.ea[1], mac_prefix.ea[2]);
+ nbrec_nb_global_verify_options(nb);
nbrec_nb_global_set_options(nb, &options);
smap_destroy(&options);
- free(addr_prefix);
}
cleanup_macam(&macam);
More information about the dev
mailing list