summaryrefslogtreecommitdiffstats
path: root/vpp/vpp-api
diff options
context:
space:
mode:
Diffstat (limited to 'vpp/vpp-api')
-rw-r--r--vpp/vpp-api/api.c74
-rw-r--r--vpp/vpp-api/custom_dump.c159
2 files changed, 122 insertions, 111 deletions
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 3e3548d1..8a341597 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -2591,7 +2591,7 @@ vl_api_sw_interface_clear_stats_t_handler (vl_api_sw_interface_clear_stats_t *
int rv = 0;
if (mp->sw_if_index != ~0)
- VALIDATE_SW_IF_INDEX(mp);
+ VALIDATE_SW_IF_INDEX (mp);
vec_reset_length (my_vnet_mains);
@@ -5668,16 +5668,16 @@ send_lisp_eid_table_details (mapping_t * mapit,
switch (filter)
{
- case 0: /* all mappings */
+ case 0: /* all mappings */
break;
- case 1: /* local only */
+ case 1: /* local only */
if (!mapit->local)
- return;
+ return;
break;
- case 2: /* remote only */
+ case 2: /* remote only */
if (mapit->local)
- return;
+ return;
break;
default:
clib_warning ("Filter error, unknown filter: %d", filter);
@@ -5754,7 +5754,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp)
mapit = pool_elt_at_index (lcm->mapping_pool, mi);
send_lisp_eid_table_details (mapit, q, mp->context,
- 0 /* ignore filter */);
+ 0 /* ignore filter */ );
}
else
{
@@ -7100,7 +7100,7 @@ send_mpls_gre_tunnel_entry (vpe_api_main_t * am,
e = pool_elt_at_index (mm->encaps, gt->encap_index);
nlabels = vec_len (e->labels);
- mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32));
+ mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MPLS_GRE_TUNNEL_DETAILS);
mp->context = context;
@@ -7143,11 +7143,11 @@ vl_api_mpls_gre_tunnel_dump_t_handler (vl_api_mpls_gre_tunnel_dump_t * mp)
if (index != ~0)
{
if (!pool_is_free_index (mm->gre_tunnels, index))
- {
- gt = pool_elt_at_index (mm->gre_tunnels, index);
- send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
- mp->context);
- }
+ {
+ gt = pool_elt_at_index (mm->gre_tunnels, index);
+ send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels,
+ mp->context);
+ }
}
else
{
@@ -7182,7 +7182,7 @@ send_mpls_eth_tunnel_entry (vpe_api_main_t * am,
e = pool_elt_at_index (mm->encaps, et->encap_index);
nlabels = vec_len (e->labels);
- mp = vl_msg_api_alloc (sizeof (*mp) + nlabels*sizeof(u32));
+ mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MPLS_ETH_TUNNEL_DETAILS);
mp->context = context;
@@ -7223,12 +7223,12 @@ vl_api_mpls_eth_tunnel_dump_t_handler (vl_api_mpls_eth_tunnel_dump_t * mp)
if (index != ~0)
{
- if (!pool_is_free_index(mm->eth_tunnels, index))
- {
- et = pool_elt_at_index (mm->eth_tunnels, index);
- send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
- mp->context);
- }
+ if (!pool_is_free_index (mm->eth_tunnels, index))
+ {
+ et = pool_elt_at_index (mm->eth_tunnels, index);
+ send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
+ mp->context);
+ }
}
else
{
@@ -7262,7 +7262,7 @@ send_mpls_fib_encap_details (vpe_api_main_t * am,
e = pool_elt_at_index (mm->encaps, s->entry_index);
nlabels = vec_len (e->labels);
- mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32));
+ mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_ENCAP_DETAILS);
mp->context = context;
@@ -8118,7 +8118,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
struct passwd _pw, *pw;
struct group _grp, *grp;
clib_error_t *e;
- buf = vec_new(char,128);
+ buf = vec_new (char, 128);
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "prefix %s", &chroot_path))
@@ -8134,10 +8134,12 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
{
/* lookup the username */
pw = NULL;
- while (((rv = getpwnam_r (s, &_pw, buf, vec_len (buf), &pw)) == ERANGE) && ( vec_len(buf) <= max_buf_size ))
- {
- vec_resize(buf,vec_len(buf)*2);
- }
+ while (((rv =
+ getpwnam_r (s, &_pw, buf, vec_len (buf), &pw)) == ERANGE)
+ && (vec_len (buf) <= max_buf_size))
+ {
+ vec_resize (buf, vec_len (buf) * 2);
+ }
if (rv < 0)
{
e = clib_error_return_code (0, rv,
@@ -8145,7 +8147,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
CLIB_ERROR_FATAL,
"cannot fetch username %s", s);
vec_free (s);
- vec_free (buf);
+ vec_free (buf);
return e;
}
if (pw == NULL)
@@ -8153,7 +8155,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
e =
clib_error_return_fatal (0, "username %s does not exist", s);
vec_free (s);
- vec_free (buf);
+ vec_free (buf);
return e;
}
vec_free (s);
@@ -8163,10 +8165,12 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
{
/* lookup the group name */
grp = NULL;
- while ( ( (rv = getgrnam_r (s, &_grp, buf, vec_len(buf), &grp)) == ERANGE ) && ( vec_len(buf) <= max_buf_size ) )
- {
- vec_resize(buf,vec_len(buf)*2);
- }
+ while (((rv =
+ getgrnam_r (s, &_grp, buf, vec_len (buf), &grp)) == ERANGE)
+ && (vec_len (buf) <= max_buf_size))
+ {
+ vec_resize (buf, vec_len (buf) * 2);
+ }
if (rv != 0)
{
e = clib_error_return_code (0, rv,
@@ -8174,18 +8178,18 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input)
CLIB_ERROR_FATAL,
"cannot fetch group %s", s);
vec_free (s);
- vec_free (buf);
+ vec_free (buf);
return e;
}
if (grp == NULL)
{
e = clib_error_return_fatal (0, "group %s does not exist", s);
vec_free (s);
- vec_free (buf);
+ vec_free (buf);
return e;
}
vec_free (s);
- vec_free (buf);
+ vec_free (buf);
vl_set_memory_gid (grp->gr_gid);
}
else
diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c
index 51bb00bb..c4d9a6ee 100644
--- a/vpp/vpp-api/custom_dump.c
+++ b/vpp/vpp-api/custom_dump.c
@@ -2196,20 +2196,20 @@ static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
}
static void *vl_api_lisp_enable_disable_t_print
- (vl_api_lisp_enable_disable_t * mp, void * handle)
+ (vl_api_lisp_enable_disable_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_enable_disable %s",
- mp->is_en ? "enable" : "disable");
+ mp->is_en ? "enable" : "disable");
FINISH;
}
static void *vl_api_lisp_gpe_add_del_iface_t_print
- (vl_api_lisp_gpe_add_del_iface_t * mp, void * handle)
+ (vl_api_lisp_gpe_add_del_iface_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_gpe_add_del_iface ");
@@ -2221,9 +2221,9 @@ static void *vl_api_lisp_gpe_add_del_iface_t_print
}
static void *vl_api_lisp_pitr_set_locator_set_t_print
- (vl_api_lisp_pitr_set_locator_set_t * mp, void * handle)
+ (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
@@ -2235,10 +2235,11 @@ static void *vl_api_lisp_pitr_set_locator_set_t_print
FINISH;
}
-static u8 * format_lisp_flat_eid (u8 * s, va_list * args)
+static u8 *
+format_lisp_flat_eid (u8 * s, va_list * args)
{
u32 type = va_arg (*args, u32);
- u8 * eid = va_arg (*args, u8 *);
+ u8 *eid = va_arg (*args, u8 *);
u32 eid_len = va_arg (*args, u32);
switch (type)
@@ -2253,12 +2254,13 @@ static u8 * format_lisp_flat_eid (u8 * s, va_list * args)
return 0;
}
-static u8 * format_lisp_eid_vat (u8 * s, va_list * args)
+static u8 *
+format_lisp_eid_vat (u8 * s, va_list * args)
{
u32 type = va_arg (*args, u32);
- u8 * eid = va_arg (*args, u8 *);
+ u8 *eid = va_arg (*args, u8 *);
u32 eid_len = va_arg (*args, u32);
- u8 * seid = va_arg (*args, u8 *);
+ u8 *seid = va_arg (*args, u8 *);
u32 seid_len = va_arg (*args, u32);
u32 is_src_dst = va_arg (*args, u32);
@@ -2271,17 +2273,22 @@ static u8 * format_lisp_eid_vat (u8 * s, va_list * args)
}
/** Used for transferring locators via VPP API */
-typedef CLIB_PACKED(struct
-{
- u8 is_ip4; /**< is locator an IPv4 address */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
- u8 addr[16]; /**< IPv4/IPv6 address */
-}) rloc_t;
+typedef CLIB_PACKED (struct
+ {
+ u8 is_ip4;
+ /**< is locator an IPv4 address */
+ u8 priority;
+ /**< locator priority */
+ u8 weight;
+ /**< locator weight */
+ u8 addr[16];
+ /**< IPv4/IPv6 address */
+ }) rloc_t;
-static u8 * format_rloc (u8 * s, va_list * args)
+static u8 *
+format_rloc (u8 * s, va_list * args)
{
- rloc_t * rloc = va_arg (*args, rloc_t *);
+ rloc_t *rloc = va_arg (*args, rloc_t *);
if (rloc->is_ip4)
s = format (s, "%U ", format_ip4_address, rloc->addr);
@@ -2294,9 +2301,9 @@ static u8 * format_rloc (u8 * s, va_list * args)
}
static void *vl_api_lisp_add_del_remote_mapping_t_print
- (vl_api_lisp_add_del_remote_mapping_t * mp, void * handle)
+ (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
u32 i, rloc_num = 0;
s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
@@ -2308,8 +2315,8 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "deid %U ", format_lisp_eid_vat,
- mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len,
- mp->is_src_dst);
+ mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len,
+ mp->is_src_dst);
rloc_num = mp->rloc_num;
@@ -2317,34 +2324,34 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print
s = format (s, "action %d", mp->action);
else
{
- rloc_t * rloc = (rloc_t *) mp->rlocs;
+ rloc_t *rloc = (rloc_t *) mp->rlocs;
for (i = 0; i < rloc_num; i++)
- s = format (s, "%U ", format_rloc, &rloc[i]);
+ s = format (s, "%U ", format_rloc, &rloc[i]);
}
FINISH;
}
static void *vl_api_lisp_add_del_adjacency_t_print
- (vl_api_lisp_add_del_adjacency_t * mp, void * handle)
+ (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_adjacency ");
s = format (s, "%s ", mp->is_add ? "add" : "del");
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "deid %U seid %U ",
- format_lisp_flat_eid, mp->eid_type, mp->deid, mp->deid_len,
- format_lisp_flat_eid, mp->eid_type, mp->seid, mp->seid_len);
+ format_lisp_flat_eid, mp->eid_type, mp->deid, mp->deid_len,
+ format_lisp_flat_eid, mp->eid_type, mp->seid, mp->seid_len);
FINISH;
}
static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
- (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void * handle)
+ (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
@@ -2357,9 +2364,9 @@ static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
}
static void *vl_api_lisp_eid_table_add_del_map_t_print
- (vl_api_lisp_eid_table_add_del_map_t * mp, void * handle)
+ (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
@@ -2368,15 +2375,15 @@ static void *vl_api_lisp_eid_table_add_del_map_t_print
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "%s %d ",
- mp->is_l2 ? "bd_index" : "vrf",
- clib_net_to_host_u32 (mp->dp_table));
+ mp->is_l2 ? "bd_index" : "vrf",
+ clib_net_to_host_u32 (mp->dp_table));
FINISH;
}
static void *vl_api_lisp_add_del_local_eid_t_print
- (vl_api_lisp_add_del_local_eid_t * mp, void * handle)
+ (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_local_eid ");
@@ -2385,15 +2392,15 @@ static void *vl_api_lisp_add_del_local_eid_t_print
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
- mp->prefix_len);
+ mp->prefix_len);
s = format (s, "locator-set %s ", mp->locator_set_name);
FINISH;
}
static void *vl_api_lisp_gpe_add_del_fwd_entry_t_print
- (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void * handle)
+ (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_gpe_add_del_fwd_entry TODO");
@@ -2401,9 +2408,9 @@ static void *vl_api_lisp_gpe_add_del_fwd_entry_t_print
}
static void *vl_api_lisp_add_del_map_resolver_t_print
- (vl_api_lisp_add_del_map_resolver_t * mp, void * handle)
+ (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
@@ -2419,9 +2426,9 @@ static void *vl_api_lisp_add_del_map_resolver_t_print
}
static void *vl_api_lisp_gpe_enable_disable_t_print
- (vl_api_lisp_gpe_enable_disable_t * mp, void * handle)
+ (vl_api_lisp_gpe_enable_disable_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_gpe_enable_disable ");
@@ -2430,28 +2437,31 @@ static void *vl_api_lisp_gpe_enable_disable_t_print
FINISH;
}
-typedef CLIB_PACKED(struct
-{
- u32 sw_if_index; /**< locator sw_if_index */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
-}) ls_locator_t;
+typedef CLIB_PACKED (struct
+ {
+ u32 sw_if_index;
+ /**< locator sw_if_index */
+ u8 priority;
+ /**< locator priority */
+ u8 weight;
+ /**< locator weight */
+ }) ls_locator_t;
static u8 *
format_locator (u8 * s, va_list * args)
{
- ls_locator_t * l = va_arg (*args, ls_locator_t *);
+ ls_locator_t *l = va_arg (*args, ls_locator_t *);
return format (s, "sw_if_index %d p %d w %d",
- l->sw_if_index, l->priority, l->weight);
+ l->sw_if_index, l->priority, l->weight);
}
static void *vl_api_lisp_add_del_locator_set_t_print
- (vl_api_lisp_add_del_locator_set_t * mp, void * handle)
+ (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
u32 loc_num = 0, i;
- ls_locator_t * locs;
+ ls_locator_t *locs;
s = format (0, "SCRIPT: lisp_add_del_locator_set ");
@@ -2470,9 +2480,9 @@ static void *vl_api_lisp_add_del_locator_set_t_print
}
static void *vl_api_lisp_add_del_locator_t_print
- (vl_api_lisp_add_del_locator_t * mp, void * handle)
+ (vl_api_lisp_add_del_locator_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_add_del_locator ");
@@ -2487,9 +2497,9 @@ static void *vl_api_lisp_add_del_locator_t_print
}
static void *vl_api_lisp_locator_set_dump_t_print
- (vl_api_lisp_locator_set_dump_t * mp, void * handle)
+ (vl_api_lisp_locator_set_dump_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_locator_set_dump ");
@@ -2499,9 +2509,9 @@ static void *vl_api_lisp_locator_set_dump_t_print
}
static void *vl_api_lisp_eid_table_dump_t_print
- (vl_api_lisp_eid_table_dump_t * mp, void * handle)
+ (vl_api_lisp_eid_table_dump_t * mp, void *handle)
{
- u8 * s;
+ u8 *s;
s = format (0, "SCRIPT: lisp_eid_table_dump ");
@@ -2509,16 +2519,16 @@ static void *vl_api_lisp_eid_table_dump_t_print
{
s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
- mp->eid, mp->prefix_length);
+ mp->eid, mp->prefix_length);
switch (mp->filter)
- {
- case 1:
- s = format (s, "local ");
- break;
- case 2:
- s = format (s, "remote ");
- break;
- }
+ {
+ case 1:
+ s = format (s, "local ");
+ break;
+ case 2:
+ s = format (s, "remote ");
+ break;
+ }
}
FINISH;
@@ -2539,7 +2549,6 @@ static void * vl_api_ ## f ## _t_print \
}
foreach_custom_print_no_arg_function
#undef _
-
#define foreach_custom_print_function \
_(CREATE_LOOPBACK, create_loopback) \
_(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
@@ -2669,9 +2678,7 @@ _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)
-
-
-void
+ void
vl_msg_api_custom_dump_configure (api_main_t * am)
{
#define _(n,f) am->msg_print_handlers[VL_API_##n] \