summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2016-07-07 15:40:36 +0200
committerFlorin Coras <florin.coras@gmail.com>2016-07-08 14:15:37 +0000
commit4d5cabde54f847bccd365c64682e428aead30550 (patch)
tree141d2eec6d5037689248da577db868f39afa38b9 /vnet
parentbbae375ca20df350b26bb97cbe63835661379457 (diff)
Add locator prority and weight to LISP API
Change-Id: Ifa9bcd9a9c5dbda00ff8096909ccbc822445b8cb Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/lisp-cp/control.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c
index f536560eae9..c4cdaa98c17 100644
--- a/vnet/vnet/lisp-cp/control.c
+++ b/vnet/vnet/lisp-cp/control.c
@@ -918,14 +918,14 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
clib_error_t * error = 0;
unformat_input_t _line_input, * line_input = &_line_input;
u8 is_add = 1, del_all = 0;
- locator_t rloc, * rlocs = 0;
+ locator_t rloc, * rlocs = 0, * curr_rloc = 0;
ip_prefix_t * deid_ippref, * seid_ippref;
gid_address_t seid, deid;
u8 * dmac = gid_address_mac (&deid);
u8 * smac = gid_address_mac (&seid);
u8 deid_set = 0, seid_set = 0;
u8 * s = 0;
- u32 vni, action = ~0;
+ u32 vni, action = ~0, p, w;
int rv;
/* Get a line of input. */
@@ -976,8 +976,22 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
gid_address_type (&seid) = GID_ADDR_MAC;
seid_set = 1;
}
- else if (unformat (line_input, "rloc %U", unformat_ip_address, &rloc.address))
- vec_add1 (rlocs, rloc);
+ else if (unformat (line_input, "p %d w %d", &p, &w))
+ {
+ if (!curr_rloc)
+ {
+ clib_warning ("No RLOC configured for setting priority/weight!");
+ goto done;
+ }
+ curr_rloc->priority = p;
+ curr_rloc->weight = w;
+ }
+ else if (unformat (line_input, "rloc %U", unformat_ip_address,
+ &rloc.address))
+ {
+ vec_add1 (rlocs, rloc);
+ curr_rloc = &rlocs[vec_len (rlocs) - 1];
+ }
else if (unformat (line_input, "action %s", &s))
{
if (!strcmp ((char *)s, "no-action"))
@@ -1062,6 +1076,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
clib_warning("failed to %s remote mapping!", is_add ? "add" : "delete");
done:
+ vec_free (rlocs);
unformat_free (line_input);
if (s)
vec_free (s);
@@ -2073,7 +2088,7 @@ lisp_cp_show_locator_sets_command_fn (vlib_main_t * vm,
loc->weight);
else
msg = format (msg, "%16U%16d%16d\n", format_ip_address,
- gid_address_ip(&loc->address), loc->priority,
+ &gid_address_ip(&loc->address), loc->priority,
loc->weight);
next_line = 1;
}