From 0a8840df8ea6d4936d080c111f2b361f575a773d Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Mon, 16 Oct 2017 05:48:23 -0700 Subject: LISP: add P-ITR/P-ETR/xTR API handlers, ONE-24 Change-Id: I25937cd7470c826d1e833e65530ae959c39139d8 Signed-off-by: Filip Tehlar --- src/vnet/lisp-gpe/interface.c | 10 +++++++--- src/vnet/lisp-gpe/lisp_gpe.h | 3 ++- src/vnet/lisp-gpe/lisp_gpe_api.c | 2 +- src/vnet/lisp-gpe/lisp_gpe_sub_interface.c | 3 ++- src/vnet/lisp-gpe/lisp_gpe_tenant.c | 7 +++++-- src/vnet/lisp-gpe/lisp_gpe_tenant.h | 3 ++- 6 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/vnet/lisp-gpe') diff --git a/src/vnet/lisp-gpe/interface.c b/src/vnet/lisp-gpe/interface.c index a0c05e85682..84933ec3987 100644 --- a/src/vnet/lisp-gpe/interface.c +++ b/src/vnet/lisp-gpe/interface.c @@ -575,7 +575,8 @@ lisp_gpe_tenant_add_default_routes (u32 table_id) * @return number of vectors in frame. */ u32 -lisp_gpe_add_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 table_id) +lisp_gpe_add_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 table_id, + u8 with_default_routes) { vnet_main_t *vnm = lgm->vnet_main; tunnel_lookup_t *l3_ifaces = &lgm->l3_ifaces; @@ -603,7 +604,8 @@ lisp_gpe_add_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 table_id) /* insert default routes that point to lisp-cp lookup */ lisp_gpe_iface_set_table (hi->sw_if_index, table_id); - lisp_gpe_tenant_add_default_routes (table_id); + if (with_default_routes) + lisp_gpe_tenant_add_default_routes (table_id); /* enable interface */ vnet_sw_interface_set_flags (vnm, hi->sw_if_index, @@ -908,7 +910,9 @@ lisp_gpe_add_del_iface_command_fn (vlib_main_t * vm, unformat_input_t * input, { if (is_add) { - if (~0 == lisp_gpe_tenant_l3_iface_add_or_lock (vni, table_id)) + if (~0 == lisp_gpe_tenant_l3_iface_add_or_lock (vni, table_id, 1 + /* with_default_route */ + )) { error = clib_error_return (0, "L3 interface not created"); goto done; diff --git a/src/vnet/lisp-gpe/lisp_gpe.h b/src/vnet/lisp-gpe/lisp_gpe.h index fe51ed06eb1..f1fa7715820 100644 --- a/src/vnet/lisp-gpe/lisp_gpe.h +++ b/src/vnet/lisp-gpe/lisp_gpe.h @@ -203,7 +203,8 @@ lisp_gpe_l3_iface_find_or_create (lisp_gpe_main_t * lgm, extern void lisp_gpe_del_l2_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id); extern u32 lisp_gpe_add_l2_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id); extern void lisp_gpe_del_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id); -extern u32 lisp_gpe_add_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id); +extern u32 lisp_gpe_add_l3_iface (lisp_gpe_main_t * lgm, u32 vni, u32 bd_id, + u8 with_default_route); typedef struct diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c index 4367a7194d9..4ed480c4fd8 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_api.c +++ b/src/vnet/lisp-gpe/lisp_gpe_api.c @@ -405,7 +405,7 @@ vl_api_gpe_add_del_iface_t_handler (vl_api_gpe_add_del_iface_t * mp) { if (mp->is_add) { - if (~0 == lisp_gpe_tenant_l3_iface_add_or_lock (vni, dp_table)) + if (~0 == lisp_gpe_tenant_l3_iface_add_or_lock (vni, dp_table, 1)) rv = 1; } else diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c index 6e145f527fb..3f56dbea08d 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c +++ b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c @@ -135,7 +135,8 @@ lisp_gpe_sub_interface_find_or_create_and_lock (const ip_address_t * lrloc, * find the main interface from the VNI */ main_sw_if_index = - lisp_gpe_tenant_l3_iface_add_or_lock (vni, overlay_table_id); + lisp_gpe_tenant_l3_iface_add_or_lock (vni, overlay_table_id, + 1 /* with_default_route */ ); vnet_sw_interface_t sub_itf_template = { .type = VNET_SW_INTERFACE_TYPE_SUB, diff --git a/src/vnet/lisp-gpe/lisp_gpe_tenant.c b/src/vnet/lisp-gpe/lisp_gpe_tenant.c index 2c77739edc8..814b0d316cb 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_tenant.c +++ b/src/vnet/lisp-gpe/lisp_gpe_tenant.c @@ -102,11 +102,13 @@ lisp_gpe_tenant_delete_if_empty (lisp_gpe_tenant_t * lt) * * @paran vni The tenant's VNI * @param table_id the Tenant's L3 table ID. + * @param with_default_route Install default route for the interface * * @return the SW IF index of the L3 interface */ u32 -lisp_gpe_tenant_l3_iface_add_or_lock (u32 vni, u32 table_id) +lisp_gpe_tenant_l3_iface_add_or_lock (u32 vni, u32 table_id, + u8 with_default_route) { lisp_gpe_tenant_t *lt; @@ -121,7 +123,8 @@ lisp_gpe_tenant_l3_iface_add_or_lock (u32 vni, u32 table_id) { /* create the l3 interface since there are currently no users of it */ lt->lt_l3_sw_if_index = - lisp_gpe_add_l3_iface (&lisp_gpe_main, vni, table_id); + lisp_gpe_add_l3_iface (&lisp_gpe_main, vni, table_id, + with_default_route); } lt->lt_locks[LISP_GPE_TENANT_LOCK_L3_IFACE]++; diff --git a/src/vnet/lisp-gpe/lisp_gpe_tenant.h b/src/vnet/lisp-gpe/lisp_gpe_tenant.h index 5db7dde833b..a9271da91f5 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_tenant.h +++ b/src/vnet/lisp-gpe/lisp_gpe_tenant.h @@ -67,7 +67,8 @@ typedef struct lisp_gpe_tenant_t_ extern u32 lisp_gpe_tenant_find_or_create (u32 vni); -extern u32 lisp_gpe_tenant_l3_iface_add_or_lock (u32 vni, u32 vrf); +extern u32 lisp_gpe_tenant_l3_iface_add_or_lock (u32 vni, u32 vrf, + u8 with_default_route); extern void lisp_gpe_tenant_l3_iface_unlock (u32 vni); extern u32 lisp_gpe_tenant_l2_iface_add_or_lock (u32 vni, u32 vrf); -- cgit 1.2.3-korg