{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
- u32 length = ntohl (mp->length);
+ u32 length = vl_api_string_len (&mp->reply);
vec_reset_length (vam->cmd_reply);
if (retval == 0)
{
vec_validate (vam->cmd_reply, length);
- clib_memcpy ((char *) (vam->cmd_reply), mp->reply, length);
+ clib_memcpy ((char *) (vam->cmd_reply),
+ vl_api_from_api_string (&mp->reply), length);
vam->cmd_reply[length] = 0;
}
vam->result_ready = 1;
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_object_add_string_copy (&node, "reply",
+ vl_api_from_api_string (&mp->reply));
vat_json_print (vam->ofp, &node);
vat_json_free (&node);
if (retval >= 0)
{
- errmsg (" program: %s", mp->program);
- errmsg (" version: %s", mp->version);
- errmsg (" build date: %s", mp->build_date);
- errmsg ("build directory: %s", mp->build_directory);
+ char *s;
+ char *p = (char *) &mp->program;
+
+ s = vl_api_from_api_string_c ((vl_api_string_t *) p);
+ errmsg (" program: %s\n", s);
+ free (s);
+
+ p +=
+ vl_api_string_len ((vl_api_string_t *) p) + sizeof (vl_api_string_t);
+ s = vl_api_from_api_string_c ((vl_api_string_t *) p);
+ errmsg (" version: %s\n", s);
+ free (s);
+
+ p +=
+ vl_api_string_len ((vl_api_string_t *) p) + sizeof (vl_api_string_t);
+ s = vl_api_from_api_string_c ((vl_api_string_t *) p);
+ errmsg (" build date: %s\n", s);
+ free (s);
+
+ p +=
+ vl_api_string_len ((vl_api_string_t *) p) + sizeof (vl_api_string_t);
+ s = vl_api_from_api_string_c ((vl_api_string_t *) p);
+ errmsg ("build directory: %s\n", s);
+ free (s);
}
vam->retval = retval;
vam->result_ready = 1;
vat_json_init_object (&node);
vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_string_copy (&node, "program", mp->program);
- vat_json_object_add_string_copy (&node, "version", mp->version);
- vat_json_object_add_string_copy (&node, "build_date", mp->build_date);
+ char *p = (char *) &mp->program;
+ vat_json_object_add_string_copy (&node, "program",
+ vl_api_from_api_string ((vl_api_string_t *)
+ p));
+ p += vl_api_string_len ((vl_api_string_t *) p) + sizeof (u32);
+ vat_json_object_add_string_copy (&node, "version",
+ vl_api_from_api_string ((vl_api_string_t *)
+ p));
+ p += vl_api_string_len ((vl_api_string_t *) p) + sizeof (u32);
+ vat_json_object_add_string_copy (&node, "build_date",
+ vl_api_from_api_string ((vl_api_string_t *)
+ p));
+ p += vl_api_string_len ((vl_api_string_t *) p) + sizeof (u32);
vat_json_object_add_string_copy (&node, "build_directory",
- mp->build_directory);
+ vl_api_from_api_string ((vl_api_string_t *)
+ p));
vat_json_print (vam->ofp, &node);
vat_json_free (&node);
_(dhcp_client_config_reply) \
_(set_ip_flow_hash_reply) \
_(sw_interface_ip6_enable_disable_reply) \
-_(sw_interface_ip6_set_link_local_address_reply) \
_(ip6nd_proxy_add_del_reply) \
_(sw_interface_ip6nd_ra_prefix_reply) \
_(sw_interface_ip6nd_ra_config_reply) \
_(ip_source_and_port_range_check_interface_add_del_reply)\
_(delete_subif_reply) \
_(l2_interface_pbb_tag_rewrite_reply) \
-_(punt_reply) \
+_(set_punt_reply) \
_(feature_enable_disable_reply) \
_(sw_interface_tag_add_del_reply) \
_(hw_interface_set_mtu_reply) \
_(SET_IP_FLOW_HASH_REPLY, set_ip_flow_hash_reply) \
_(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY, \
sw_interface_ip6_enable_disable_reply) \
-_(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY, \
- sw_interface_ip6_set_link_local_address_reply) \
_(IP6ND_PROXY_ADD_DEL_REPLY, ip6nd_proxy_add_del_reply) \
_(IP6ND_PROXY_DETAILS, ip6nd_proxy_details) \
_(SW_INTERFACE_IP6ND_RA_PREFIX_REPLY, \
_(IPSEC_GRE_TUNNEL_DETAILS, ipsec_gre_tunnel_details) \
_(DELETE_SUBIF_REPLY, delete_subif_reply) \
_(L2_INTERFACE_PBB_TAG_REWRITE_REPLY, l2_interface_pbb_tag_rewrite_reply) \
-_(PUNT_REPLY, punt_reply) \
+_(SET_PUNT_REPLY, set_punt_reply) \
_(IP_FIB_DETAILS, ip_fib_details) \
_(IP6_FIB_DETAILS, ip6_fib_details) \
_(FEATURE_ENABLE_DISABLE_REPLY, feature_enable_disable_reply) \
*/
u32 len = vec_len (vam->input->buffer);
M2 (CLI_INBAND, mp, len);
- clib_memcpy (mp->cmd, vam->input->buffer, len);
- mp->length = htonl (len);
+ vl_api_to_api_string (len - 1, (const char *) vam->input->buffer, &mp->cmd);
S (mp);
W (ret);
static int
api_bd_ip_mac_add_del (vat_main_t * vam)
{
+ vl_api_address_t ip = VL_API_ZERO_ADDRESS;
+ vl_api_mac_address_t mac = VL_API_ZERO_MAC_ADDRESS;
unformat_input_t *i = vam->input;
vl_api_bd_ip_mac_add_del_t *mp;
+ ip46_type_t type;
u32 bd_id;
u8 is_ipv6 = 0;
u8 is_add = 1;
u8 bd_id_set = 0;
u8 ip_set = 0;
u8 mac_set = 0;
- ip4_address_t v4addr;
- ip6_address_t v6addr;
u8 macaddr[6];
int ret;
{
bd_id_set++;
}
- else if (unformat (i, "%U", unformat_ip4_address, &v4addr))
+ else if (unformat (i, "%U", unformat_vl_api_address, &ip))
{
ip_set++;
}
- else if (unformat (i, "%U", unformat_ip6_address, &v6addr))
- {
- ip_set++;
- is_ipv6++;
- }
- else if (unformat (i, "%U", unformat_ethernet_address, macaddr))
+ else if (unformat (i, "%U", unformat_vl_api_mac_address, &mac))
{
mac_set++;
}
M (BD_IP_MAC_ADD_DEL, mp);
mp->bd_id = ntohl (bd_id);
- mp->is_ipv6 = is_ipv6;
mp->is_add = is_add;
- if (is_ipv6)
- clib_memcpy (mp->ip_address, &v6addr, sizeof (v6addr));
- else
- clib_memcpy (mp->ip_address, &v4addr, sizeof (v4addr));
- clib_memcpy (mp->mac_address, macaddr, 6);
+
+ clib_memcpy (&mp->ip, &ip, sizeof (ip));
+ clib_memcpy (&mp->mac, &mac, sizeof (mac));
+
S (mp);
W (ret);
return ret;
return ret;
}
-static int
-api_sw_interface_ip6_set_link_local_address (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sw_interface_ip6_set_link_local_address_t *mp;
- u32 sw_if_index;
- u8 sw_if_index_set = 0;
- u8 v6_address_set = 0;
- ip6_address_t v6address;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "%U", unformat_ip6_address, &v6address))
- v6_address_set = 1;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing interface name or sw_if_index");
- return -99;
- }
- if (!v6_address_set)
- {
- errmsg ("no address set");
- return -99;
- }
-
- /* Construct the API message */
- M (SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
- clib_memcpy (mp->address, &v6address, sizeof (v6address));
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply, return good/bad news */
- W (ret);
- return ret;
-}
-
static int
api_ip6nd_proxy_add_del (vat_main_t * vam)
{
print (vam->ofp,
" weight %d, sw_if_index %d, is_local %d, is_drop %d, "
"is_unreach %d, is_prohitbit %d, afi %d, next_hop %U",
- ntohl (fp->weight), ntohl (fp->sw_if_index), fp->is_local,
+ fp->weight, ntohl (fp->sw_if_index), fp->is_local,
fp->is_drop, fp->is_unreach, fp->is_prohibit, fp->afi,
format_ip6_address, fp->next_hop);
else if (fp->afi == IP46_TYPE_IP4)
print (vam->ofp,
" weight %d, sw_if_index %d, is_local %d, is_drop %d, "
"is_unreach %d, is_prohitbit %d, afi %d, next_hop %U",
- ntohl (fp->weight), ntohl (fp->sw_if_index), fp->is_local,
+ fp->weight, ntohl (fp->sw_if_index), fp->is_local,
fp->is_drop, fp->is_unreach, fp->is_prohibit, fp->afi,
format_ip4_address, fp->next_hop);
}
}
static int
-api_punt (vat_main_t * vam)
+api_set_punt (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_punt_t *mp;
+ vl_api_set_punt_t *mp;
u32 ipv = ~0;
u32 protocol = ~0;
u32 port = ~0;
}
}
- M (PUNT, mp);
+ M (SET_PUNT, mp);
mp->is_add = (u8) is_add;
- mp->ipv = (u8) ipv;
- mp->l4_protocol = (u8) protocol;
- mp->l4_port = htons ((u16) port);
+ mp->punt.ipv = (u8) ipv;
+ mp->punt.l4_protocol = (u8) protocol;
+ mp->punt.l4_port = htons ((u16) port);
S (mp);
W (ret);
"vrf <n> [src] [dst] [sport] [dport] [proto] [reverse] [ipv6]") \
_(sw_interface_ip6_enable_disable, \
"<intfc> | sw_if_index <id> enable | disable") \
-_(sw_interface_ip6_set_link_local_address, \
- "<intfc> | sw_if_index <id> <ip6-address>/<mask-width>") \
_(ip6nd_proxy_add_del, \
"<intfc> | sw_if_index <id> <ip6-address>") \
_(ip6nd_proxy_dump, "") \
"<intfc> | sw_if_index <nn> \n" \
"[disable | push | pop | translate_pbb_stag <outer_tag>] \n" \
"dmac <mac> smac <mac> sid <nn> [vlanid <nn>]") \
-_(punt, "protocol <l4-protocol> [ip <ver>] [port <l4-port>] [del]") \
+_(set_punt, "protocol <l4-protocol> [ip <ver>] [port <l4-port>] [del]") \
_(flow_classify_set_interface, \
"<intfc> | sw_if_index <nn> [ip4-table <nn>] [ip6-table <nn>] [del]") \
_(flow_classify_dump, "type [ip4|ip6]") \