vat_socket_connect (vat_main_t * vam)
{
int rv;
+ api_main_t *am = vlibapi_get_main ();
vam->socket_client_main = &socket_client_main;
if ((rv = vl_socket_client_connect ((char *) vam->socket_name,
"vpp_api_test",
0 /* default socket rx, tx buffer */ )))
return rv;
+
/* vpp expects the client index in network order */
vam->my_client_index = htonl (socket_client_main.client_index);
+ am->my_client_index = vam->my_client_index;
return 0;
}
#else /* vpp built-in case, we don't do sockets... */
static void
increment_address (vl_api_address_t * a)
{
- if (clib_net_to_host_u32 (a->af) == ADDRESS_IP4)
+ if (a->af == ADDRESS_IP4)
increment_v4_address (&a->un.ip4);
- else if (clib_net_to_host_u32 (a->af) == ADDRESS_IP6)
+ else if (a->af == ADDRESS_IP6)
increment_v6_address (&a->un.ip6);
}
vam->retval = retval;
if (retval == 0)
- vam->cmd_reply = vl_api_from_api_to_new_vec (&mp->reply);
+ vam->cmd_reply = vl_api_from_api_to_new_vec (mp, &mp->reply);
vam->result_ready = 1;
}
vat_json_node_t node;
u8 *reply = 0; /* reply vector */
- reply = vl_api_from_api_to_new_vec (&mp->reply);
+ reply = vl_api_from_api_to_new_vec (mp, &mp->reply);
vec_reset_length (vam->cmd_reply);
vat_json_init_object (&node);
else
{
s = format (s, "%=16U%=16d%=16d",
- mp->is_ipv6 ? format_ip6_address :
- format_ip4_address,
+ format_ip46_address,
mp->ip_address, mp->priority, mp->weight);
}
clib_net_to_host_u32 (mp->sw_if_index));
else
{
- if (mp->is_ipv6)
+ if (mp->ip_address.af)
{
- clib_memcpy (&ip6, mp->ip_address, sizeof (ip6));
+ clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "address", ip6);
}
else
{
- clib_memcpy (&ip4, mp->ip_address, sizeof (ip4));
+ clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "address", ip4);
}
}
static u8 *
format_lisp_flat_eid (u8 * s, va_list * args)
{
- u32 type = va_arg (*args, u32);
- u8 *eid = va_arg (*args, u8 *);
- u32 eid_len = va_arg (*args, u32);
+ vl_api_eid_t *eid = va_arg (*args, vl_api_eid_t *);
- switch (type)
+ switch (eid->type)
{
- case 0:
- return format (s, "%U/%d", format_ip4_address, eid, eid_len);
- case 1:
- return format (s, "%U/%d", format_ip6_address, eid, eid_len);
- case 2:
- return format (s, "%U", format_ethernet_address, eid);
- case 3:
- return format (s, "%U", format_nsh_address_vat, eid);
+ case EID_TYPE_API_PREFIX:
+ if (eid->address.prefix.address.af)
+ return format (s, "%U/%d", format_ip6_address,
+ eid->address.prefix.address.un.ip6,
+ eid->address.prefix.len);
+ return format (s, "%U/%d", format_ip4_address,
+ eid->address.prefix.address.un.ip4,
+ eid->address.prefix.len);
+ case EID_TYPE_API_MAC:
+ return format (s, "%U", format_ethernet_address, eid->address.mac);
+ case EID_TYPE_API_NSH:
+ return format (s, "%U", format_nsh_address_vat, eid->address.nsh);
}
return 0;
}
static u8 *
format_lisp_eid_vat (u8 * s, va_list * args)
{
- u32 type = va_arg (*args, u32);
- u8 *eid = va_arg (*args, u8 *);
- u32 eid_len = va_arg (*args, u32);
- u8 *seid = va_arg (*args, u8 *);
- u32 seid_len = va_arg (*args, u32);
- u32 is_src_dst = va_arg (*args, u32);
+ vl_api_eid_t *deid = va_arg (*args, vl_api_eid_t *);
+ vl_api_eid_t *seid = va_arg (*args, vl_api_eid_t *);
+ u8 is_src_dst = (u8) va_arg (*args, int);
if (is_src_dst)
- s = format (s, "%U|", format_lisp_flat_eid, type, seid, seid_len);
+ s = format (s, "%U|", format_lisp_flat_eid, seid);
- s = format (s, "%U", format_lisp_flat_eid, type, eid, eid_len);
+ s = format (s, "%U", format_lisp_flat_eid, deid);
return s;
}
s = format (0, "%d", clib_net_to_host_u32 (mp->locator_set_index));
eid = format (0, "%U", format_lisp_eid_vat,
- mp->eid_type,
- mp->eid,
- mp->eid_prefix_len,
- mp->seid, mp->seid_prefix_len, mp->is_src_dst);
+ mp->deid, mp->seid, mp->is_src_dst);
vec_add1 (eid, 0);
print (vam->ofp, "[%d] %-35s%-20s%-30s%-20d%-20d%-10d%-20s",
eid,
mp->is_local ? "local" : "remote",
s, clib_net_to_host_u32 (mp->ttl), mp->authoritative,
- clib_net_to_host_u16 (mp->key_id), mp->key);
+ clib_net_to_host_u16 (mp->key.id), mp->key.key);
vec_free (s);
vec_free (eid);
clib_net_to_host_u32 (mp->locator_set_index));
vat_json_object_add_uint (node, "is_local", mp->is_local ? 1 : 0);
- if (mp->eid_type == 3)
+ if (mp->deid.type == 3)
{
vat_json_node_t *nsh_json = vat_json_object_add (node, "eid");
vat_json_init_object (nsh_json);
- lisp_nsh_api_t *nsh = (lisp_nsh_api_t *) mp->eid;
+ lisp_nsh_api_t *nsh = (lisp_nsh_api_t *) & mp->deid.address.nsh;
vat_json_object_add_uint (nsh_json, "spi",
clib_net_to_host_u32 (nsh->spi));
vat_json_object_add_uint (nsh_json, "si", nsh->si);
else
{
eid = format (0, "%U", format_lisp_eid_vat,
- mp->eid_type,
- mp->eid,
- mp->eid_prefix_len,
- mp->seid, mp->seid_prefix_len, mp->is_src_dst);
+ mp->deid, mp->seid, mp->is_src_dst);
vec_add1 (eid, 0);
vat_json_object_add_string_copy (node, "eid", eid);
vec_free (eid);
vat_json_object_add_uint (node, "ttl", clib_net_to_host_u32 (mp->ttl));
vat_json_object_add_uint (node, "authoritative", (mp->authoritative));
- if (mp->key_id)
+ if (mp->key.id)
{
vat_json_object_add_uint (node, "key_id",
- clib_net_to_host_u16 (mp->key_id));
- vat_json_object_add_string_copy (node, "key", mp->key);
+ clib_net_to_host_u16 (mp->key.id));
+ vat_json_object_add_string_copy (node, "key", mp->key.key);
}
}
{
vat_main_t *vam = &vat_main;
u8 *seid = 0, *deid = 0;
- u8 *(*format_ip_address_fcn) (u8 *, va_list *) = 0;
+ ip46_address_t lloc, rloc;
- deid = format (0, "%U", format_lisp_eid_vat,
- mp->eid_type, mp->deid, mp->deid_pref_len, 0, 0, 0);
+ deid = format (0, "%U", format_lisp_eid_vat, mp->deid, 0);
- seid = format (0, "%U", format_lisp_eid_vat,
- mp->eid_type, mp->seid, mp->seid_pref_len, 0, 0, 0);
+ seid = format (0, "%U", format_lisp_eid_vat, mp->seid, 0);
vec_add1 (deid, 0);
vec_add1 (seid, 0);
- if (mp->is_ip4)
- format_ip_address_fcn = format_ip4_address;
+ if (mp->lloc.af)
+ {
+ clib_memcpy (&lloc.ip6, mp->lloc.un.ip6, 16);
+ clib_memcpy (&rloc.ip6, mp->rloc.un.ip6, 16);
+ }
else
- format_ip_address_fcn = format_ip6_address;
+ {
+ clib_memcpy (&lloc.ip4, mp->lloc.un.ip4, 4);
+ clib_memcpy (&rloc.ip4, mp->rloc.un.ip4, 4);
+ }
print (vam->ofp, "([%d] %s %s) (%U %U) %u %u",
clib_net_to_host_u32 (mp->vni),
seid, deid,
- format_ip_address_fcn, mp->lloc,
- format_ip_address_fcn, mp->rloc,
+ format_ip46_address, lloc,
+ format_ip46_address, rloc,
clib_net_to_host_u32 (mp->pkt_count),
clib_net_to_host_u32 (mp->bytes));
node = vat_json_array_add (&vam->json_tree);
vat_json_init_object (node);
- deid = format (0, "%U", format_lisp_eid_vat,
- mp->eid_type, mp->deid, mp->deid_pref_len, 0, 0, 0);
+ deid = format (0, "%U", format_lisp_eid_vat, mp->deid, 0);
- seid = format (0, "%U", format_lisp_eid_vat,
- mp->eid_type, mp->seid, mp->seid_pref_len, 0, 0, 0);
+ seid = format (0, "%U", format_lisp_eid_vat, mp->seid, 0);
vec_add1 (deid, 0);
vec_add1 (seid, 0);
vat_json_object_add_string_copy (node, "deid", deid);
vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
- if (mp->is_ip4)
+ if (mp->lloc.af)
{
- clib_memcpy (&ip4, mp->lloc, sizeof (ip4));
- vat_json_object_add_ip4 (node, "lloc", ip4);
- clib_memcpy (&ip4, mp->rloc, sizeof (ip4));
- vat_json_object_add_ip4 (node, "rloc", ip4);
+ clib_memcpy (&ip6, mp->lloc.un.ip6, sizeof (ip6));
+ vat_json_object_add_ip6 (node, "lloc", ip6);
+ clib_memcpy (&ip6, mp->rloc.un.ip6, sizeof (ip6));
+ vat_json_object_add_ip6 (node, "rloc", ip6);
+
}
else
{
- clib_memcpy (&ip6, mp->lloc, sizeof (ip6));
- vat_json_object_add_ip6 (node, "lloc", ip6);
- clib_memcpy (&ip6, mp->rloc, sizeof (ip6));
- vat_json_object_add_ip6 (node, "rloc", ip6);
+ clib_memcpy (&ip4, mp->lloc.un.ip4, sizeof (ip4));
+ vat_json_object_add_ip4 (node, "lloc", ip4);
+ clib_memcpy (&ip4, mp->rloc.un.ip4, sizeof (ip4));
+ vat_json_object_add_ip4 (node, "rloc", ip4);
}
vat_json_object_add_uint (node, "pkt_count",
clib_net_to_host_u32 (mp->pkt_count));
vat_main_t *vam = &vat_main;
int retval = clib_net_to_host_u32 (mp->retval);
- print (vam->ofp, "%s", mp->is_enabled ? "enabled" : "disabled");
+ print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
vam->retval = retval;
vam->result_ready = 1;
vat_json_node_t _node, *node = &_node;
int retval = clib_net_to_host_u32 (mp->retval);
- u8 *s = format (0, "%s", mp->is_enabled ? "enabled" : "disabled");
+ u8 *s = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
vat_json_init_object (node);
vat_json_object_add_string_copy (node, "state", s);
if (retval)
goto end;
- print (vam->ofp, "%s", mp->is_enabled ? "enabled" : "disabled");
+ print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
end:
vam->retval = retval;
vam->result_ready = 1;
vat_json_node_t _node, *node = &_node;
int retval = clib_net_to_host_u32 (mp->retval);
- u8 *s = format (0, "%s", mp->is_enabled ? "enabled" : "disabled");
+ u8 *s = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
vat_json_init_object (node);
vat_json_object_add_string_copy (node, "state", s);
if (retval)
goto end;
- print (vam->ofp, "%s", mp->is_en ? "enabled" : "disabled");
+ print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
end:
vam->retval = retval;
vam->result_ready = 1;
vat_json_node_t _node, *node = &_node;
int retval = clib_net_to_host_u32 (mp->retval);
- u8 *s = format (0, "%s", mp->is_en ? "enabled" : "disabled");
+ u8 *s = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
vat_json_init_object (node);
vat_json_object_add_string_copy (node, "state", s);
vat_main_t *vam = &vat_main;
u8 *(*format_ip_address_fcn) (u8 *, va_list *) = 0;
- if (mp->lcl_loc.is_ip4)
- format_ip_address_fcn = format_ip4_address;
- else
+ if (mp->lcl_loc.addr.af)
format_ip_address_fcn = format_ip6_address;
+ else
+ format_ip_address_fcn = format_ip4_address;
print (vam->ofp, "w:%d %30U %30U", mp->rmt_loc.weight,
- format_ip_address_fcn, &mp->lcl_loc,
- format_ip_address_fcn, &mp->rmt_loc);
+ format_ip_address_fcn, &mp->lcl_loc.addr.un,
+ format_ip_address_fcn, &mp->rmt_loc.addr.un);
}
static void
struct in6_addr ip6;
struct in_addr ip4;
- if (loc->is_ip4)
+ if (loc->addr.af)
{
- clib_memcpy (&ip4, loc->addr, sizeof (ip4));
- vat_json_object_add_ip4 (n, "address", ip4);
+ clib_memcpy (&ip6, loc->addr.un.ip6, sizeof (ip6));
+ vat_json_object_add_ip6 (n, "address", ip6);
}
else
{
- clib_memcpy (&ip6, loc->addr, sizeof (ip6));
- vat_json_object_add_ip6 (n, "address", ip6);
+ clib_memcpy (&ip4, loc->addr.un.ip4, sizeof (ip4));
+ vat_json_object_add_ip4 (n, "address", ip4);
}
vat_json_object_add_uint (n, "weight", loc->weight);
}
{
e = &mp->entries[i];
print (vam->ofp, "%10d %10d %U %40U", e->fwd_entry_index, e->dp_table,
- format_lisp_flat_eid, e->eid_type, e->leid, e->leid_prefix_len,
- format_lisp_flat_eid, e->eid_type, e->reid, e->reid_prefix_len);
+ format_lisp_flat_eid, e->leid, format_lisp_flat_eid, e->reid);
}
end:
vat_json_object_add_int (e, "vni", fwd->vni);
vat_json_object_add_int (e, "action", fwd->action);
- s = format (0, "%U", format_lisp_flat_eid, fwd->eid_type, fwd->leid,
- fwd->leid_prefix_len);
+ s = format (0, "%U", format_lisp_flat_eid, fwd->leid);
vec_add1 (s, 0);
vat_json_object_add_string_copy (e, "leid", s);
vec_free (s);
- s = format (0, "%U", format_lisp_flat_eid, fwd->eid_type, fwd->reid,
- fwd->reid_prefix_len);
+ s = format (0, "%U", format_lisp_flat_eid, fwd->reid);
vec_add1 (s, 0);
vat_json_object_add_string_copy (e, "reid", s);
vec_free (s);
print (vam->ofp, "fib_index: %d sw_if_index %d nh %U",
clib_net_to_host_u32 (r->fib_index),
clib_net_to_host_u32 (r->nh_sw_if_index),
- r->is_ip4 ? format_ip4_address : format_ip6_address, r->nh_addr);
+ r->nh_addr.af ? format_ip6_address : format_ip4_address,
+ r->nh_addr.un);
}
end:
vat_json_init_object (e);
r = &mp->entries[i];
s =
- format (0, "%U", r->is_ip4 ? format_ip4_address : format_ip6_address,
- r->nh_addr);
+ format (0, "%U",
+ r->nh_addr.af ? format_ip6_address : format_ip4_address,
+ r->nh_addr.un);
vec_add1 (s, 0);
vat_json_object_add_string_copy (e, "ip4", s);
vec_free (s);
{
a = &mp->adjacencies[i];
print (vam->ofp, "%U %40U",
- format_lisp_flat_eid, a->eid_type, a->leid, a->leid_prefix_len,
- format_lisp_flat_eid, a->eid_type, a->reid, a->reid_prefix_len);
+ format_lisp_flat_eid, a->leid, format_lisp_flat_eid, a->reid);
}
end:
a = &mp->adjacencies[i];
vat_json_init_object (e);
- s = format (0, "%U", format_lisp_flat_eid, a->eid_type, a->leid,
- a->leid_prefix_len);
+ s = format (0, "%U", format_lisp_flat_eid, a->leid);
vec_add1 (s, 0);
vat_json_object_add_string_copy (e, "leid", s);
vec_free (s);
- s = format (0, "%U", format_lisp_flat_eid, a->eid_type, a->reid,
- a->reid_prefix_len);
+ s = format (0, "%U", format_lisp_flat_eid, a->reid);
vec_add1 (s, 0);
vat_json_object_add_string_copy (e, "reid", s);
vec_free (s);
vat_main_t *vam = &vat_main;
print (vam->ofp, "%=20U",
- mp->is_ipv6 ? format_ip6_address : format_ip4_address,
- mp->ip_address);
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
}
static void
node = vat_json_array_add (&vam->json_tree);
vat_json_init_object (node);
- if (mp->is_ipv6)
+ if (mp->ip_address.af)
{
- clib_memcpy (&ip6, mp->ip_address, sizeof (ip6));
+ clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "map-server", ip6);
}
else
{
- clib_memcpy (&ip4, mp->ip_address, sizeof (ip4));
+ clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "map-server", ip4);
}
}
vat_main_t *vam = &vat_main;
print (vam->ofp, "%=20U",
- mp->is_ipv6 ? format_ip6_address : format_ip4_address,
- mp->ip_address);
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
}
static void
node = vat_json_array_add (&vam->json_tree);
vat_json_init_object (node);
- if (mp->is_ipv6)
+ if (mp->ip_address.af)
{
- clib_memcpy (&ip6, mp->ip_address, sizeof (ip6));
+ clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "map resolver", ip6);
}
else
{
- clib_memcpy (&ip4, mp->ip_address, sizeof (ip4));
+ clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "map resolver", ip4);
}
}
if (0 <= retval)
{
- print (vam->ofp, "%s\n", mp->is_en ? "enabled" : "disabled");
+ print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
}
vam->retval = retval;
vat_json_node_t node;
u8 *status = 0;
- status = format (0, "%s", mp->is_en ? "enabled" : "disabled");
+ status = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
vec_add1 (status, 0);
vat_json_init_object (&node);
if (0 <= retval)
{
- print (vam->ofp, "%s\n", mp->is_en ? "enabled" : "disabled");
+ print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
}
vam->retval = retval;
vat_json_node_t node;
u8 *status = 0;
- status = format (0, "%s", mp->is_en ? "enabled" : "disabled");
+ status = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
vec_add1 (status, 0);
vat_json_init_object (&node);
if (0 <= retval)
{
- print (vam->ofp, "%s\n", mp->is_en ? "enabled" : "disabled");
+ print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
}
vam->retval = retval;
vat_json_node_t node;
u8 *status = 0;
- status = format (0, "%s", mp->is_en ? "enabled" : "disabled");
+ status = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
vec_add1 (status, 0);
vat_json_init_object (&node);
if (mp->status)
{
print (vam->ofp, "Proxy-ETR address; %U",
- mp->is_ip4 ? format_ip4_address : format_ip6_address,
- mp->address);
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
}
}
vat_json_object_add_string_copy (&node, "status", status);
if (mp->status)
{
- if (mp->is_ip4)
+ if (mp->ip_address.af)
{
- clib_memcpy (&ip6, mp->address, sizeof (ip6));
+ clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (&node, "address", ip6);
}
else
{
- clib_memcpy (&ip4, mp->address, sizeof (ip4));
+ clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (&node, "address", ip4);
}
}
vat_main_t *vam = &vat_main;
u8 *conform_dscp_str, *exceed_dscp_str, *violate_dscp_str;
- if (mp->conform_action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
- conform_dscp_str = format (0, "%U", format_dscp, mp->conform_dscp);
+ if (mp->conform_action.type == SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT)
+ conform_dscp_str = format (0, "%U", format_dscp, mp->conform_action.dscp);
else
conform_dscp_str = format (0, "");
- if (mp->exceed_action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
- exceed_dscp_str = format (0, "%U", format_dscp, mp->exceed_dscp);
+ if (mp->exceed_action.type == SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT)
+ exceed_dscp_str = format (0, "%U", format_dscp, mp->exceed_action.dscp);
else
exceed_dscp_str = format (0, "");
- if (mp->violate_action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
- violate_dscp_str = format (0, "%U", format_dscp, mp->violate_dscp);
+ if (mp->violate_action.type == SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT)
+ violate_dscp_str = format (0, "%U", format_dscp, mp->violate_action.dscp);
else
violate_dscp_str = format (0, "");
ntohl (mp->extended_limit),
ntohl (mp->extended_bucket),
clib_net_to_host_u64 (mp->last_update_time),
- format_policer_action_type, mp->conform_action_type,
+ format_policer_action_type, mp->conform_action.type,
conform_dscp_str,
- format_policer_action_type, mp->exceed_action_type,
+ format_policer_action_type, mp->exceed_action.type,
exceed_dscp_str,
- format_policer_action_type, mp->violate_action_type,
+ format_policer_action_type, mp->violate_action.type,
violate_dscp_str);
vec_free (conform_dscp_str);
format (0, "%U", format_policer_round_type, mp->round_type);
type_str = format (0, "%U", format_policer_type, mp->type);
conform_action_str = format (0, "%U", format_policer_action_type,
- mp->conform_action_type);
+ mp->conform_action.type);
exceed_action_str = format (0, "%U", format_policer_action_type,
- mp->exceed_action_type);
+ mp->exceed_action.type);
violate_action_str = format (0, "%U", format_policer_action_type,
- mp->violate_action_type);
+ mp->violate_action.type);
if (VAT_JSON_ARRAY != vam->json_tree.type)
{
ntohl (mp->last_update_time));
vat_json_object_add_string_copy (node, "conform_action",
conform_action_str);
- if (mp->conform_action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
+ if (mp->conform_action.type == SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT)
{
- u8 *dscp_str = format (0, "%U", format_dscp, mp->conform_dscp);
+ u8 *dscp_str = format (0, "%U", format_dscp, mp->conform_action.dscp);
vat_json_object_add_string_copy (node, "conform_dscp", dscp_str);
vec_free (dscp_str);
}
vat_json_object_add_string_copy (node, "exceed_action", exceed_action_str);
- if (mp->exceed_action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
+ if (mp->exceed_action.type == SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT)
{
- u8 *dscp_str = format (0, "%U", format_dscp, mp->exceed_dscp);
+ u8 *dscp_str = format (0, "%U", format_dscp, mp->exceed_action.dscp);
vat_json_object_add_string_copy (node, "exceed_dscp", dscp_str);
vec_free (dscp_str);
}
vat_json_object_add_string_copy (node, "violate_action",
violate_action_str);
- if (mp->violate_action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
+ if (mp->violate_action.type == SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT)
{
- u8 *dscp_str = format (0, "%U", format_dscp, mp->violate_dscp);
+ u8 *dscp_str = format (0, "%U", format_dscp, mp->violate_action.dscp);
vat_json_object_add_string_copy (node, "violate_dscp", dscp_str);
vec_free (dscp_str);
}
else if (unformat (i, "host-mtu-size %u", &host_mtu_size))
host_mtu_set = 1;
else if (unformat (i, "no-gso"))
- tap_flags &= ~TAP_FLAG_GSO;
+ tap_flags &= ~TAP_API_FLAG_GSO;
else if (unformat (i, "gso"))
- tap_flags |= TAP_FLAG_GSO;
+ tap_flags |= TAP_API_FLAG_GSO;
else if (unformat (i, "csum-offload"))
- tap_flags |= TAP_FLAG_CSUM_OFFLOAD;
+ tap_flags |= TAP_API_FLAG_CSUM_OFFLOAD;
else if (unformat (i, "persist"))
- tap_flags |= TAP_FLAG_PERSIST;
+ tap_flags |= TAP_API_FLAG_PERSIST;
else if (unformat (i, "attach"))
- tap_flags |= TAP_FLAG_ATTACH;
+ tap_flags |= TAP_API_FLAG_ATTACH;
+ else if (unformat (i, "tun"))
+ tap_flags |= TAP_API_FLAG_TUN;
+ else if (unformat (i, "gro-coalesce"))
+ tap_flags |= TAP_API_FLAG_GRO_COALESCE;
else
break;
}
u8 behavior = ~0;
u32 sw_if_index;
u32 fib_table = ~(u32) 0;
- ip6_address_t nh_addr6;
- ip4_address_t nh_addr4;
- clib_memset (&nh_addr6, 0, sizeof (ip6_address_t));
- clib_memset (&nh_addr4, 0, sizeof (ip4_address_t));
+ ip46_address_t nh_addr;
+ clib_memset (&nh_addr, 0, sizeof (ip46_address_t));
bool nexthop_set = 0;
if (unformat (i, "del"))
is_del = 1;
else if (unformat (i, "address %U", unformat_ip6_address, &localsid));
- else if (unformat (i, "next-hop %U", unformat_ip4_address, &nh_addr4))
- nexthop_set = 1;
- else if (unformat (i, "next-hop %U", unformat_ip6_address, &nh_addr6))
+ else if (unformat (i, "next-hop %U", unformat_ip46_address, &nh_addr))
nexthop_set = 1;
else if (unformat (i, "behavior %u", &behavior));
else if (unformat (i, "sw_if_index %u", &sw_if_index));
M (SR_LOCALSID_ADD_DEL, mp);
- clib_memcpy (mp->localsid.addr, &localsid, sizeof (mp->localsid));
+ clib_memcpy (mp->localsid, &localsid, sizeof (mp->localsid));
if (nexthop_set)
{
- clib_memcpy (mp->nh_addr6, &nh_addr6, sizeof (mp->nh_addr6));
- clib_memcpy (mp->nh_addr4, &nh_addr4, sizeof (mp->nh_addr4));
+ clib_memcpy (&mp->nh_addr.un, &nh_addr, sizeof (mp->nh_addr.un));
}
mp->behavior = behavior;
mp->sw_if_index = ntohl (sw_if_index);
if (ipv6_set)
{
- clib_memcpy (mp->src_address, &src.ip6, sizeof (src.ip6));
- clib_memcpy (mp->dst_address, &dst.ip6, sizeof (dst.ip6));
+ clib_memcpy (mp->src_address.un.ip6, &src.ip6, sizeof (src.ip6));
+ clib_memcpy (mp->dst_address.un.ip6, &dst.ip6, sizeof (dst.ip6));
}
else
{
- clib_memcpy (mp->src_address, &src.ip4, sizeof (src.ip4));
- clib_memcpy (mp->dst_address, &dst.ip4, sizeof (dst.ip4));
+ clib_memcpy (mp->src_address.un.ip4, &src.ip4, sizeof (src.ip4));
+ clib_memcpy (mp->dst_address.un.ip4, &dst.ip4, sizeof (dst.ip4));
}
+ mp->src_address.af = ipv6_set;
+ mp->dst_address.af = ipv6_set;
mp->instance = htonl (instance);
mp->encap_vrf_id = ntohl (encap_vrf_id);
mp->mcast_sw_if_index = ntohl (mcast_sw_if_index);
mp->vni = ntohl (vni);
mp->is_add = is_add;
- mp->is_ipv6 = ipv6_set;
S (mp);
W (ret);
(vl_api_vxlan_tunnel_details_t * mp)
{
vat_main_t *vam = &vat_main;
- ip46_address_t src = to_ip46 (mp->is_ipv6, mp->dst_address);
- ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->src_address);
+ ip46_address_t src =
+ to_ip46 (mp->dst_address.af, (u8 *) & mp->dst_address.un);
+ ip46_address_t dst =
+ to_ip46 (mp->dst_address.af, (u8 *) & mp->src_address.un);
print (vam->ofp, "%11d%11d%24U%24U%14d%18d%13d%19d",
ntohl (mp->sw_if_index),
vat_json_object_add_uint (node, "instance", ntohl (mp->instance));
- if (mp->is_ipv6)
+ if (mp->src_address.af)
{
struct in6_addr ip6;
- clib_memcpy (&ip6, mp->src_address, sizeof (ip6));
+ clib_memcpy (&ip6, mp->src_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "src_address", ip6);
- clib_memcpy (&ip6, mp->dst_address, sizeof (ip6));
+ clib_memcpy (&ip6, mp->dst_address.un.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "dst_address", ip6);
}
else
{
struct in_addr ip4;
- clib_memcpy (&ip4, mp->src_address, sizeof (ip4));
+ clib_memcpy (&ip4, mp->src_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "src_address", ip4);
- clib_memcpy (&ip4, mp->dst_address, sizeof (ip4));
+ clib_memcpy (&ip4, mp->dst_address.un.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "dst_address", ip4);
}
vat_json_object_add_uint (node, "encap_vrf_id", ntohl (mp->encap_vrf_id));
vat_json_object_add_uint (node, "decap_next_index",
ntohl (mp->decap_next_index));
vat_json_object_add_uint (node, "vni", ntohl (mp->vni));
- vat_json_object_add_uint (node, "is_ipv6", mp->is_ipv6 ? 1 : 0);
vat_json_object_add_uint (node, "mcast_sw_if_index",
ntohl (mp->mcast_sw_if_index));
}
u8 disable_indirect_desc = 0;
u8 *tag = 0;
u8 enable_gso = 0;
+ u8 enable_packed = 0;
int ret;
/* Shut up coverity */
disable_indirect_desc = 1;
else if (unformat (i, "gso"))
enable_gso = 1;
+ else if (unformat (i, "packed"))
+ enable_packed = 1;
else if (unformat (i, "tag %s", &tag))
;
else
mp->disable_mrg_rxbuf = disable_mrg_rxbuf;
mp->disable_indirect_desc = disable_indirect_desc;
mp->enable_gso = enable_gso;
+ mp->enable_packed = enable_packed;
clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
vec_free (file_name);
if (custom_dev_instance != ~0)
u8 sw_if_index_set = 0;
u32 sw_if_index = (u32) ~ 0;
u8 enable_gso = 0;
+ u8 enable_packed = 0;
int ret;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
is_server = 1;
else if (unformat (i, "gso"))
enable_gso = 1;
+ else if (unformat (i, "packed"))
+ enable_packed = 1;
else
break;
}
mp->sw_if_index = ntohl (sw_if_index);
mp->is_server = is_server;
mp->enable_gso = enable_gso;
+ mp->enable_packed = enable_packed;
clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
vec_free (file_name);
if (custom_dev_instance != ~0)
"crypto_key %U integ_alg %u integ_key %U flags %x "
"tunnel_src_addr %U tunnel_dst_addr %U "
"salt %u seq_outbound %lu last_seq_inbound %lu "
- "replay_window %lu\n",
+ "replay_window %lu stat_index %u\n",
ntohl (mp->entry.sad_id),
ntohl (mp->sw_if_index),
ntohl (mp->entry.spi),
&mp->entry.tunnel_dst, ntohl (mp->salt),
clib_net_to_host_u64 (mp->seq_outbound),
clib_net_to_host_u64 (mp->last_seq_inbound),
- clib_net_to_host_u64 (mp->replay_window));
+ clib_net_to_host_u64 (mp->replay_window), ntohl (mp->stat_index));
}
#define vl_api_ipsec_sa_details_t_endian vl_noop_handler
vat_json_object_add_address (node, "dst", &mp->entry.tunnel_dst);
vat_json_object_add_uint (node, "replay_window",
clib_net_to_host_u64 (mp->replay_window));
+ vat_json_object_add_uint (node, "stat_index", ntohl (mp->stat_index));
}
static int
/* *INDENT-OFF* */
/** Used for parsing LISP eids */
typedef CLIB_PACKED(struct{
- u8 addr[16]; /**< eid address */
+ union {
+ ip46_address_t ip;
+ mac_address_t mac;
+ lisp_nsh_api_t nsh;
+ } addr;
u32 len; /**< prefix length if IP */
u8 type; /**< type of eid */
}) lisp_eid_vat_t;
clib_memset (a, 0, sizeof (a[0]));
- if (unformat (input, "%U/%d", unformat_ip4_address, a->addr, &a->len))
- {
- a->type = 0; /* ipv4 type */
- }
- else if (unformat (input, "%U/%d", unformat_ip6_address, a->addr, &a->len))
+ if (unformat (input, "%U/%d", unformat_ip46_address, a->addr.ip, &a->len))
{
- a->type = 1; /* ipv6 type */
+ a->type = 0; /* ip prefix type */
}
- else if (unformat (input, "%U", unformat_ethernet_address, a->addr))
+ else if (unformat (input, "%U", unformat_ethernet_address, a->addr.mac))
{
- a->type = 2; /* mac type */
+ a->type = 1; /* mac type */
}
- else if (unformat (input, "%U", unformat_nsh_address, a->addr))
+ else if (unformat (input, "%U", unformat_nsh_address, a->addr.nsh))
{
- a->type = 3; /* NSH type */
- lisp_nsh_api_t *nsh = (lisp_nsh_api_t *) a->addr;
- nsh->spi = clib_host_to_net_u32 (nsh->spi);
+ a->type = 2; /* NSH type */
+ a->addr.nsh.spi = clib_host_to_net_u32 (a->addr.nsh.spi);
}
else
{
return 0;
}
- if ((a->type == 0 && a->len > 32) || (a->type == 1 && a->len > 128))
+ if (a->type == 0)
{
- return 0;
+ if (ip46_address_is_ip4 (&a->addr.ip))
+ return a->len > 32 ? 1 : 0;
+ else
+ return a->len > 128 ? 1 : 0;
}
return 1;
}
-static int
-lisp_eid_size_vat (u8 type)
+static void
+lisp_eid_put_vat (vl_api_eid_t * eid, const lisp_eid_vat_t * vat_eid)
{
- switch (type)
+ eid->type = vat_eid->type;
+ switch (eid->type)
{
- case 0:
- return 4;
- case 1:
- return 16;
- case 2:
- return 6;
- case 3:
- return 5;
+ case EID_TYPE_API_PREFIX:
+ if (ip46_address_is_ip4 (&vat_eid->addr.ip))
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip4,
+ &vat_eid->addr.ip.ip4, 4);
+ eid->address.prefix.address.af = ADDRESS_IP4;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ else
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip6,
+ &vat_eid->addr.ip.ip6, 16);
+ eid->address.prefix.address.af = ADDRESS_IP6;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ return;
+ case EID_TYPE_API_MAC:
+ clib_memcpy (&eid->address.mac, &vat_eid->addr.mac,
+ sizeof (eid->address.mac));
+ return;
+ case EID_TYPE_API_NSH:
+ clib_memcpy (&eid->address.nsh, &vat_eid->addr.nsh,
+ sizeof (eid->address.nsh));
+ return;
+ default:
+ ASSERT (0);
+ return;
}
- return 0;
-}
-
-static void
-lisp_eid_put_vat (u8 * dst, u8 eid[16], u8 type)
-{
- clib_memcpy (dst, eid, lisp_eid_size_vat (type));
}
static int
M (ONE_ADD_DEL_LOCAL_EID, mp);
mp->is_add = is_add;
- lisp_eid_put_vat (mp->eid, eid->addr, eid->type);
- mp->eid_type = eid->type;
- mp->prefix_len = eid->len;
+ lisp_eid_put_vat (&mp->eid, eid);
mp->vni = clib_host_to_net_u32 (vni);
- mp->key_id = clib_host_to_net_u16 (key_id);
+ mp->key.id = key_id;
clib_memcpy (mp->locator_set_name, locator_set_name,
vec_len (locator_set_name));
- clib_memcpy (mp->key, key, vec_len (key));
+ clib_memcpy (mp->key.key, key, vec_len (key));
vec_free (locator_set_name);
vec_free (key);
else if (unformat (input, "loc-pair %U %U", unformat_ip4_address,
&lcl_rloc4, unformat_ip4_address, &rmt_rloc4))
{
- rloc.is_ip4 = 1;
-
- clib_memcpy (&rloc.addr, &lcl_rloc4, sizeof (lcl_rloc4));
+ rloc.addr.af = 0;
+ clib_memcpy (&rloc.addr.un.ip4, &lcl_rloc4, sizeof (lcl_rloc4));
rloc.weight = 0;
vec_add1 (lcl_locs, rloc);
- clib_memcpy (&rloc.addr, &rmt_rloc4, sizeof (rmt_rloc4));
+ clib_memcpy (&rloc.addr.un.ip4, &rmt_rloc4, sizeof (rmt_rloc4));
vec_add1 (rmt_locs, rloc);
/* weight saved in rmt loc */
curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
else if (unformat (input, "loc-pair %U %U", unformat_ip6_address,
&lcl_rloc6, unformat_ip6_address, &rmt_rloc6))
{
- rloc.is_ip4 = 0;
- clib_memcpy (&rloc.addr, &lcl_rloc6, sizeof (lcl_rloc6));
+ rloc.addr.af = 1;
+ clib_memcpy (&rloc.addr.un.ip6, &lcl_rloc6, sizeof (lcl_rloc6));
rloc.weight = 0;
vec_add1 (lcl_locs, rloc);
- clib_memcpy (&rloc.addr, &rmt_rloc6, sizeof (rmt_rloc6));
+ clib_memcpy (&rloc.addr.un.ip6, &rmt_rloc6, sizeof (rmt_rloc6));
vec_add1 (rmt_locs, rloc);
/* weight saved in rmt loc */
curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
sizeof (vl_api_gpe_locator_t) * vec_len (rmt_locs) * 2);
mp->is_add = is_add;
- lisp_eid_put_vat (mp->rmt_eid, rmt_eid->addr, rmt_eid->type);
- lisp_eid_put_vat (mp->lcl_eid, lcl_eid->addr, lcl_eid->type);
- mp->eid_type = rmt_eid->type;
+ lisp_eid_put_vat (&mp->rmt_eid, rmt_eid);
+ lisp_eid_put_vat (&mp->lcl_eid, lcl_eid);
mp->dp_table = clib_host_to_net_u32 (dp_table);
mp->vni = clib_host_to_net_u32 (vni);
- mp->rmt_len = rmt_eid->len;
- mp->lcl_len = lcl_eid->len;
mp->action = action;
if (0 != rmt_locs && 0 != lcl_locs)
mp->is_add = is_add;
if (ipv6_set)
{
- mp->is_ipv6 = 1;
- clib_memcpy (mp->ip_address, &ipv6, sizeof (ipv6));
+ mp->ip_address.af = 1;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
}
else
{
- mp->is_ipv6 = 0;
- clib_memcpy (mp->ip_address, &ipv4, sizeof (ipv4));
+ mp->ip_address.af = 0;
+ clib_memcpy (mp->ip_address.un.ip4, &ipv4, sizeof (ipv4));
}
/* send it... */
mp->is_add = is_add;
if (ipv6_set)
{
- mp->is_ipv6 = 1;
- clib_memcpy (mp->ip_address, &ipv6, sizeof (ipv6));
+ mp->ip_address.af = 1;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
}
else
{
- mp->is_ipv6 = 0;
- clib_memcpy (mp->ip_address, &ipv4, sizeof (ipv4));
+ mp->ip_address.af = 0;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv4, sizeof (ipv4));
}
/* send it... */
unformat_input_t *input = vam->input;
vl_api_gpe_enable_disable_t *mp;
u8 is_set = 0;
- u8 is_en = 1;
+ u8 is_enable = 1;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
{
is_set = 1;
- is_en = 0;
+ is_enable = 0;
}
else
break;
/* Construct the API message */
M (GPE_ENABLE_DISABLE, mp);
- mp->is_en = is_en;
+ mp->is_enable = is_enable;
/* send it... */
S (mp);
unformat_input_t *input = vam->input;
vl_api_one_rloc_probe_enable_disable_t *mp;
u8 is_set = 0;
- u8 is_en = 0;
+ u8 is_enable = 0;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
is_set = 1;
/* Construct the API message */
M (ONE_RLOC_PROBE_ENABLE_DISABLE, mp);
- mp->is_enabled = is_en;
+ mp->is_enable = is_enable;
/* send it... */
S (mp);
unformat_input_t *input = vam->input;
vl_api_one_map_register_enable_disable_t *mp;
u8 is_set = 0;
- u8 is_en = 0;
+ u8 is_enable = 0;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
is_set = 1;
/* Construct the API message */
M (ONE_MAP_REGISTER_ENABLE_DISABLE, mp);
- mp->is_enabled = is_en;
+ mp->is_enable = is_enable;
/* send it... */
S (mp);
unformat_input_t *input = vam->input;
vl_api_one_enable_disable_t *mp;
u8 is_set = 0;
- u8 is_en = 0;
+ u8 is_enable = 0;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
{
/* Construct the API message */
M (ONE_ENABLE_DISABLE, mp);
- mp->is_en = is_en;
+ mp->is_enable = is_enable;
/* send it... */
S (mp);
unformat_input_t *input = vam->input;
vl_api_one_enable_disable_xtr_mode_t *mp;
u8 is_set = 0;
- u8 is_en = 0;
+ u8 is_enable = 0;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
{
/* Construct the API message */
M (ONE_ENABLE_DISABLE_XTR_MODE, mp);
- mp->is_en = is_en;
+ mp->is_enable = is_enable;
/* send it... */
S (mp);
unformat_input_t *input = vam->input;
vl_api_one_enable_disable_pitr_mode_t *mp;
u8 is_set = 0;
- u8 is_en = 0;
+ u8 is_enable = 0;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
{
/* Construct the API message */
M (ONE_ENABLE_DISABLE_PITR_MODE, mp);
- mp->is_en = is_en;
+ mp->is_enable = is_enable;
/* send it... */
S (mp);
unformat_input_t *input = vam->input;
vl_api_one_enable_disable_petr_mode_t *mp;
u8 is_set = 0;
- u8 is_en = 0;
+ u8 is_enable = 0;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
{
/* Construct the API message */
M (ONE_ENABLE_DISABLE_PETR_MODE, mp);
- mp->is_en = is_en;
+ mp->is_enable = is_enable;
/* send it... */
S (mp);
M (ONE_ADD_DEL_NDP_ENTRY, mp);
mp->is_add = is_add;
- clib_memcpy (mp->mac, mac, 6);
+ clib_memcpy (&mp->entry.mac, mac, 6);
mp->bd = clib_host_to_net_u32 (bd);
- clib_memcpy (mp->ip6, ip6, sizeof (mp->ip6));
+ clib_memcpy (&mp->entry.ip6, ip6, sizeof (mp->entry.ip6));
/* send */
S (mp);
M (ONE_ADD_DEL_L2_ARP_ENTRY, mp);
mp->is_add = is_add;
- clib_memcpy (mp->mac, mac, 6);
+ clib_memcpy (&mp->entry.mac, mac, 6);
mp->bd = clib_host_to_net_u32 (bd);
- mp->ip4 = ip4;
+ clib_memcpy (mp->entry.ip4, &ip4, sizeof (mp->entry.ip4));
/* send */
S (mp);
vl_api_one_stats_enable_disable_t *mp;
unformat_input_t *input = vam->input;
u8 is_set = 0;
- u8 is_en = 0;
+ u8 is_enable = 0;
int ret;
/* Parse args required to build the message */
if (unformat (input, "enable"))
{
is_set = 1;
- is_en = 1;
+ is_enable = 1;
}
else if (unformat (input, "disable"))
{
}
M (ONE_STATS_ENABLE_DISABLE, mp);
- mp->is_en = is_en;
+ mp->is_enable = is_enable;
/* send */
S (mp);
mp->is_add = is_add;
if (is_add)
{
- mp->is_ip4 = ip_addr_version (&ip) == AF_IP4 ? 1 : 0;
- if (mp->is_ip4)
- clib_memcpy (mp->address, &ip, 4);
+ mp->ip_address.af = ip_addr_version (&ip) == AF_IP4 ? 0 : 1;
+ if (mp->ip_address.af)
+ clib_memcpy (mp->ip_address.un.ip6, &ip, 16);
else
- clib_memcpy (mp->address, &ip, 16);
+ clib_memcpy (mp->ip_address.un.ip4, &ip, 4);
}
/* send */
}
else if (unformat (input, "rloc %U", unformat_ip4_address, &rloc4))
{
- rloc.is_ip4 = 1;
- clib_memcpy (&rloc.addr, &rloc4, sizeof (rloc4));
+ rloc.ip_address.af = 0;
+ clib_memcpy (&rloc.ip_address.un.ip6, &rloc6, sizeof (rloc6));
vec_add1 (rlocs, rloc);
curr_rloc = &rlocs[vec_len (rlocs) - 1];
}
else if (unformat (input, "rloc %U", unformat_ip6_address, &rloc6))
{
- rloc.is_ip4 = 0;
- clib_memcpy (&rloc.addr, &rloc6, sizeof (rloc6));
+ rloc.ip_address.af = 1;
+ clib_memcpy (&rloc.ip_address.un.ip4, &rloc4, sizeof (rloc4));
vec_add1 (rlocs, rloc);
curr_rloc = &rlocs[vec_len (rlocs) - 1];
}
mp->vni = htonl (vni);
mp->action = (u8) action;
mp->is_src_dst = seid_set;
- mp->eid_len = eid->len;
- mp->seid_len = seid->len;
mp->del_all = del_all;
- mp->eid_type = eid->type;
- lisp_eid_put_vat (mp->eid, eid->addr, eid->type);
- lisp_eid_put_vat (mp->seid, seid->addr, seid->type);
+ lisp_eid_put_vat (&mp->deid, eid);
+ lisp_eid_put_vat (&mp->seid, seid);
mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
clib_memcpy (mp->rlocs, rlocs, data_len);
unformat_input_t *input = vam->input;
vl_api_one_add_del_adjacency_t *mp;
u32 vni = 0;
- ip4_address_t leid4, reid4;
- ip6_address_t leid6, reid6;
- u8 reid_mac[6] = { 0 };
- u8 leid_mac[6] = { 0 };
- u8 reid_type, leid_type;
- u32 leid_len = 0, reid_len = 0, len;
u8 is_add = 1;
int ret;
+ lisp_eid_vat_t leid, reid;
- leid_type = reid_type = (u8) ~ 0;
+ leid.type = reid.type = (u8) ~ 0;
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
is_add = 1;
}
- else if (unformat (input, "reid %U/%d", unformat_ip4_address,
- &reid4, &len))
- {
- reid_type = 0; /* ipv4 */
- reid_len = len;
- }
- else if (unformat (input, "reid %U/%d", unformat_ip6_address,
- &reid6, &len))
+ else if (unformat (input, "reid %U/%d", unformat_ip46_address,
+ &reid.addr.ip, &reid.len))
{
- reid_type = 1; /* ipv6 */
- reid_len = len;
+ reid.type = 0; /* ipv4 */
}
else if (unformat (input, "reid %U", unformat_ethernet_address,
- reid_mac))
- {
- reid_type = 2; /* mac */
- }
- else if (unformat (input, "leid %U/%d", unformat_ip4_address,
- &leid4, &len))
+ &reid.addr.mac))
{
- leid_type = 0; /* ipv4 */
- leid_len = len;
+ reid.type = 1; /* mac */
}
- else if (unformat (input, "leid %U/%d", unformat_ip6_address,
- &leid6, &len))
+ else if (unformat (input, "leid %U/%d", unformat_ip46_address,
+ &leid.addr.ip, &leid.len))
{
- leid_type = 1; /* ipv6 */
- leid_len = len;
+ leid.type = 0; /* ipv4 */
}
else if (unformat (input, "leid %U", unformat_ethernet_address,
- leid_mac))
+ &leid.addr.mac))
{
- leid_type = 2; /* mac */
+ leid.type = 1; /* mac */
}
else if (unformat (input, "vni %d", &vni))
{
}
}
- if ((u8) ~ 0 == reid_type)
+ if ((u8) ~ 0 == reid.type)
{
errmsg ("missing params!");
return -99;
}
- if (leid_type != reid_type)
+ if (leid.type != reid.type)
{
errmsg ("remote and local EIDs are of different types!");
return -99;
M (ONE_ADD_DEL_ADJACENCY, mp);
mp->is_add = is_add;
mp->vni = htonl (vni);
- mp->leid_len = leid_len;
- mp->reid_len = reid_len;
- mp->eid_type = reid_type;
-
- switch (mp->eid_type)
- {
- case 0:
- clib_memcpy (mp->leid, &leid4, sizeof (leid4));
- clib_memcpy (mp->reid, &reid4, sizeof (reid4));
- break;
- case 1:
- clib_memcpy (mp->leid, &leid6, sizeof (leid6));
- clib_memcpy (mp->reid, &reid6, sizeof (reid6));
- break;
- case 2:
- clib_memcpy (mp->leid, leid_mac, 6);
- clib_memcpy (mp->reid, reid_mac, 6);
- break;
- default:
- errmsg ("unknown EID type %d!", mp->eid_type);
- return 0;
- }
+ lisp_eid_put_vat (&mp->leid, &leid);
+ lisp_eid_put_vat (&mp->reid, &reid);
/* send it... */
S (mp);
/* Construct the API message */
M (GPE_SET_ENCAP_MODE, mp);
- mp->mode = mode;
+ mp->is_vxlan = mode;
/* send it... */
S (mp);
unformat_input_t *i = vam->input;
vl_api_one_eid_table_dump_t *mp;
vl_api_control_ping_t *mp_ping;
- struct in_addr ip4;
- struct in6_addr ip6;
- u8 mac[6];
- u8 eid_type = ~0, eid_set = 0;
- u32 prefix_length = ~0, t, vni = 0;
u8 filter = 0;
int ret;
- lisp_nsh_api_t nsh;
+ u32 vni, t = 0;
+ lisp_eid_vat_t eid;
+ u8 eid_set = 0;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (i, "eid %U/%d", unformat_ip4_address, &ip4, &t))
- {
- eid_set = 1;
- eid_type = 0;
- prefix_length = t;
- }
- else if (unformat (i, "eid %U/%d", unformat_ip6_address, &ip6, &t))
+ if (unformat
+ (i, "eid %U/%d", unformat_ip46_address, &eid.addr.ip, &eid.len))
{
eid_set = 1;
- eid_type = 1;
- prefix_length = t;
+ eid.type = 0;
}
- else if (unformat (i, "eid %U", unformat_ethernet_address, mac))
+ else
+ if (unformat (i, "eid %U", unformat_ethernet_address, &eid.addr.mac))
{
eid_set = 1;
- eid_type = 2;
+ eid.type = 1;
}
- else if (unformat (i, "eid %U", unformat_nsh_address, &nsh))
+ else if (unformat (i, "eid %U", unformat_nsh_address, &eid.addr.nsh))
{
eid_set = 1;
- eid_type = 3;
+ eid.type = 2;
}
else if (unformat (i, "vni %d", &t))
{
{
mp->eid_set = 1;
mp->vni = htonl (vni);
- mp->eid_type = eid_type;
- switch (eid_type)
- {
- case 0:
- mp->prefix_length = prefix_length;
- clib_memcpy (mp->eid, &ip4, sizeof (ip4));
- break;
- case 1:
- mp->prefix_length = prefix_length;
- clib_memcpy (mp->eid, &ip6, sizeof (ip6));
- break;
- case 2:
- clib_memcpy (mp->eid, mac, sizeof (mac));
- break;
- case 3:
- clib_memcpy (mp->eid, &nsh, sizeof (nsh));
- break;
- default:
- errmsg ("unknown EID type %d!", eid_type);
- return -99;
- }
+ lisp_eid_put_vat (&mp->eid, &eid);
}
/* send it... */
mp->is_add = is_add;
mp->table_id = clib_host_to_net_u32 (table_id);
mp->nh_sw_if_index = clib_host_to_net_u32 (nh_sw_if_index);
- mp->is_ip4 = is_ip4;
+ mp->nh_addr.af = is_ip4 ? 0 : 1;
if (is_ip4)
- clib_memcpy (mp->nh_addr, &ip4, sizeof (ip4));
+ clib_memcpy (mp->nh_addr.un.ip4, &ip4, sizeof (ip4));
else
- clib_memcpy (mp->nh_addr, &ip6, sizeof (ip6));
+ clib_memcpy (mp->nh_addr.un.ip6, &ip6, sizeof (ip6));
/* send it... */
S (mp);
mp->rate_type = rate_type;
mp->round_type = round_type;
mp->type = type;
- mp->conform_action_type = conform_action.action_type;
- mp->conform_dscp = conform_action.dscp;
- mp->exceed_action_type = exceed_action.action_type;
- mp->exceed_dscp = exceed_action.dscp;
- mp->violate_action_type = violate_action.action_type;
- mp->violate_dscp = violate_action.dscp;
+ mp->conform_action.type = conform_action.action_type;
+ mp->conform_action.dscp = conform_action.dscp;
+ mp->exceed_action.type = exceed_action.action_type;
+ mp->exceed_action.dscp = exceed_action.dscp;
+ mp->violate_action.type = violate_action.action_type;
+ mp->violate_action.dscp = violate_action.dscp;
mp->color_aware = color_aware;
S (mp);
static u8 *
format_vl_api_ip_address_union (u8 * s, va_list * args)
{
- vl_api_address_family_t af = va_arg (*args, vl_api_address_family_t);
+ vl_api_address_family_t af = va_arg (*args, int);
const vl_api_address_union_t *u = va_arg (*args, vl_api_address_union_t *);
switch (af)
clib_memcpy (&ip4, &fp->nh.address.ip4, sizeof (ip4));
vat_json_object_add_ip4 (node, "next_hop", ip4);
}
- else if (fp->proto == FIB_API_PATH_NH_PROTO_IP4)
+ else if (fp->proto == FIB_API_PATH_NH_PROTO_IP6)
{
clib_memcpy (&ip6, &fp->nh.address.ip6, sizeof (ip6));
vat_json_object_add_ip6 (node, "next_hop", ip6);
_(bridge_flags, \
"bd_id <bridge-domain-id> [learn] [forward] [uu-flood] [flood] [arp-term] [disable]\n") \
_(tap_create_v2, \
- "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload] [persist] [attach]") \
+ "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload | gro-coalesce] [persist] [attach] [tun]") \
_(tap_delete_v2, \
"<vpp-if-name> | sw_if_index <id>") \
_(sw_interface_tap_v2_dump, "") \
_(create_vhost_user_if, \
"socket <filename> [server] [renumber <dev_instance>] " \
"[disable_mrg_rxbuf] [disable_indirect_desc] [gso] " \
- "[mac <mac_address>]") \
+ "[mac <mac_address>] [packed]") \
_(modify_vhost_user_if, \
"<intfc> | sw_if_index <nn> socket <filename>\n" \
- "[server] [renumber <dev_instance>] [gso]") \
+ "[server] [renumber <dev_instance>] [gso] [packed]") \
_(delete_vhost_user_if, "<intfc> | sw_if_index <nn>") \
_(sw_interface_vhost_user_dump, "") \
_(show_version, "") \