From c86f3e5d2d69b61d67d48a385a4bc21f62de90f1 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 15 Jun 2016 17:13:28 +0200 Subject: Fix remote mapping CLI for unset v6 local eid If when configuring a remote v6 mapping the local eid is not set, configuration fails because the code expects local (default v4) and remote eids to have the same AFI. Change-Id: If791d2e8a104ea36603576f8b2797cc07bc2654b Signed-off-by: Florin Coras --- vnet/vnet/lisp-cp/control.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c index 30d2a1afd41..4f077b2ccc1 100644 --- a/vnet/vnet/lisp-cp/control.c +++ b/vnet/vnet/lisp-cp/control.c @@ -555,7 +555,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, ip_address_t rloc, * rlocs = 0; ip_prefix_t * deid_ippref, * seid_ippref; gid_address_t seid, deid; - u8 deid_set = 0; + u8 deid_set = 0, seid_set = 0; u8 * s = 0; u32 vni, action = ~0; @@ -592,7 +592,9 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, } else if (unformat (line_input, "seid %U", unformat_ip_prefix, seid_ippref)) - ; + { + seid_set = 1; + } else if (unformat (line_input, "rloc %U", unformat_ip_address, &rloc)) vec_add1 (rlocs, rloc); else if (unformat (line_input, "action %s", &s)) @@ -626,9 +628,14 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm, goto done; } - if (is_add - && (ip_prefix_version (deid_ippref) - != ip_prefix_version (seid_ippref))) + /* if seid not set, make sure the ip version is the same as that of the + * deid. This ensures the seid to be configured will be either 0/0 or + * ::/0 */ + if (!seid_set) + ip_prefix_version(seid_ippref) = ip_prefix_version(deid_ippref); + + if (is_add && + (ip_prefix_version (deid_ippref) != ip_prefix_version(seid_ippref))) { clib_warning ("source and destination EIDs are not" " in the same IP family!"); -- cgit 1.2.3-korg