aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2016-08-02 19:32:25 +0200
committerFilip Tehlar <ftehlar@cisco.com>2016-08-02 19:48:09 +0200
commit5ca5dc865143f226e5b6dae002439273856bd88a (patch)
tree2ff30d4b56c7af75801360fe9838cdfe5a08f0a9
parent8e5458caea3f58664dd001d65bbda5e12482a8ae (diff)
API support for src/dst based routing policy in LISP
Change-Id: I0ae90f884378acabeda310a6431c89f3ec195d0e Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--vnet/vnet/lisp-cp/control.c45
-rw-r--r--vpp/vpp-api/vpe.api9
2 files changed, 22 insertions, 32 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c
index b2a009e5f46..9b86da5c8f1 100644
--- a/vnet/vnet/lisp-cp/control.c
+++ b/vnet/vnet/lisp-cp/control.c
@@ -533,8 +533,6 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input,
unformat_input_t _line_input, * line_input = &_line_input;
u8 is_add = 1;
gid_address_t eid;
- ip_prefix_t * prefp = &gid_address_ippref(&eid);
- u8 * mac = gid_address_mac(&eid);
gid_address_t * eids = 0;
clib_error_t * error = 0;
u8 * locator_set_name = 0;
@@ -545,6 +543,8 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input,
u32 vni = 0;
memset (&eid, 0, sizeof (eid));
+ memset (a, 0, sizeof (*a));
+
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -555,18 +555,10 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input,
is_add = 1;
else if (unformat (line_input, "del"))
is_add = 0;
+ else if (unformat (line_input, "eid %U", unformat_gid_address, &eid))
+ ;
else if (unformat (line_input, "vni %d", &vni))
gid_address_vni (&eid) = vni;
- else if (unformat (line_input, "eid %U", unformat_ip_prefix, prefp))
- {
- gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
- vec_add1(eids, eid);
- }
- else if (unformat (line_input, "eid %U", unformat_mac_address, mac))
- {
- gid_address_type (&eid) = GID_ADDR_MAC;
- vec_add1(eids, eid);
- }
else if (unformat (line_input, "locator-set %_%v%_", &locator_set_name))
{
p = hash_get_mem(lcm->locator_set_index_by_name, locator_set_name);
@@ -586,7 +578,13 @@ lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input,
}
/* XXX treat batch configuration */
- a->eid = eid;
+ if (GID_ADDR_SRC_DST == gid_address_type(&eid))
+ {
+ error = clib_error_return(0, "src/dst is not supported for local EIDs!");
+ goto done;
+ }
+
+ gid_address_copy(&a->eid, &eid);
a->is_add = is_add;
a->locator_set_index = locator_set_index;
a->local = 1;
@@ -967,9 +965,7 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
unformat_input_t _line_input, * line_input = &_line_input;
u8 is_add = 1, del_all = 0;
locator_t rloc, * rlocs = 0, * curr_rloc = 0;
- ip_prefix_t * eid_ippref;
gid_address_t eid;
- u8 * dmac = gid_address_mac (&eid);
u8 eid_set = 0;
u32 vni, action = ~0, p, w;
int rv;
@@ -981,8 +977,6 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
memset(&eid, 0, sizeof(eid));
memset(&rloc, 0, sizeof(rloc));
- eid_ippref = &gid_address_ippref(&eid);
-
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "del-all"))
@@ -991,18 +985,8 @@ lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
is_add = 0;
else if (unformat (line_input, "add"))
;
- else if (unformat (line_input, "eid %U",
- unformat_ip_prefix, eid_ippref))
- {
- gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
- eid_set = 1;
- }
- else if (unformat (line_input, "eid %U",
- unformat_mac_address, dmac))
- {
- gid_address_type (&eid) = GID_ADDR_MAC;
- eid_set = 1;
- }
+ else if (unformat (line_input, "%U", unformat_gid_address, &eid))
+ eid_set = 1;
else if (unformat (line_input, "vni %u", &vni))
{
gid_address_vni (&eid) = vni;
@@ -1086,7 +1070,8 @@ VLIB_CLI_COMMAND (lisp_add_del_remote_mapping_command) = {
.path = "lisp remote-mapping",
.short_help = "lisp remote-mapping add|del [del-all] vni <vni> "
"eid <est-eid> [action <no-action|natively-forward|"
- "send-map-request|drop>] rloc <dst-locator> [rloc <dst-locator> ... ]",
+ "send-map-request|drop>] rloc <dst-locator> p <prio> w <weight> "
+ "[rloc <dst-locator> ... ]",
.function = lisp_add_del_remote_mapping_command_fn,
};
diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api
index ba7572bcc8c..3e4b933b43d 100644
--- a/vpp/vpp-api/vpe.api
+++ b/vpp/vpp-api/vpe.api
@@ -2405,6 +2405,7 @@ define lisp_pitr_set_locator_set_reply {
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param is_add - add address if non-zero, else delete
+ @param is_src_dst - flag indicating src/dst based routing policy
@param del_all - if set, delete all remote mappings
@param vni - virtual network instance
@param action - negative map-reply action
@@ -2412,7 +2413,8 @@ define lisp_pitr_set_locator_set_reply {
0 : ipv4
1 : ipv6
2 : mac
- @param eid - EID
+ @param deid - dst EID
+ @param seid - src EID, valid only if is_src_dst is enabled
@param rloc_num - number of remote locators
@param rlocs - remote locator data
*/
@@ -2420,14 +2422,17 @@ define lisp_add_del_remote_mapping {
u32 client_index;
u32 context;
u8 is_add;
+ u8 is_src_dst;
u8 del_all;
u32 vni;
u8 action;
u8 eid_type;
u8 eid[16];
u8 eid_len;
+ u8 seid[16];
+ u8 seid_len;
u32 rloc_num;
- u8 rlocs[0];
+ u8 rlocs[rloc_num];
};
/** \brief Reply for lisp_add_del_remote_mapping