summaryrefslogtreecommitdiffstats
path: root/src/vat/api_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r--src/vat/api_format.c78
1 files changed, 40 insertions, 38 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index ec21c045f5c..7aa46f4015f 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -974,7 +974,8 @@ static void vl_api_sw_interface_details_t_handler
(vl_api_sw_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
- u8 *s = format (0, "%s%c", mp->interface_name, 0);
+ u8 *s = format (0, "%s%c",
+ vl_api_from_api_string (&mp->interface_name), 0);
hash_set_mem (vam->sw_if_index_by_interface_name, s,
ntohl (mp->sw_if_index));
@@ -992,14 +993,11 @@ static void vl_api_sw_interface_details_t_handler
sub->sw_if_index = ntohl (mp->sw_if_index);
sub->sub_id = ntohl (mp->sub_id);
- sub->sub_dot1ad = mp->sub_dot1ad;
+ sub->raw_flags = ntohl (mp->sub_if_flags & SUB_IF_API_FLAG_MASK_VNET);
+
sub->sub_number_of_tags = mp->sub_number_of_tags;
sub->sub_outer_vlan_id = ntohs (mp->sub_outer_vlan_id);
sub->sub_inner_vlan_id = ntohs (mp->sub_inner_vlan_id);
- sub->sub_exact_match = mp->sub_exact_match;
- sub->sub_default = mp->sub_default;
- sub->sub_outer_vlan_id_any = mp->sub_outer_vlan_id_any;
- sub->sub_inner_vlan_id_any = mp->sub_inner_vlan_id_any;
/* vlan tag rewrite */
sub->vtr_op = ntohl (mp->vtr_op);
@@ -1026,37 +1024,28 @@ static void vl_api_sw_interface_details_t_handler_json
vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
vat_json_object_add_uint (node, "sup_sw_if_index",
ntohl (mp->sup_sw_if_index));
- vat_json_object_add_uint (node, "l2_address_length",
- ntohl (mp->l2_address_length));
vat_json_object_add_bytes (node, "l2_address", mp->l2_address,
sizeof (mp->l2_address));
vat_json_object_add_string_copy (node, "interface_name",
- mp->interface_name);
- vat_json_object_add_uint (node, "admin_up_down", mp->admin_up_down);
- vat_json_object_add_uint (node, "link_up_down", mp->link_up_down);
+ mp->interface_name.buf);
+ vat_json_object_add_uint (node, "flags", mp->flags);
vat_json_object_add_uint (node, "link_duplex", mp->link_duplex);
vat_json_object_add_uint (node, "link_speed", mp->link_speed);
vat_json_object_add_uint (node, "mtu", ntohs (mp->link_mtu));
vat_json_object_add_uint (node, "sub_id", ntohl (mp->sub_id));
- vat_json_object_add_uint (node, "sub_dot1ad", mp->sub_dot1ad);
vat_json_object_add_uint (node, "sub_number_of_tags",
mp->sub_number_of_tags);
vat_json_object_add_uint (node, "sub_outer_vlan_id",
ntohs (mp->sub_outer_vlan_id));
vat_json_object_add_uint (node, "sub_inner_vlan_id",
ntohs (mp->sub_inner_vlan_id));
- vat_json_object_add_uint (node, "sub_exact_match", mp->sub_exact_match);
- vat_json_object_add_uint (node, "sub_default", mp->sub_default);
- vat_json_object_add_uint (node, "sub_outer_vlan_id_any",
- mp->sub_outer_vlan_id_any);
- vat_json_object_add_uint (node, "sub_inner_vlan_id_any",
- mp->sub_inner_vlan_id_any);
+ vat_json_object_add_uint (node, "sub_if_flags", ntohl (mp->sub_if_flags));
vat_json_object_add_uint (node, "vtr_op", ntohl (mp->vtr_op));
vat_json_object_add_uint (node, "vtr_push_dot1q",
ntohl (mp->vtr_push_dot1q));
vat_json_object_add_uint (node, "vtr_tag1", ntohl (mp->vtr_tag1));
vat_json_object_add_uint (node, "vtr_tag2", ntohl (mp->vtr_tag2));
- if (mp->sub_dot1ah)
+ if (ntohl (mp->sub_if_flags) & SUB_IF_API_FLAG_DOT1AH)
{
vat_json_object_add_string_copy (node, "pbb_vtr_dmac",
format (0, "%U",
@@ -1079,8 +1068,10 @@ static void vl_api_sw_interface_event_t_handler
if (vam->interface_event_display)
errmsg ("interface flags: sw_if_index %d %s %s",
ntohl (mp->sw_if_index),
- mp->admin_up_down ? "admin-up" : "admin-down",
- mp->link_up_down ? "link-up" : "link-down");
+ ((ntohl (mp->flags)) & IF_STATUS_API_FLAG_ADMIN_UP) ?
+ "admin-up" : "admin-down",
+ ((ntohl (mp->flags)) & IF_STATUS_API_FLAG_LINK_UP) ?
+ "link-up" : "link-down");
}
#endif
@@ -6016,7 +6007,7 @@ api_sw_interface_set_flags (vat_main_t * vam)
/* Construct the API message */
M (SW_INTERFACE_SET_FLAGS, mp);
mp->sw_if_index = ntohl (sw_if_index);
- mp->admin_up_down = admin_up;
+ mp->flags = ntohl ((admin_up) ? IF_STATUS_API_FLAG_ADMIN_UP : 0);
/* send it... */
S (mp);
@@ -6072,7 +6063,7 @@ api_sw_interface_set_rx_mode (vat_main_t * vam)
/* Construct the API message */
M (SW_INTERFACE_SET_RX_MODE, mp);
mp->sw_if_index = ntohl (sw_if_index);
- mp->mode = mode;
+ mp->mode = (vl_api_rx_mode_t) mode;
mp->queue_id_valid = queue_id_valid;
mp->queue_id = queue_id_valid ? ntohl (queue_id) : ~0;
@@ -6308,14 +6299,15 @@ api_sw_interface_add_del_address (vat_main_t * vam)
mp->del_all = del_all;
if (v6_address_set)
{
- mp->is_ipv6 = 1;
- clib_memcpy (mp->address, &v6address, sizeof (v6address));
+ mp->prefix.address.af = ADDRESS_IP6;
+ clib_memcpy (mp->prefix.address.un.ip6, &v6address, sizeof (v6address));
}
else
{
- clib_memcpy (mp->address, &v4address, sizeof (v4address));
+ mp->prefix.address.af = ADDRESS_IP4;
+ clib_memcpy (mp->prefix.address.un.ip4, &v4address, sizeof (v4address));
}
- mp->address_length = address_length;
+ mp->prefix.len = address_length;
/* send it... */
S (mp);
@@ -9221,6 +9213,16 @@ _(default_sub) \
_(outer_vlan_id_any) \
_(inner_vlan_id_any)
+#define foreach_create_subif_flag \
+_(0, "no_tags") \
+_(1, "one_tag") \
+_(2, "two_tags") \
+_(3, "dot1ad") \
+_(4, "exact_match") \
+_(5, "default_sub") \
+_(6, "outer_vlan_id_any") \
+_(7, "inner_vlan_id_any")
+
static int
api_create_subif (vat_main_t * vam)
{
@@ -9230,14 +9232,14 @@ api_create_subif (vat_main_t * vam)
u8 sw_if_index_set = 0;
u32 sub_id;
u8 sub_id_set = 0;
- u32 no_tags = 0;
- u32 one_tag = 0;
- u32 two_tags = 0;
- u32 dot1ad = 0;
- u32 exact_match = 0;
- u32 default_sub = 0;
- u32 outer_vlan_id_any = 0;
- u32 inner_vlan_id_any = 0;
+ u32 __attribute__ ((unused)) no_tags = 0;
+ u32 __attribute__ ((unused)) one_tag = 0;
+ u32 __attribute__ ((unused)) two_tags = 0;
+ u32 __attribute__ ((unused)) dot1ad = 0;
+ u32 __attribute__ ((unused)) exact_match = 0;
+ u32 __attribute__ ((unused)) default_sub = 0;
+ u32 __attribute__ ((unused)) outer_vlan_id_any = 0;
+ u32 __attribute__ ((unused)) inner_vlan_id_any = 0;
u32 tmp;
u16 outer_vlan_id = 0;
u16 inner_vlan_id = 0;
@@ -9283,8 +9285,8 @@ api_create_subif (vat_main_t * vam)
mp->sw_if_index = ntohl (sw_if_index);
mp->sub_id = ntohl (sub_id);
-#define _(a) mp->a = a;
- foreach_create_subif_bit;
+#define _(a,b) mp->sub_if_flags |= (1 << a);
+ foreach_create_subif_flag;
#undef _
mp->outer_vlan_id = ntohs (outer_vlan_id);
@@ -20435,7 +20437,7 @@ api_sw_interface_tag_add_del (vat_main_t * vam)
mp->sw_if_index = ntohl (sw_if_index);
mp->is_add = enable;
if (enable)
- strncpy ((char *) mp->tag, (char *) tag, ARRAY_LEN (mp->tag) - 1);
+ vl_api_to_api_string (strlen ((char *) tag), (char *) tag, &mp->tag);
vec_free (tag);
S (mp);