vam->result_ready = 1;
}
+static void
+vl_api_cli_inband_reply_t_handler (vl_api_cli_inband_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ vam->retval = retval;
+ vam->cmd_reply = mp->reply;
+ vam->result_ready = 1;
+}
+
+static void
+vl_api_cli_inband_reply_t_handler_json (vl_api_cli_inband_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t node;
+
+ vat_json_init_object (&node);
+ vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+ vat_json_object_add_string_copy (&node, "reply", mp->reply);
+
+ vat_json_print (vam->ofp, &node);
+ vat_json_free (&node);
+
+ vam->retval = ntohl (mp->retval);
+ vam->result_ready = 1;
+}
+
static void vl_api_classify_add_del_table_reply_t_handler
(vl_api_classify_add_del_table_reply_t * mp)
{
/* JSON output not supported */
}
+static void
+vl_api_ip6_nd_event_t_handler (vl_api_ip6_nd_event_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ errmsg ("ip6 nd event: address %U new mac %U sw_if_index %d\n",
+ format_ip6_address, mp->address,
+ format_ethernet_address, mp->new_mac, mp->sw_if_index);
+}
+
+static void
+vl_api_ip6_nd_event_t_handler_json (vl_api_ip6_nd_event_t * mp)
+{
+ /* JSON output not supported */
+}
+
/*
* Special-case: build the bridge domain table, maintain
* the next bd id vbl.
vam->result_ready = 1;
}
+
+static void vl_api_lisp_add_del_locator_set_reply_t_handler
+ (vl_api_lisp_add_del_locator_set_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+}
+
+static void vl_api_lisp_add_del_locator_set_reply_t_handler_json
+ (vl_api_lisp_add_del_locator_set_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t node;
+
+ vat_json_init_object (&node);
+ vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+ vat_json_object_add_uint (&node, "locator_set_index", ntohl (mp->ls_index));
+
+ vat_json_print (vam->ofp, &node);
+ vat_json_free (&node);
+
+ vam->retval = ntohl (mp->retval);
+ vam->result_ready = 1;
+}
+
static void vl_api_vxlan_add_del_tunnel_reply_t_handler
(vl_api_vxlan_add_del_tunnel_reply_t * mp)
{
}
static void
-vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp)
+add_lisp_eid_table_entry (vat_main_t * vam,
+ vl_api_lisp_eid_table_details_t * mp)
{
- vat_main_t *vam = &vat_main;
eid_table_t eid_table;
memset (&eid_table, 0, sizeof (eid_table));
eid_table.is_local = mp->is_local;
- eid_table.locator_set_index = mp->locator_set_index;
+ eid_table.locator_set_index = clib_net_to_host_u32 (mp->locator_set_index);
eid_table.eid_type = mp->eid_type;
- eid_table.vni = mp->vni;
+ eid_table.vni = clib_net_to_host_u32 (mp->vni);
eid_table.eid_prefix_len = mp->eid_prefix_len;
- eid_table.ttl = mp->ttl;
+ eid_table.ttl = clib_net_to_host_u32 (mp->ttl);
+ eid_table.action = mp->action;
eid_table.authoritative = mp->authoritative;
clib_memcpy (eid_table.eid, mp->eid, sizeof (eid_table.eid));
vec_add1 (vam->eid_tables, eid_table);
}
+static void
+vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ add_lisp_eid_table_entry (vam, mp);
+}
+
static void
vl_api_lisp_eid_table_details_t_handler_json (vl_api_lisp_eid_table_details_t
* mp)
{
vat_main_t *vam = &vat_main;
- eid_table_t eid_table;
-
- memset (&eid_table, 0, sizeof (eid_table));
- eid_table.is_local = mp->is_local;
- eid_table.locator_set_index = mp->locator_set_index;
- eid_table.eid_type = mp->eid_type;
- eid_table.vni = mp->vni;
- eid_table.eid_prefix_len = mp->eid_prefix_len;
- eid_table.ttl = mp->ttl;
- eid_table.authoritative = mp->authoritative;
- clib_memcpy (eid_table.eid, mp->eid, sizeof (eid_table.eid));
- vec_add1 (vam->eid_tables, eid_table);
+ add_lisp_eid_table_entry (vam, mp);
}
static void
u8 *line = format (0, "%=10d%=10d",
clib_net_to_host_u32 (mp->vni),
- clib_net_to_host_u32 (mp->vrf));
+ clib_net_to_host_u32 (mp->dp_table));
fformat (vam->ofp, "%v\n", line);
vec_free (line);
}
}
node = vat_json_array_add (&vam->json_tree);
vat_json_init_object (node);
- vat_json_object_add_uint (node, "vrf", clib_net_to_host_u32 (mp->vrf));
+ vat_json_object_add_uint (node, "dp_table",
+ clib_net_to_host_u32 (mp->dp_table));
vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
}
+static void
+ vl_api_lisp_eid_table_vni_details_t_handler
+ (vl_api_lisp_eid_table_vni_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *line = format (0, "%d", clib_net_to_host_u32 (mp->vni));
+ fformat (vam->ofp, "%v\n", line);
+ vec_free (line);
+}
+
+static void
+ vl_api_lisp_eid_table_vni_details_t_handler_json
+ (vl_api_lisp_eid_table_vni_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t *node = NULL;
+
+ if (VAT_JSON_ARRAY != vam->json_tree.type)
+ {
+ ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+ vat_json_init_array (&vam->json_tree);
+ }
+ node = vat_json_array_add (&vam->json_tree);
+ vat_json_init_object (node);
+ vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
+}
static u8 *
format_decap_next (u8 * s, va_list * args)
vat_json_object_add_uint (node, "table_index", ntohl (mp->table_index));
}
+static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler
+ (vl_api_ipsec_gre_add_del_tunnel_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->sw_if_index = ntohl (mp->sw_if_index);
+ vam->result_ready = 1;
+ }
+}
+
+static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler_json
+ (vl_api_ipsec_gre_add_del_tunnel_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t node;
+
+ vat_json_init_object (&node);
+ vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+ vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
+
+ vat_json_print (vam->ofp, &node);
+ vat_json_free (&node);
+
+ vam->retval = ntohl (mp->retval);
+ vam->result_ready = 1;
+}
#define vl_api_vnet_ip4_fib_counters_t_endian vl_noop_handler
#define vl_api_vnet_ip4_fib_counters_t_print vl_noop_handler
_(modify_vhost_user_if_reply) \
_(delete_vhost_user_if_reply) \
_(want_ip4_arp_events_reply) \
+_(want_ip6_nd_events_reply) \
_(input_acl_set_interface_reply) \
_(ipsec_spd_add_del_reply) \
_(ipsec_interface_add_del_spd_reply) \
_(trace_profile_add_reply) \
_(trace_profile_apply_reply) \
_(trace_profile_del_reply) \
-_(lisp_add_del_locator_set_reply) \
_(lisp_add_del_locator_reply) \
_(lisp_add_del_local_eid_reply) \
_(lisp_add_del_remote_mapping_reply) \
_(pg_capture_reply) \
_(pg_enable_disable_reply) \
_(ip_source_and_port_range_check_add_del_reply) \
-_(ip_source_and_port_range_check_interface_add_del_reply)
+_(ip_source_and_port_range_check_interface_add_del_reply)\
+_(delete_subif_reply)
#define _(n) \
static void vl_api_##n##_t_handler \
_(CONTROL_PING_REPLY, control_ping_reply) \
_(NOPRINT_CONTROL_PING_REPLY, noprint_control_ping_reply) \
_(CLI_REPLY, cli_reply) \
+_(CLI_INBAND_REPLY, cli_inband_reply) \
_(SW_INTERFACE_ADD_DEL_ADDRESS_REPLY, \
sw_interface_add_del_address_reply) \
_(SW_INTERFACE_SET_TABLE_REPLY, sw_interface_set_table_reply) \
_(INTERFACE_NAME_RENUMBER_REPLY, interface_name_renumber_reply) \
_(WANT_IP4_ARP_EVENTS_REPLY, want_ip4_arp_events_reply) \
_(IP4_ARP_EVENT, ip4_arp_event) \
+_(WANT_IP6_ND_EVENTS_REPLY, want_ip6_nd_events_reply) \
+_(IP6_ND_EVENT, ip6_nd_event) \
_(INPUT_ACL_SET_INTERFACE_REPLY, input_acl_set_interface_reply) \
_(IP_ADDRESS_DETAILS, ip_address_details) \
_(IP_DETAILS, ip_details) \
_(LISP_LOCATOR_DETAILS, lisp_locator_details) \
_(LISP_EID_TABLE_DETAILS, lisp_eid_table_details) \
_(LISP_EID_TABLE_MAP_DETAILS, lisp_eid_table_map_details) \
+_(LISP_EID_TABLE_VNI_DETAILS, lisp_eid_table_vni_details) \
_(LISP_GPE_TUNNEL_DETAILS, lisp_gpe_tunnel_details) \
_(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details) \
_(SHOW_LISP_STATUS_REPLY, show_lisp_status_reply) \
_(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY, \
ip_source_and_port_range_check_add_del_reply) \
_(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY, \
- ip_source_and_port_range_check_interface_add_del_reply)
+ ip_source_and_port_range_check_interface_add_del_reply) \
+_(IPSEC_GRE_ADD_DEL_TUNNEL_REPLY, ipsec_gre_add_del_tunnel_reply) \
+_(IPSEC_GRE_TUNNEL_DETAILS, ipsec_gre_tunnel_details) \
+_(DELETE_SUBIF_REPLY, delete_subif_reply)
/* M: construct, but don't yet send a message */
fformat (vam->ofp, "%-12s\n", "sw_if_index");
- if (0 == vam)
- {
- return 0;
- }
-
vec_foreach (det, vam->ip_details_by_sw_if_index[is_ipv6])
{
i++;
return -99;
}
+/*
+ * Future replacement of exec() that passes CLI buffers directly in
+ * the API messages instead of an additional shared memory area.
+ */
+static int
+exec_inband (vat_main_t * vam)
+{
+ vl_api_cli_inband_t *mp;
+ f64 timeout;
+ unformat_input_t *i = vam->input;
+
+ if (vec_len (i->buffer) == 0)
+ return -1;
+
+ if (vam->exec_mode == 0 && unformat (i, "mode"))
+ {
+ vam->exec_mode = 1;
+ return 0;
+ }
+ if (vam->exec_mode == 1 && (unformat (i, "exit") || unformat (i, "quit")))
+ {
+ vam->exec_mode = 0;
+ return 0;
+ }
+
+ /*
+ * In order for the CLI command to work, it
+ * must be a vector ending in \n, not a C-string ending
+ * in \n\0.
+ */
+ u32 len = vec_len (vam->input->buffer);
+ M2 (CLI_INBAND, cli_inband, len);
+ clib_memcpy (mp->cmd, vam->input->buffer, len);
+ mp->length = htonl (len);
+
+ S;
+ W2 (fformat (vam->ofp, "%s", vam->cmd_reply));
+}
+
static int
api_create_loopback (vat_main_t * vam)
{
vl_api_sw_interface_set_unnumbered_t *mp;
f64 timeout;
u32 sw_if_index;
- u32 unnum_sw_index;
+ u32 unnum_sw_index = ~0;
u8 is_add = 1;
u8 sw_if_index_set = 0;
if (l2 == 0)
vec_validate (l2, 13);
mask = l2;
- vec_append (mask, l3);
- vec_free (l3);
+ if (vec_len (l3))
+ {
+ vec_append (mask, l3);
+ vec_free (l3);
+ }
}
/* Scan forward looking for the first significant mask octet */
u32 tmp;
#define _(n,N) \
- if (unformat (input, #n)) { next_index = L2_CLASSIFY_NEXT_##N; goto out;}
+ if (unformat (input, #n)) { next_index = L2_INPUT_CLASSIFY_NEXT_##N; goto out;}
foreach_l2_next;
#undef _
ip6_header_t *ip;
int version = 0;
u32 version_val;
- u8 traffic_class;
- u32 traffic_class_val;
- u8 flow_label;
+ u8 traffic_class = 0;
+ u32 traffic_class_val = 0;
+ u8 flow_label = 0;
u8 flow_label_val;
int src = 0, dst = 0;
ip6_address_t src_val, dst_val;
if (l2 == 0)
vec_validate_aligned (l2, 13, sizeof (u32x4));
match = l2;
- vec_append_aligned (match, l3, sizeof (u32x4));
- vec_free (l3);
+ if (vec_len (l3))
+ {
+ vec_append_aligned (match, l3, sizeof (u32x4));
+ vec_free (l3);
+ }
}
/* Make sure the vector is big enough even if key is all 0's */
u32 ip4_table_index = ~0;
u32 ip6_table_index = ~0;
u32 other_table_index = ~0;
+ u32 is_input = 1;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
;
else if (unformat (i, "other-table %d", &other_table_index))
;
+ else if (unformat (i, "is-input %d", &is_input))
+ ;
else
{
clib_warning ("parse error '%U'", format_unformat_error, i);
mp->ip4_table_index = ntohl (ip4_table_index);
mp->ip6_table_index = ntohl (ip6_table_index);
mp->other_table_index = ntohl (other_table_index);
-
+ mp->is_input = (u8) is_input;
S;
W;
W;
}
+static int
+api_want_ip6_nd_events (vat_main_t * vam)
+{
+ unformat_input_t *line_input = vam->input;
+ vl_api_want_ip6_nd_events_t *mp;
+ f64 timeout;
+ ip6_address_t address;
+ int address_set = 0;
+ u32 enable_disable = 1;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "address %U", unformat_ip6_address, &address))
+ address_set = 1;
+ else if (unformat (line_input, "del"))
+ enable_disable = 0;
+ else
+ break;
+ }
+
+ if (address_set == 0)
+ {
+ errmsg ("missing addresses\n");
+ return -99;
+ }
+
+ M (WANT_IP6_ND_EVENTS, want_ip6_nd_events);
+ mp->enable_disable = enable_disable;
+ mp->pid = getpid ();
+ clib_memcpy (mp->address, &address, sizeof (ip6_address_t));
+
+ S;
+ W;
+}
+
static int
api_input_acl_set_interface (vat_main_t * vam)
{
vl_api_ipsec_spd_add_del_entry_t *mp;
f64 timeout;
u8 is_add = 1, is_outbound = 0, is_ipv6 = 0, is_ip_any = 1;
- u32 spd_id, sa_id, protocol = 0, policy = 0;
- i32 priority;
+ u32 spd_id = 0, sa_id = 0, protocol = 0, policy = 0;
+ i32 priority = 0;
u32 rport_start = 0, rport_stop = (u32) ~ 0;
u32 lport_start = 0, lport_stop = (u32) ~ 0;
ip4_address_t laddr4_start, laddr4_stop, raddr4_start, raddr4_stop;
unformat_input_t *i = vam->input;
vl_api_ipsec_sad_add_del_entry_t *mp;
f64 timeout;
- u32 sad_id, spi;
+ u32 sad_id = 0, spi = 0;
u8 *ck = 0, *ik = 0;
u8 is_add = 1;
if (mp->integrity_key_length > sizeof (mp->integrity_key))
mp->integrity_key_length = sizeof (mp->integrity_key);
- clib_memcpy (mp->crypto_key, ck, mp->crypto_key_length);
- clib_memcpy (mp->integrity_key, ik, mp->integrity_key_length);
+ if (ck)
+ clib_memcpy (mp->crypto_key, ck, mp->crypto_key_length);
+ if (ik)
+ clib_memcpy (mp->integrity_key, ik, mp->integrity_key_length);
if (is_tunnel)
{
if (mp->integrity_key_length > sizeof (mp->integrity_key))
mp->integrity_key_length = sizeof (mp->integrity_key);
- clib_memcpy (mp->crypto_key, ck, mp->crypto_key_length);
- clib_memcpy (mp->integrity_key, ik, mp->integrity_key_length);
+ if (ck)
+ clib_memcpy (mp->crypto_key, ck, mp->crypto_key_length);
+ if (ik)
+ clib_memcpy (mp->integrity_key, ik, mp->integrity_key_length);
S;
W;
ip6_address_t ip6_prefix;
ip6_address_t ip6_src;
u32 num_m_args = 0;
- u32 ip6_prefix_len, ip4_prefix_len, ea_bits_len, psid_offset, psid_length;
+ u32 ip6_prefix_len = 0, ip4_prefix_len = 0, ea_bits_len = 0, psid_offset =
+ 0, psid_length = 0;
u8 is_translation = 0;
u32 mtu = 0;
- u8 ip6_src_len = 128;
+ u32 ip6_src_len = 128;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
}
}
- if (num_m_args != 6)
+ if (num_m_args < 3)
{
errmsg ("mandatory argument(s) missing\n");
return -99;
f64 timeout;
u8 is_add = 1;
ip6_address_t ip6_dst;
- u32 num_m_args = 0, index, psid;
+ u32 num_m_args = 0, index, psid = 0;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
f64 timeout;
u32 sw_if_index = ~0;
u8 ip4 = 0, ip6 = 0, default_cop = 0;
- u32 fib_id;
+ u32 fib_id = 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
vec_len (locator_set_name));
vec_free (locator_set_name);
- mp->locator_num = vec_len (locators);
- clib_memcpy (mp->locators, locators,
- (sizeof (ls_locator_t) * vec_len (locators)));
+ mp->locator_num = clib_host_to_net_u32 (vec_len (locators));
+ if (locators)
+ clib_memcpy (mp->locators, locators,
+ (sizeof (ls_locator_t) * vec_len (locators)));
vec_free (locators);
/* send it... */
ip6_address_t rmt_rloc6, lcl_rloc6;
rloc_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc = 0;
- memset(&rloc, 0, sizeof(rloc));
+ memset (&rloc, 0, sizeof (rloc));
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
return -99;
}
- if (0 == rmt_locs && (u32) ~0 == action)
+ if (0 == rmt_locs && (u32) ~ 0 == action)
{
errmsg ("action not set for negative mapping\n");
return -99;
if (0 != rmt_locs && 0 != lcl_locs)
{
- mp->loc_num = vec_len(rmt_locs);
+ mp->loc_num = vec_len (rmt_locs);
clib_memcpy (mp->lcl_locs, lcl_locs,
- (sizeof(rloc_t) * vec_len(lcl_locs)));
+ (sizeof (rloc_t) * vec_len (lcl_locs)));
clib_memcpy (mp->rmt_locs, rmt_locs,
- (sizeof(rloc_t) * vec_len(rmt_locs)));
+ (sizeof (rloc_t) * vec_len (rmt_locs)));
}
vec_free (lcl_locs);
vec_free (rmt_locs);
return -99;
}
+ if (vrf_set && bd_index_set)
+ {
+ errmsg ("error: both vrf and bd entered!");
+ return -99;
+ }
+
M (LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map);
mp->is_add = is_add;
mp->vni = htonl (vni);
- mp->dp_table = htonl (vrf);
+ mp->dp_table = vrf_set ? htonl (vrf) : htonl (bd_index);
mp->is_l2 = bd_index_set;
/* send */
ip6_address_t rloc6;
rloc_t *rlocs = 0, rloc, *curr_rloc = 0;
+ memset (&rloc, 0, sizeof (rloc));
+
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
mp->eid_type = eid->type;
lisp_eid_put_vat (mp->eid, eid->addr, eid->type);
- mp->rloc_num = vec_len (rlocs);
+ mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs)));
vec_free (rlocs);
vl_api_lisp_gpe_add_del_iface_t *mp;
f64 timeout = ~0;
u8 action_set = 0, is_add = 1, is_l2 = 0, dp_table_set = 0, vni_set = 0;
- u32 dp_table=0, vni=0;
+ u32 dp_table = 0, vni = 0;
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
}
else if (unformat (input, "bd_id %d", &dp_table))
{
- dp_table_set = 1;
+ dp_table_set = 1;
is_l2 = 1;
}
else if (unformat (input, "vni %d", &vni))
static int
api_lisp_eid_table_map_dump (vat_main_t * vam)
{
+ u8 is_l2 = 0;
+ u8 mode_set = 0;
+ unformat_input_t *input = vam->input;
vl_api_lisp_eid_table_map_dump_t *mp;
f64 timeout = ~0;
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "l2"))
+ {
+ is_l2 = 1;
+ mode_set = 1;
+ }
+ else if (unformat (input, "l3"))
+ {
+ is_l2 = 0;
+ mode_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!mode_set)
+ {
+ errmsg ("expected one of 'l2' or 'l3' parameter!\n");
+ return -99;
+ }
+
if (!vam->json_output)
{
- fformat (vam->ofp, "%=10s%=10s\n", "VNI", "VRF");
+ fformat (vam->ofp, "%=10s%=10s\n", "VNI", is_l2 ? "BD" : "VRF");
}
M (LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump);
+ mp->is_l2 = is_l2;
+
+ /* send it... */
+ S;
+
+ /* Use a control ping for synchronization */
+ {
+ vl_api_control_ping_t *mp;
+ M (CONTROL_PING, control_ping);
+ S;
+ }
+ /* Wait for a reply... */
+ W;
+
+ /* NOTREACHED */
+ return 0;
+}
+
+static int
+api_lisp_eid_table_vni_dump (vat_main_t * vam)
+{
+ vl_api_lisp_eid_table_vni_dump_t *mp;
+ f64 timeout = ~0;
+
+ if (!vam->json_output)
+ {
+ fformat (vam->ofp, "VNI\n");
+ }
+
+ M (LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump);
/* send it... */
S;
case 1:
format_eid = (eid_table->eid_type ? format_ip6_address :
format_ip4_address);
- str = format (0, "[%d] %U/%d",
- clib_net_to_host_u32 (eid_table->vni),
+ str = format (0, "[%d] %U/%d", eid_table->vni,
format_eid, eid_table->eid, eid_table->eid_prefix_len);
break;
case 2:
- str = format (0, "[%d] %U",
- clib_net_to_host_u32 (eid_table->vni),
+ str = format (0, "[%d] %U", eid_table->vni,
format_ethernet_address, eid_table->eid);
break;
default:
ASSERT (vam != NULL);
ASSERT (eid_table != NULL);
+ if (~0 == eid_table->locator_set_index)
+ {
+ return format (0, "action: %d\n", eid_table->action);
+ }
+
vec_foreach (loc, vam->locator_msg)
{
if (!first_line)
vec_foreach (eid_table, vam->eid_tables)
{
- ret = lisp_locator_dump_send_msg (vam, eid_table->locator_set_index, 0);
- if (ret)
+ if (~0 != eid_table->locator_set_index)
{
- vec_free (vam->locator_msg);
- clean_locator_set_message (vam);
- vec_free (vam->eid_tables);
- return ret;
+ ret = lisp_locator_dump_send_msg (vam, eid_table->locator_set_index,
+ 0);
+ if (ret)
+ {
+ vec_free (vam->locator_msg);
+ clean_locator_set_message (vam);
+ vec_free (vam->eid_tables);
+ return ret;
+ }
}
tmp_str2 = format_eid_for_eid_table (vam, tmp_str2, eid_table, &ret);
u8 color_aware = 0;
sse2_qos_pol_action_params_st conform_action, exceed_action, violate_action;
+ conform_action.action_type = SSE2_QOS_ACTION_TRANSMIT;
+ conform_action.dscp = 0;
+ exceed_action.action_type = SSE2_QOS_ACTION_MARK_AND_TRANSMIT;
+ exceed_action.dscp = 0;
+ violate_action.action_type = SSE2_QOS_ACTION_DROP;
+ violate_action.dscp = 0;
+
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
if (unformat (i, "del"))
W;
}
+static int
+api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_ipsec_gre_add_del_tunnel_t *mp;
+ f64 timeout;
+ u32 local_sa_id = 0;
+ u32 remote_sa_id = 0;
+ ip4_address_t src_address;
+ ip4_address_t dst_address;
+ u8 is_add = 1;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "local_sa %d", &local_sa_id))
+ ;
+ else if (unformat (i, "remote_sa %d", &remote_sa_id))
+ ;
+ else if (unformat (i, "src %U", unformat_ip4_address, &src_address))
+ ;
+ else if (unformat (i, "dst %U", unformat_ip4_address, &dst_address))
+ ;
+ else if (unformat (i, "del"))
+ is_add = 0;
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ M (IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel);
+
+ mp->local_sa_id = ntohl (local_sa_id);
+ mp->remote_sa_id = ntohl (remote_sa_id);
+ clib_memcpy (mp->src_address, &src_address, sizeof (src_address));
+ clib_memcpy (mp->dst_address, &dst_address, sizeof (dst_address));
+ mp->is_add = is_add;
+
+ S;
+ W;
+ /* NOTREACHED */
+ return 0;
+}
+
+static void vl_api_ipsec_gre_tunnel_details_t_handler
+ (vl_api_ipsec_gre_tunnel_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ fformat (vam->ofp, "%11d%15U%15U%14d%14d\n",
+ ntohl (mp->sw_if_index),
+ format_ip4_address, &mp->src_address,
+ format_ip4_address, &mp->dst_address,
+ ntohl (mp->local_sa_id), ntohl (mp->remote_sa_id));
+}
+
+static void vl_api_ipsec_gre_tunnel_details_t_handler_json
+ (vl_api_ipsec_gre_tunnel_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t *node = NULL;
+ struct in_addr ip4;
+
+ if (VAT_JSON_ARRAY != vam->json_tree.type)
+ {
+ ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+ vat_json_init_array (&vam->json_tree);
+ }
+ node = vat_json_array_add (&vam->json_tree);
+
+ vat_json_init_object (node);
+ vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
+ clib_memcpy (&ip4, &mp->src_address, sizeof (ip4));
+ vat_json_object_add_ip4 (node, "src_address", ip4);
+ clib_memcpy (&ip4, &mp->dst_address, sizeof (ip4));
+ vat_json_object_add_ip4 (node, "dst_address", ip4);
+ vat_json_object_add_uint (node, "local_sa_id", ntohl (mp->local_sa_id));
+ vat_json_object_add_uint (node, "remote_sa_id", ntohl (mp->remote_sa_id));
+}
+
+static int
+api_ipsec_gre_tunnel_dump (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_ipsec_gre_tunnel_dump_t *mp;
+ f64 timeout;
+ u32 sw_if_index;
+ u8 sw_if_index_set = 0;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "sw_if_index %d", &sw_if_index))
+ sw_if_index_set = 1;
+ else
+ break;
+ }
+
+ if (sw_if_index_set == 0)
+ {
+ sw_if_index = ~0;
+ }
+
+ if (!vam->json_output)
+ {
+ fformat (vam->ofp, "%11s%15s%15s%14s%14s\n",
+ "sw_if_index", "src_address", "dst_address",
+ "local_sa_id", "remote_sa_id");
+ }
+
+ /* Get list of gre-tunnel interfaces */
+ M (IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump);
+
+ mp->sw_if_index = htonl (sw_if_index);
+
+ S;
+
+ /* Use a control ping for synchronization */
+ {
+ vl_api_control_ping_t *mp;
+ M (CONTROL_PING, control_ping);
+ S;
+ }
+ W;
+}
+
+static int
+api_delete_subif (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_delete_subif_t *mp;
+ f64 timeout;
+ u32 sw_if_index = ~0;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "sw_if_index %d", &sw_if_index))
+ ;
+ else
+ break;
+ }
+
+ if (sw_if_index == ~0)
+ {
+ errmsg ("missing sw_if_index\n");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (DELETE_SUBIF, delete_subif);
+ mp->sw_if_index = ntohl (sw_if_index);
+
+ S;
+ W;
+}
+
static int
q_or_quit (vat_main_t * vam)
{
"rx <intfc> | rx_sw_if_index <id> tx <intfc> | tx_sw_if_index <id>\n" \
"enable | disable") \
_(sw_interface_set_l2_bridge, \
- "rx <intfc> | rx_sw_if_index <id> bd_id <bridge-domain-id>\n" \
+ "<intfc> | sw_if_index <id> bd_id <bridge-domain-id>\n" \
"[shg <split-horizon-group>] [bvi]\n" \
"enable | disable") \
_(bridge_domain_add_del, \
"<intfc> | sw_if_index <nn> [ip4-table <nn>] [ip6-table <nn>]\n" \
" [l2-table <nn>] [del]") \
_(want_ip4_arp_events, "address <ip4-address> [del]") \
+_(want_ip6_nd_events, "address <ip6-address> [del]") \
_(ip_address_dump, "(ipv4 | ipv6) (<intfc> | sw_if_index <id>)") \
_(ip_dump, "ipv4 | ipv6") \
_(ipsec_spd_add_del, "spd_id <n> [del]") \
"locator-set <loc-set-name>] [local | remote]")\
_(lisp_eid_table_dump, "[eid <ipv4|ipv6>/<prefix> | <mac>] [vni] " \
"[local] | [remote]") \
-_(lisp_eid_table_map_dump, "") \
+_(lisp_eid_table_vni_dump, "") \
+_(lisp_eid_table_map_dump, "l2|l3") \
_(lisp_gpe_tunnel_dump, "") \
_(lisp_map_resolver_dump, "") \
_(show_lisp_status, "") \
"<ip-addr>/<mask> range <nn>-<nn> vrf <id>") \
_(ip_source_and_port_range_check_interface_add_del, \
"<intf> | sw_if_index <nn> [tcp-out-vrf <id>] [tcp-in-vrf <id>]" \
- "[udp-in-vrf <id>] [udp-out-vrf <id>]")
+ "[udp-in-vrf <id>] [udp-out-vrf <id>]") \
+_(ipsec_gre_add_del_tunnel, \
+ "src <addr> dst <addr> local_sa <sa-id> remote_sa <sa-id> [del]") \
+_(ipsec_gre_tunnel_dump, "[sw_if_index <nn>]") \
+_(delete_subif,"sub_sw_if_index <nn> sub_if_id <nn>")
/* List of command functions, CLI names map directly to functions */
#define foreach_cli_function \
_(dump_node_table, "usage: dump_node_table") \
_(echo, "usage: echo <message>") \
_(exec, "usage: exec <vpe-debug-CLI-command>") \
+_(exec_inband, "usage: exec_inband <vpe-debug-CLI-command>") \
_(help, "usage: help") \
_(q, "usage: quit") \
_(quit, "usage: quit") \