summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
0977e4b)
Lisp enable flag is enforced. DP API should not be call if the dp is disable.
Change-Id: I265cf3ea0460987f3fd5fd84b43127dd3b1c43c3
Signed-off-by: Andrej Kozemcak <akozemca@cisco.com>
_(ALREADY_CONNECTED, -86, "Connection to the data plane already exists") \
_(UNSUPPORTED_JNI_VERSION, -87, "Unsupported JNI version") \
_(FAILED_TO_ATTACH_TO_JAVA_THREAD, -88, "Failed to attach to Java thread") \
_(ALREADY_CONNECTED, -86, "Connection to the data plane already exists") \
_(UNSUPPORTED_JNI_VERSION, -87, "Unsupported JNI version") \
_(FAILED_TO_ATTACH_TO_JAVA_THREAD, -88, "Failed to attach to Java thread") \
-_(INVALID_WORKER, -89, "Invalid worker thread")
+_(INVALID_WORKER, -89, "Invalid worker thread") \
+_(LISP_DISABLED, -90, "LISP is disabled")
typedef enum {
#define _(a,b,c) VNET_API_ERROR_##a = (b),
typedef enum {
#define _(a,b,c) VNET_API_ERROR_##a = (b),
vnet_lisp_gpe_add_del_iface_args_t _ai, *ai = &_ai;
lisp_cp_main_t * lcm = vnet_lisp_cp_get_main ();
vnet_lisp_gpe_add_del_iface_args_t _ai, *ai = &_ai;
lisp_cp_main_t * lcm = vnet_lisp_cp_get_main ();
+ if (vnet_lisp_enable_disable_status () == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
vni = gid_address_vni(&a->deid);
/* store/remove mapping from map-cache */
vni = gid_address_vni(&a->deid);
/* store/remove mapping from map-cache */
u32 locator_set_index = 0, map_index = 0;
uword * p;
vnet_lisp_add_del_mapping_args_t _a, * a = &_a;
u32 locator_set_index = 0, map_index = 0;
uword * p;
vnet_lisp_add_del_mapping_args_t _a, * a = &_a;
gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
a->locator_set_index = locator_set_index;
a->local = 1;
a->locator_set_index = locator_set_index;
a->local = 1;
- vnet_lisp_add_del_local_mapping (a, &map_index);
+ rv = vnet_lisp_add_del_local_mapping (a, &map_index);
+ if (0 != rv)
+ {
+ error = clib_error_return(0, "failed to %s eid-table!",
+ is_add ? "add" : "delete");
+ }
done:
vec_free(eids);
if (locator_set_name)
done:
vec_free(eids);
if (locator_set_name)
ip_address_t * dl;
int rc = -1;
ip_address_t * dl;
int rc = -1;
+ if (vnet_lisp_enable_disable_status() == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
if (del_all)
return vnet_lisp_clear_all_remote_mappings ();
if (del_all)
return vnet_lisp_clear_all_remote_mappings ();
mapping_t * m;
uword * p;
mapping_t * m;
uword * p;
+ if (vnet_lisp_enable_disable_status () == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
p = hash_get_mem (lcm->locator_set_index_by_name, locator_set_name);
if (!p)
{
p = hash_get_mem (lcm->locator_set_index_by_name, locator_set_name);
if (!p)
{
u8 * locator_set_name = 0;
u8 is_add = 1;
unformat_input_t _line_input, * line_input = &_line_input;
u8 * locator_set_name = 0;
u8 is_add = 1;
unformat_input_t _line_input, * line_input = &_line_input;
+ clib_error_t * error = 0;
+ int rv = 0;
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
clib_warning ("No locator set specified!");
goto done;
}
clib_warning ("No locator set specified!");
goto done;
}
- vnet_lisp_pitr_set_locator_set (locator_set_name, is_add);
+ rv = vnet_lisp_pitr_set_locator_set (locator_set_name, is_add);
+ if (0 != rv)
+ {
+ error = clib_error_return(0, "failed to %s pitr!",
+ is_add ? "add" : "delete");
+ }
done:
if (locator_set_name)
vec_free (locator_set_name);
done:
if (locator_set_name)
vec_free (locator_set_name);
}
VLIB_CLI_COMMAND (lisp_pitr_set_locator_set_command) = {
}
VLIB_CLI_COMMAND (lisp_pitr_set_locator_set_command) = {
+ if (vnet_lisp_enable_disable_status () == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
p = get_locator_set_index(a, p);
if (!p)
{
p = get_locator_set_index(a, p);
if (!p)
{
u32 ** eid_indexes;
int ret = 0;
u32 ** eid_indexes;
int ret = 0;
+ if (vnet_lisp_enable_disable_status () == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
if (a->is_add)
{
p = get_locator_set_index(a, p);
if (a->is_add)
{
p = get_locator_set_index(a, p);
locator_t locator, * locators = 0;
vnet_lisp_add_del_locator_set_args_t _a, * a = &_a;
u32 ls_index = 0;
locator_t locator, * locators = 0;
vnet_lisp_add_del_locator_set_args_t _a, * a = &_a;
u32 ls_index = 0;
memset(&locator, 0, sizeof(locator));
memset(a, 0, sizeof(a[0]));
memset(&locator, 0, sizeof(locator));
memset(a, 0, sizeof(a[0]));
a->is_add = is_add;
a->local = 1;
a->is_add = is_add;
a->local = 1;
- vnet_lisp_add_del_locator_set(a, &ls_index);
+ rv = vnet_lisp_add_del_locator_set(a, &ls_index);
+ if (0 != rv)
+ {
+ error = clib_error_return(0, "failed to %s locator-set!",
+ is_add ? "add" : "delete");
+ }
done:
vec_free(locators);
done:
vec_free(locators);
ip_address_t * addr;
u32 i;
ip_address_t * addr;
u32 i;
+ if (vnet_lisp_enable_disable_status () == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
if (a->is_add)
{
vec_foreach(addr, lcm->map_resolvers)
if (a->is_add)
{
vec_foreach(addr, lcm->map_resolvers)
u8 is_add = 1;
ip_address_t ip_addr;
clib_error_t * error = 0;
u8 is_add = 1;
ip_address_t ip_addr;
clib_error_t * error = 0;
vnet_lisp_add_del_map_resolver_args_t _a, * a = &_a;
/* Get a line of input. */
vnet_lisp_add_del_map_resolver_args_t _a, * a = &_a;
/* Get a line of input. */
}
a->is_add = is_add;
a->address = ip_addr;
}
a->is_add = is_add;
a->address = ip_addr;
- vnet_lisp_add_del_map_resolver (a);
+ rv = vnet_lisp_add_del_map_resolver (a);
+ if (0 != rv)
+ {
+ error = clib_error_return(0, "failed to %s map-resolver!",
+ is_add ? "add" : "delete");
+ }
vnet_lisp_gpe_add_del_iface (vnet_lisp_gpe_add_del_iface_args_t * a,
u32 * hw_if_indexp)
{
vnet_lisp_gpe_add_del_iface (vnet_lisp_gpe_add_del_iface_args_t * a,
u32 * hw_if_indexp)
{
u32 hw_if_index = ~0, lookup_next_index4, lookup_next_index6, flen;
uword * hip, * vni;
u32 hw_if_index = ~0, lookup_next_index4, lookup_next_index6, flen;
uword * hip, * vni;
+ if (vnet_lisp_gpe_enable_disable_status() == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
hip = hash_get(lgm->lisp_gpe_hw_if_index_by_table_id, a->table_id);
if (a->is_add)
hip = hash_get(lgm->lisp_gpe_hw_if_index_by_table_id, a->table_id);
if (a->is_add)
if (hip)
{
clib_warning ("Interface for vrf %d already exists", a->table_id);
if (hip)
{
clib_warning ("Interface for vrf %d already exists", a->table_id);
}
/* create hw lisp_gpeX iface if needed, otherwise reuse existing */
}
/* create hw lisp_gpeX iface if needed, otherwise reuse existing */
if (hip == 0)
{
clib_warning("The interface for vrf %d doesn't exist", a->table_id);
if (hip == 0)
{
clib_warning("The interface for vrf %d doesn't exist", a->table_id);
}
hi = vnet_get_hw_interface (vnm, hip[0]);
}
hi = vnet_get_hw_interface (vnm, hip[0]);
add_del_lisp_gpe_default_route (a->table_id, /* is_v4 */1, 0);
add_del_lisp_gpe_default_route (a->table_id, /* is_v4 */0, 0);
}
add_del_lisp_gpe_default_route (a->table_id, /* is_v4 */1, 0);
add_del_lisp_gpe_default_route (a->table_id, /* is_v4 */0, 0);
}
{
unformat_input_t _line_input, * line_input = &_line_input;
u8 is_add = 1;
{
unformat_input_t _line_input, * line_input = &_line_input;
u8 is_add = 1;
+ clib_error_t * error = 0;
+ int rv = 0;
u32 table_id;
vnet_lisp_gpe_add_del_iface_args_t _a, * a = &_a;
u32 table_id;
vnet_lisp_gpe_add_del_iface_args_t _a, * a = &_a;
a->is_add = is_add;
a->table_id = table_id;
a->is_add = is_add;
a->table_id = table_id;
- vnet_lisp_gpe_add_del_iface (a, 0);
- return 0;
+ rv = vnet_lisp_gpe_add_del_iface (a, 0);
+ if (0 != rv)
+ {
+ error = clib_error_return(0, "failed to %s gpe iface!",
+ is_add ? "add" : "delete");
+ }
+
+ return error;
}
VLIB_CLI_COMMAND (add_del_lisp_gpe_iface_command, static) = {
}
VLIB_CLI_COMMAND (add_del_lisp_gpe_iface_command, static) = {
uword * lookup_next_index, * lgpe_sw_if_index, * lnip;
u8 ip_ver;
uword * lookup_next_index, * lgpe_sw_if_index, * lnip;
u8 ip_ver;
+ if (vnet_lisp_gpe_enable_disable_status() == 0)
+ {
+ clib_warning ("LISP is disabled!");
+ return VNET_API_ERROR_LISP_DISABLED;
+ }
+
/* treat negative fwd entries separately */
if (a->is_negative)
return add_del_negative_fwd_entry (lgm, a);
/* treat negative fwd entries separately */
if (a->is_negative)
return add_del_negative_fwd_entry (lgm, a);
gid_address_t * eids = 0, eid;
clib_error_t * error = 0;
u32 i;
gid_address_t * eids = 0, eid;
clib_error_t * error = 0;
u32 i;
prefp = &gid_address_ippref(&eid);
prefp = &gid_address_ippref(&eid);
a.deid = eids[i];
a.slocator = slocators[i];
a.dlocator = dlocators[i];
a.deid = eids[i];
a.slocator = slocators[i];
a.dlocator = dlocators[i];
- vnet_lisp_gpe_add_del_fwd_entry (&a, 0);
+ rv = vnet_lisp_gpe_add_del_fwd_entry (&a, 0);
+ if (0 != rv)
+ {
+ error = clib_error_return(0, "failed to %s gpe maptunnel!",
+ is_add ? "add" : "delete");
+ break;
+ }
u8
vnet_lisp_gpe_enable_disable_status(void);
u8
vnet_lisp_gpe_enable_disable_status(void);
vnet_lisp_gpe_add_del_iface (vnet_lisp_gpe_add_del_iface_args_t *a,
u32 * hw_if_indexp);
vnet_lisp_gpe_add_del_iface (vnet_lisp_gpe_add_del_iface_args_t *a,
u32 * hw_if_indexp);
a->is_add = mp->is_add;
a->table_id = mp->table_id;
a->vni = mp->vni;
a->is_add = mp->is_add;
a->table_id = mp->table_id;
a->vni = mp->vni;
- vnet_lisp_gpe_add_del_iface (a, 0);
+ rv = vnet_lisp_gpe_add_del_iface (a, 0);
REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
}
REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
}