static uword
api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
{
- vat_main_t *vam __attribute__ ((unused)) = va_arg (*args, vat_main_t *);
+ vat_main_t *vam __clib_unused = va_arg (*args, vat_main_t *);
vnet_main_t *vnm = vnet_get_main ();
u32 *result = va_arg (*args, u32 *);
static uword
api_unformat_hw_if_index (unformat_input_t * input, va_list * args)
{
- vat_main_t *vam __attribute__ ((unused)) = va_arg (*args, vat_main_t *);
+ vat_main_t *vam __clib_unused = va_arg (*args, vat_main_t *);
vnet_main_t *vnm = vnet_get_main ();
u32 *result = va_arg (*args, u32 *);
return 1;
}
+#if (VPP_API_TEST_BUILTIN==0)
+
static const char *mfib_flag_names[] = MFIB_ENTRY_NAMES_SHORT;
static const char *mfib_flag_long_names[] = MFIB_ENTRY_NAMES_LONG;
static const char *mfib_itf_flag_long_names[] = MFIB_ITF_NAMES_LONG;
static const char *mfib_itf_flag_names[] = MFIB_ITF_NAMES_SHORT;
-#if (VPP_API_TEST_BUILTIN==0)
uword
unformat_mfib_itf_flags (unformat_input_t * input, va_list * args)
{
a->as_u32 = ntohl (v);
}
+static void
+increment_vl_v4_address (vl_api_ip4_address_t * a)
+{
+ u32 v;
+
+ v = *(u32 *) a;
+ v = ntohl (v);
+ v++;
+ v = ntohl (v);
+ clib_memcpy (a, &v, sizeof (v));
+}
+
+static void
+increment_vl_address (vl_api_address_t * a)
+{
+ if (ADDRESS_IP4 == a->af)
+ increment_vl_v4_address (&a->un.ip4);
+}
+
static void
increment_v6_address (ip6_address_t * a)
{
}
#endif
-static void vl_api_sw_interface_event_t_handler_json
- (vl_api_sw_interface_event_t * mp)
+__clib_unused static void
+vl_api_sw_interface_event_t_handler_json (vl_api_sw_interface_event_t * mp)
{
/* JSON output not supported */
}
vam->result_ready = 1;
}
-static void vl_api_gre_add_del_tunnel_reply_t_handler
- (vl_api_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_gre_tunnel_add_del_reply_t_handler
+ (vl_api_gre_tunnel_add_del_reply_t * mp)
{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
}
}
-static void vl_api_gre_add_del_tunnel_reply_t_handler_json
- (vl_api_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_gre_tunnel_add_del_reply_t_handler_json
+ (vl_api_gre_tunnel_add_del_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
static void
vl_api_dhcp_compl_event_t_handler (vl_api_dhcp_compl_event_t * mp)
{
- errmsg ("DHCP compl event: pid %d %s hostname %s host_addr %U "
- "router_addr %U host_mac %U",
- ntohl (mp->pid), mp->lease.is_ipv6 ? "ipv6" : "ipv4",
- mp->lease.hostname,
- format_ip4_address, &mp->lease.host_address,
- format_ip4_address, &mp->lease.router_address,
- format_ethernet_address, mp->lease.host_mac);
+ u8 *s, i;
+
+ s = format (0, "DHCP compl event: pid %d %s hostname %s host_addr %U "
+ "host_mac %U router_addr %U",
+ ntohl (mp->pid), mp->lease.is_ipv6 ? "ipv6" : "ipv4",
+ mp->lease.hostname,
+ format_ip4_address, mp->lease.host_address,
+ format_ethernet_address, mp->lease.host_mac,
+ format_ip4_address, mp->lease.router_address);
+
+ for (i = 0; i < mp->lease.count; i++)
+ s =
+ format (s, " domain_server_addr %U", format_ip4_address,
+ mp->lease.domain_server[i].address);
+
+ errmsg ((char *) s);
+ vec_free (s);
}
static void vl_api_dhcp_compl_event_t_handler_json
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)
+static void vl_api_ipsec_gre_tunnel_add_del_reply_t_handler
+ (vl_api_ipsec_gre_tunnel_add_del_reply_t * mp)
{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
vam->regenerate_interface_table = 1;
}
-static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler_json
- (vl_api_ipsec_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_ipsec_gre_tunnel_add_del_reply_t_handler_json
+ (vl_api_ipsec_gre_tunnel_add_del_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
_(proxy_arp_intfc_enable_disable_reply) \
_(sw_interface_set_unnumbered_reply) \
_(ip_neighbor_add_del_reply) \
-_(oam_add_del_reply) \
_(reset_fib_reply) \
_(dhcp_proxy_config_reply) \
_(dhcp_proxy_set_vss_reply) \
_(ipsec_interface_add_del_spd_reply) \
_(ipsec_spd_entry_add_del_reply) \
_(ipsec_sad_entry_add_del_reply) \
-_(ipsec_sa_set_key_reply) \
_(ipsec_tunnel_if_add_del_reply) \
-_(ipsec_tunnel_if_set_key_reply) \
_(ipsec_tunnel_if_set_sa_reply) \
_(delete_loopback_reply) \
_(bd_ip_mac_add_del_reply) \
_(IP_NEIGHBOR_ADD_DEL_REPLY, ip_neighbor_add_del_reply) \
_(CREATE_VLAN_SUBIF_REPLY, create_vlan_subif_reply) \
_(CREATE_SUBIF_REPLY, create_subif_reply) \
-_(OAM_ADD_DEL_REPLY, oam_add_del_reply) \
_(RESET_FIB_REPLY, reset_fib_reply) \
_(DHCP_PROXY_CONFIG_REPLY, dhcp_proxy_config_reply) \
_(DHCP_PROXY_SET_VSS_REPLY, dhcp_proxy_set_vss_reply) \
_(GENEVE_ADD_DEL_TUNNEL_REPLY, geneve_add_del_tunnel_reply) \
_(VXLAN_TUNNEL_DETAILS, vxlan_tunnel_details) \
_(GENEVE_TUNNEL_DETAILS, geneve_tunnel_details) \
-_(GRE_ADD_DEL_TUNNEL_REPLY, gre_add_del_tunnel_reply) \
+_(GRE_TUNNEL_ADD_DEL_REPLY, gre_tunnel_add_del_reply) \
_(GRE_TUNNEL_DETAILS, gre_tunnel_details) \
_(L2_FIB_CLEAR_TABLE_REPLY, l2_fib_clear_table_reply) \
_(L2_INTERFACE_EFP_FILTER_REPLY, l2_interface_efp_filter_reply) \
_(IPSEC_SPD_ENTRY_ADD_DEL_REPLY, ipsec_spd_entry_add_del_reply) \
_(IPSEC_SAD_ENTRY_ADD_DEL_REPLY, ipsec_sad_entry_add_del_reply) \
_(IPSEC_SA_DETAILS, ipsec_sa_details) \
-_(IPSEC_SA_SET_KEY_REPLY, ipsec_sa_set_key_reply) \
_(IPSEC_TUNNEL_IF_ADD_DEL_REPLY, ipsec_tunnel_if_add_del_reply) \
-_(IPSEC_TUNNEL_IF_SET_KEY_REPLY, ipsec_tunnel_if_set_key_reply) \
_(IPSEC_TUNNEL_IF_SET_SA_REPLY, ipsec_tunnel_if_set_sa_reply) \
_(DELETE_LOOPBACK_REPLY, delete_loopback_reply) \
_(BD_IP_MAC_ADD_DEL_REPLY, bd_ip_mac_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) \
-_(IPSEC_GRE_ADD_DEL_TUNNEL_REPLY, ipsec_gre_add_del_tunnel_reply) \
+_(IPSEC_GRE_TUNNEL_ADD_DEL_REPLY, ipsec_gre_tunnel_add_del_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) \
vl_api_mac_address_t mac = { 0 };
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;
- u8 macaddr[6];
int ret;
vl_api_virtio_pci_create_t *mp;
u8 mac_address[6];
u8 random_mac = 1;
+ u8 gso_enabled = 0;
u32 pci_addr = 0;
u64 features = (u64) ~ (0ULL);
- u32 rx_ring_sz = 0, tx_ring_sz = 0;
int ret;
clib_memset (mac_address, 0, sizeof (mac_address));
;
else if (unformat (i, "features 0x%llx", &features))
;
- else if (unformat (i, "rx-ring-size %u", &rx_ring_sz))
- ;
- else if (unformat (i, "tx-ring-size %u", &tx_ring_sz))
- ;
+ else if (unformat (i, "gso-enabled"))
+ gso_enabled = 1;
else
break;
}
errmsg ("pci address must be non zero. ");
return -99;
}
- if (!is_pow2 (rx_ring_sz))
- {
- errmsg ("rx ring size must be power of 2. ");
- return -99;
- }
- if (rx_ring_sz > 32768)
- {
- errmsg ("rx ring size must be 32768 or lower. ");
- return -99;
- }
- if (!is_pow2 (tx_ring_sz))
- {
- errmsg ("tx ring size must be power of 2. ");
- return -99;
- }
- if (tx_ring_sz > 32768)
- {
- errmsg ("tx ring size must be 32768 or lower. ");
- return -99;
- }
/* Construct the API message */
M (VIRTIO_PCI_CREATE, mp);
mp->pci_addr = htonl (pci_addr);
mp->features = clib_host_to_net_u64 (features);
- mp->rx_ring_sz = htons (rx_ring_sz);
- mp->tx_ring_sz = htons (tx_ring_sz);
+ mp->gso_enabled = gso_enabled;
if (random_mac == 0)
clib_memcpy (mp->mac_address, mac_address, 6);
return ret;
}
-static int
-api_oam_add_del (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_oam_add_del_t *mp;
- u32 vrf_id = 0;
- u8 is_add = 1;
- ip4_address_t src, dst;
- u8 src_set = 0;
- u8 dst_set = 0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "vrf %d", &vrf_id))
- ;
- else if (unformat (i, "src %U", unformat_ip4_address, &src))
- src_set = 1;
- else if (unformat (i, "dst %U", unformat_ip4_address, &dst))
- dst_set = 1;
- else if (unformat (i, "del"))
- is_add = 0;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (src_set == 0)
- {
- errmsg ("missing src addr");
- return -99;
- }
-
- if (dst_set == 0)
- {
- errmsg ("missing dst addr");
- return -99;
- }
-
- M (OAM_ADD_DEL, mp);
-
- mp->vrf_id = ntohl (vrf_id);
- mp->is_add = is_add;
- clib_memcpy (mp->src_address, &src, sizeof (mp->src_address));
- clib_memcpy (mp->dst_address, &dst, sizeof (mp->dst_address));
-
- S (mp);
- W (ret);
- return ret;
-}
-
static int
api_reset_fib (vat_main_t * vam)
{
vl_api_sw_interface_ip6nd_ra_prefix_t *mp;
u32 sw_if_index;
u8 sw_if_index_set = 0;
- u32 address_length = 0;
u8 v6_address_set = 0;
vl_api_prefix_t pfx;
u8 use_default = 0;
}
static int
-api_gre_add_del_tunnel (vat_main_t * vam)
+api_gre_tunnel_add_del (vat_main_t * vam)
{
unformat_input_t *line_input = vam->input;
- vl_api_gre_add_del_tunnel_t *mp;
- ip4_address_t src4, dst4;
- ip6_address_t src6, dst6;
+ vl_api_address_t src = { }, dst =
+ {
+ };
+ vl_api_gre_tunnel_add_del_t *mp;
+ vl_api_gre_tunnel_type_t t_type;
u8 is_add = 1;
- u8 ipv4_set = 0;
- u8 ipv6_set = 0;
- u8 t_type = GRE_TUNNEL_TYPE_L3;
u8 src_set = 0;
u8 dst_set = 0;
u32 outer_fib_id = 0;
u32 instance = ~0;
int ret;
- clib_memset (&src4, 0, sizeof src4);
- clib_memset (&dst4, 0, sizeof dst4);
- clib_memset (&src6, 0, sizeof src6);
- clib_memset (&dst6, 0, sizeof dst6);
+ t_type = GRE_API_TUNNEL_TYPE_L3;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
is_add = 0;
else if (unformat (line_input, "instance %d", &instance))
;
- else if (unformat (line_input, "src %U", unformat_ip4_address, &src4))
+ else if (unformat (line_input, "src %U", unformat_vl_api_address, &src))
{
src_set = 1;
- ipv4_set = 1;
}
- else if (unformat (line_input, "dst %U", unformat_ip4_address, &dst4))
+ else if (unformat (line_input, "dst %U", unformat_vl_api_address, &dst))
{
dst_set = 1;
- ipv4_set = 1;
- }
- else if (unformat (line_input, "src %U", unformat_ip6_address, &src6))
- {
- src_set = 1;
- ipv6_set = 1;
- }
- else if (unformat (line_input, "dst %U", unformat_ip6_address, &dst6))
- {
- dst_set = 1;
- ipv6_set = 1;
}
else if (unformat (line_input, "outer-fib-id %d", &outer_fib_id))
;
else if (unformat (line_input, "teb"))
- t_type = GRE_TUNNEL_TYPE_TEB;
+ t_type = GRE_API_TUNNEL_TYPE_TEB;
else if (unformat (line_input, "erspan %d", &session_id))
- t_type = GRE_TUNNEL_TYPE_ERSPAN;
+ t_type = GRE_API_TUNNEL_TYPE_ERSPAN;
else
{
errmsg ("parse error '%U'", format_unformat_error, line_input);
errmsg ("tunnel dst address not specified");
return -99;
}
- if (ipv4_set && ipv6_set)
- {
- errmsg ("both IPv4 and IPv6 addresses specified");
- return -99;
- }
+ M (GRE_TUNNEL_ADD_DEL, mp);
- M (GRE_ADD_DEL_TUNNEL, mp);
+ clib_memcpy (&mp->tunnel.src, &src, sizeof (mp->tunnel.src));
+ clib_memcpy (&mp->tunnel.dst, &dst, sizeof (mp->tunnel.dst));
- if (ipv4_set)
- {
- clib_memcpy (&mp->src_address, &src4, 4);
- clib_memcpy (&mp->dst_address, &dst4, 4);
- }
- else
- {
- clib_memcpy (&mp->src_address, &src6, 16);
- clib_memcpy (&mp->dst_address, &dst6, 16);
- }
- mp->instance = htonl (instance);
- mp->outer_fib_id = htonl (outer_fib_id);
+ mp->tunnel.instance = htonl (instance);
+ mp->tunnel.outer_fib_id = htonl (outer_fib_id);
mp->is_add = is_add;
- mp->session_id = htons ((u16) session_id);
- mp->tunnel_type = t_type;
- mp->is_ipv6 = ipv6_set;
+ mp->tunnel.session_id = htons ((u16) session_id);
+ mp->tunnel.type = htonl (t_type);
S (mp);
W (ret);
(vl_api_gre_tunnel_details_t * mp)
{
vat_main_t *vam = &vat_main;
- ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
- ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
print (vam->ofp, "%11d%11d%24U%24U%13d%14d%12d",
- ntohl (mp->sw_if_index),
- ntohl (mp->instance),
- format_ip46_address, &src, IP46_TYPE_ANY,
- format_ip46_address, &dst, IP46_TYPE_ANY,
- mp->tunnel_type, ntohl (mp->outer_fib_id), ntohl (mp->session_id));
+ ntohl (mp->tunnel.sw_if_index),
+ ntohl (mp->tunnel.instance),
+ format_vl_api_address, &mp->tunnel.src,
+ format_vl_api_address, &mp->tunnel.dst,
+ mp->tunnel.type, ntohl (mp->tunnel.outer_fib_id),
+ ntohl (mp->tunnel.session_id));
+}
+
+static void
+vat_json_object_add_address (vat_json_node_t * node,
+ const char *str, const vl_api_address_t * addr)
+{
+ if (ADDRESS_IP6 == addr->af)
+ {
+ struct in6_addr ip6;
+
+ clib_memcpy (&ip6, &addr->un.ip6, sizeof (ip6));
+ vat_json_object_add_ip6 (node, str, ip6);
+ }
+ else
+ {
+ struct in_addr ip4;
+
+ clib_memcpy (&ip4, &addr->un.ip4, sizeof (ip4));
+ vat_json_object_add_ip4 (node, str, ip4);
+ }
}
static void vl_api_gre_tunnel_details_t_handler_json
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
- struct in_addr ip4;
- struct in6_addr ip6;
if (VAT_JSON_ARRAY != vam->json_tree.type)
{
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));
- vat_json_object_add_uint (node, "instance", ntohl (mp->instance));
- if (!mp->is_ipv6)
- {
- 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);
- }
- else
- {
- clib_memcpy (&ip6, &mp->src_address, sizeof (ip6));
- vat_json_object_add_ip6 (node, "src_address", ip6);
- clib_memcpy (&ip6, &mp->dst_address, sizeof (ip6));
- vat_json_object_add_ip6 (node, "dst_address", ip6);
- }
- vat_json_object_add_uint (node, "tunnel_type", mp->tunnel_type);
- vat_json_object_add_uint (node, "outer_fib_id", ntohl (mp->outer_fib_id));
- vat_json_object_add_uint (node, "is_ipv6", mp->is_ipv6);
- vat_json_object_add_uint (node, "session_id", mp->session_id);
+ vat_json_object_add_uint (node, "sw_if_index",
+ ntohl (mp->tunnel.sw_if_index));
+ vat_json_object_add_uint (node, "instance", ntohl (mp->tunnel.instance));
+
+ vat_json_object_add_address (node, "src", &mp->tunnel.src);
+ vat_json_object_add_address (node, "dst", &mp->tunnel.dst);
+ vat_json_object_add_uint (node, "tunnel_type", mp->tunnel.type);
+ vat_json_object_add_uint (node, "outer_fib_id",
+ ntohl (mp->tunnel.outer_fib_id));
+ vat_json_object_add_uint (node, "session_id", mp->tunnel.session_id);
}
static int
{
unformat_input_t *i = vam->input;
vl_api_ip_probe_neighbor_t *mp;
- vl_api_address_t dst_adr;
+ vl_api_address_t dst_adr = { };
u8 int_set = 0;
u8 adr_set = 0;
u32 sw_if_index;
int_set = 1;
else if (unformat (i, "sw_if_index %d", &sw_if_index))
int_set = 1;
- else if (unformat (i, "address %U", unformat_vl_api_address, dst_adr))
+ else if (unformat (i, "address %U", unformat_vl_api_address, &dst_adr))
adr_set = 1;
else
break;
{
unformat_input_t *i = vam->input;
vl_api_ipsec_spd_entry_add_del_t *mp;
- u8 is_add = 1, is_outbound = 0, is_ipv6 = 0, is_ip_any = 1;
+ u8 is_add = 1, is_outbound = 0;
u32 spd_id = 0, sa_id = 0, protocol = 0, policy = 0;
i32 priority = 0;
u32 rport_start = 0, rport_stop = (u32) ~ 0;
;
else if (unformat (i, "laddr_start %U",
unformat_vl_api_address, &laddr_start))
- is_ip_any = 0;
+ ;
else if (unformat (i, "laddr_stop %U", unformat_vl_api_address,
&laddr_stop))
- is_ip_any = 0;
+ ;
else if (unformat (i, "raddr_start %U", unformat_vl_api_address,
&raddr_start))
- is_ip_any = 0;
+ ;
else if (unformat (i, "raddr_stop %U", unformat_vl_api_address,
&raddr_stop))
- is_ip_any = 0;
+ ;
else
if (unformat (i, "action %U", unformat_ipsec_policy_action, &policy))
{
return ret;
}
-static int
-api_ipsec_sa_set_key (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_ipsec_sa_set_key_t *mp;
- u32 sa_id;
- u8 *ck = 0, *ik = 0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "sa_id %d", &sa_id))
- ;
- else if (unformat (i, "crypto_key %U", unformat_hex_string, &ck))
- ;
- else if (unformat (i, "integ_key %U", unformat_hex_string, &ik))
- ;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- M (IPSEC_SA_SET_KEY, mp);
-
- mp->sa_id = ntohl (sa_id);
- mp->crypto_key.length = vec_len (ck);
- mp->integrity_key.length = vec_len (ik);
-
- if (mp->crypto_key.length > sizeof (mp->crypto_key.data))
- mp->crypto_key.length = sizeof (mp->crypto_key.data);
-
- if (mp->integrity_key.length > sizeof (mp->integrity_key.data))
- mp->integrity_key.length = sizeof (mp->integrity_key.data);
-
- if (ck)
- clib_memcpy (mp->crypto_key.data, ck, mp->crypto_key.length);
- if (ik)
- clib_memcpy (mp->integrity_key.data, ik, mp->integrity_key.length);
-
- S (mp);
- W (ret);
- return ret;
-}
-
static int
api_ipsec_tunnel_if_add_del (vat_main_t * vam)
{
u32 crypto_alg = 0, integ_alg = 0;
u8 *lck = NULL, *rck = NULL;
u8 *lik = NULL, *rik = NULL;
- ip4_address_t local_ip = { {0} };
- ip4_address_t remote_ip = { {0} };
+ vl_api_address_t local_ip = { 0 };
+ vl_api_address_t remote_ip = { 0 };
+ f64 before = 0;
u8 is_add = 1;
u8 esn = 0;
u8 anti_replay = 0;
u8 renumber = 0;
u32 instance = ~0;
- int ret;
+ u32 count = 1, jj;
+ int ret = -1;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
is_add = 0;
else if (unformat (i, "esn"))
esn = 1;
- else if (unformat (i, "anti_replay"))
+ else if (unformat (i, "anti-replay"))
anti_replay = 1;
+ else if (unformat (i, "count %d", &count))
+ ;
else if (unformat (i, "local_spi %d", &local_spi))
;
else if (unformat (i, "remote_spi %d", &remote_spi))
;
- else if (unformat (i, "local_ip %U", unformat_ip4_address, &local_ip))
+ else
+ if (unformat (i, "local_ip %U", unformat_vl_api_address, &local_ip))
;
- else if (unformat (i, "remote_ip %U", unformat_ip4_address, &remote_ip))
+ else
+ if (unformat (i, "remote_ip %U", unformat_vl_api_address, &remote_ip))
;
else if (unformat (i, "local_crypto_key %U", unformat_hex_string, &lck))
;
}
}
- M (IPSEC_TUNNEL_IF_ADD_DEL, mp);
+ if (count > 1)
+ {
+ /* Turn on async mode */
+ vam->async_mode = 1;
+ vam->async_errors = 0;
+ before = vat_time_now (vam);
+ }
+
+ for (jj = 0; jj < count; jj++)
+ {
+ M (IPSEC_TUNNEL_IF_ADD_DEL, mp);
- mp->is_add = is_add;
- mp->esn = esn;
- mp->anti_replay = anti_replay;
+ mp->is_add = is_add;
+ mp->esn = esn;
+ mp->anti_replay = anti_replay;
- clib_memcpy (mp->local_ip, &local_ip, sizeof (ip4_address_t));
- clib_memcpy (mp->remote_ip, &remote_ip, sizeof (ip4_address_t));
+ if (jj > 0)
+ increment_vl_address (&remote_ip);
- mp->local_spi = htonl (local_spi);
- mp->remote_spi = htonl (remote_spi);
- mp->crypto_alg = (u8) crypto_alg;
+ clib_memcpy (&mp->local_ip, &local_ip, sizeof (local_ip));
+ clib_memcpy (&mp->remote_ip, &remote_ip, sizeof (remote_ip));
- mp->local_crypto_key_len = 0;
- if (lck)
- {
- mp->local_crypto_key_len = vec_len (lck);
- if (mp->local_crypto_key_len > sizeof (mp->local_crypto_key))
- mp->local_crypto_key_len = sizeof (mp->local_crypto_key);
- clib_memcpy (mp->local_crypto_key, lck, mp->local_crypto_key_len);
- }
+ mp->local_spi = htonl (local_spi + jj);
+ mp->remote_spi = htonl (remote_spi + jj);
+ mp->crypto_alg = (u8) crypto_alg;
- mp->remote_crypto_key_len = 0;
- if (rck)
- {
- mp->remote_crypto_key_len = vec_len (rck);
- if (mp->remote_crypto_key_len > sizeof (mp->remote_crypto_key))
- mp->remote_crypto_key_len = sizeof (mp->remote_crypto_key);
- clib_memcpy (mp->remote_crypto_key, rck, mp->remote_crypto_key_len);
- }
+ mp->local_crypto_key_len = 0;
+ if (lck)
+ {
+ mp->local_crypto_key_len = vec_len (lck);
+ if (mp->local_crypto_key_len > sizeof (mp->local_crypto_key))
+ mp->local_crypto_key_len = sizeof (mp->local_crypto_key);
+ clib_memcpy (mp->local_crypto_key, lck, mp->local_crypto_key_len);
+ }
+
+ mp->remote_crypto_key_len = 0;
+ if (rck)
+ {
+ mp->remote_crypto_key_len = vec_len (rck);
+ if (mp->remote_crypto_key_len > sizeof (mp->remote_crypto_key))
+ mp->remote_crypto_key_len = sizeof (mp->remote_crypto_key);
+ clib_memcpy (mp->remote_crypto_key, rck, mp->remote_crypto_key_len);
+ }
- mp->integ_alg = (u8) integ_alg;
+ mp->integ_alg = (u8) integ_alg;
- mp->local_integ_key_len = 0;
- if (lik)
- {
- mp->local_integ_key_len = vec_len (lik);
- if (mp->local_integ_key_len > sizeof (mp->local_integ_key))
- mp->local_integ_key_len = sizeof (mp->local_integ_key);
- clib_memcpy (mp->local_integ_key, lik, mp->local_integ_key_len);
+ mp->local_integ_key_len = 0;
+ if (lik)
+ {
+ mp->local_integ_key_len = vec_len (lik);
+ if (mp->local_integ_key_len > sizeof (mp->local_integ_key))
+ mp->local_integ_key_len = sizeof (mp->local_integ_key);
+ clib_memcpy (mp->local_integ_key, lik, mp->local_integ_key_len);
+ }
+
+ mp->remote_integ_key_len = 0;
+ if (rik)
+ {
+ mp->remote_integ_key_len = vec_len (rik);
+ if (mp->remote_integ_key_len > sizeof (mp->remote_integ_key))
+ mp->remote_integ_key_len = sizeof (mp->remote_integ_key);
+ clib_memcpy (mp->remote_integ_key, rik, mp->remote_integ_key_len);
+ }
+
+ if (renumber)
+ {
+ mp->renumber = renumber;
+ mp->show_instance = ntohl (instance);
+ }
+ S (mp);
}
- mp->remote_integ_key_len = 0;
- if (rik)
+ /* When testing multiple add/del ops, use a control-ping to sync */
+ if (count > 1)
{
- mp->remote_integ_key_len = vec_len (rik);
- if (mp->remote_integ_key_len > sizeof (mp->remote_integ_key))
- mp->remote_integ_key_len = sizeof (mp->remote_integ_key);
- clib_memcpy (mp->remote_integ_key, rik, mp->remote_integ_key_len);
- }
+ vl_api_control_ping_t *mp_ping;
+ f64 after;
+ f64 timeout;
+
+ /* Shut off async mode */
+ vam->async_mode = 0;
+
+ MPING (CONTROL_PING, mp_ping);
+ S (mp_ping);
+
+ timeout = vat_time_now (vam) + 1.0;
+ while (vat_time_now (vam) < timeout)
+ if (vam->result_ready == 1)
+ goto out;
+ vam->retval = -99;
- if (renumber)
+ out:
+ if (vam->retval == -99)
+ errmsg ("timeout");
+
+ if (vam->async_errors > 0)
+ {
+ errmsg ("%d asynchronous errors", vam->async_errors);
+ vam->retval = -98;
+ }
+ vam->async_errors = 0;
+ after = vat_time_now (vam);
+
+ /* slim chance, but we might have eaten SIGTERM on the first iteration */
+ if (jj > 0)
+ count = jj;
+
+ print (vam->ofp, "%d tunnels in %.6f secs, %.2f tunnels/sec",
+ count, after - before, count / (after - before));
+ }
+ else
{
- mp->renumber = renumber;
- mp->show_instance = ntohl (instance);
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
}
- S (mp);
- W (ret);
return ret;
}
#define vl_api_ipsec_sa_details_t_endian vl_noop_handler
#define vl_api_ipsec_sa_details_t_print vl_noop_handler
-static void
-vat_json_object_add_address (vat_json_node_t * node,
- const vl_api_address_t * addr)
-{
- if (ADDRESS_IP6 == addr->af)
- {
- struct in6_addr ip6;
-
- clib_memcpy (&ip6, &addr->un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (node, "ip_address", ip6);
- }
- else
- {
- struct in_addr ip4;
-
- clib_memcpy (&ip4, &addr->un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (node, "ip_address", ip4);
- }
-}
-
static void vl_api_ipsec_sa_details_t_handler_json
(vl_api_ipsec_sa_details_t * mp)
{
ntohl (mp->entry.integrity_algorithm));
flags = ntohl (mp->entry.flags);
vat_json_object_add_uint (node, "use_esn",
- ! !(flags &
- IPSEC_API_SAD_FLAG_USE_EXTENDED_SEQ_NUM));
+ ! !(flags & IPSEC_API_SAD_FLAG_USE_ESN));
vat_json_object_add_uint (node, "use_anti_replay",
! !(flags & IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY));
vat_json_object_add_uint (node, "is_tunnel",
mp->entry.crypto_key.length);
vat_json_object_add_bytes (node, "integ_key", mp->entry.integrity_key.data,
mp->entry.integrity_key.length);
- vat_json_object_add_address (node, &mp->entry.tunnel_src);
- vat_json_object_add_address (node, &mp->entry.tunnel_dst);
+ vat_json_object_add_address (node, "src", &mp->entry.tunnel_src);
+ 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));
}
return ret;
}
-static int
-api_ipsec_tunnel_if_set_key (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_ipsec_tunnel_if_set_key_t *mp;
- u32 sw_if_index = ~0;
- u8 key_type = IPSEC_IF_SET_KEY_TYPE_NONE;
- u8 *key = 0;
- u32 alg = ~0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- ;
- else
- if (unformat
- (i, "local crypto %U", unformat_ipsec_api_crypto_alg, &alg))
- key_type = IPSEC_IF_SET_KEY_TYPE_LOCAL_CRYPTO;
- else
- if (unformat
- (i, "remote crypto %U", unformat_ipsec_api_crypto_alg, &alg))
- key_type = IPSEC_IF_SET_KEY_TYPE_REMOTE_CRYPTO;
- else
- if (unformat
- (i, "local integ %U", unformat_ipsec_api_integ_alg, &alg))
- key_type = IPSEC_IF_SET_KEY_TYPE_LOCAL_INTEG;
- else
- if (unformat
- (i, "remote integ %U", unformat_ipsec_api_integ_alg, &alg))
- key_type = IPSEC_IF_SET_KEY_TYPE_REMOTE_INTEG;
- else if (unformat (i, "%U", unformat_hex_string, &key))
- ;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (sw_if_index == ~0)
- {
- errmsg ("interface must be specified");
- return -99;
- }
-
- if (key_type == IPSEC_IF_SET_KEY_TYPE_NONE)
- {
- errmsg ("key type must be specified");
- return -99;
- }
-
- if (alg == ~0)
- {
- errmsg ("algorithm must be specified");
- return -99;
- }
-
- if (vec_len (key) == 0)
- {
- errmsg ("key must be specified");
- return -99;
- }
-
- M (IPSEC_TUNNEL_IF_SET_KEY, mp);
-
- mp->sw_if_index = htonl (sw_if_index);
- mp->alg = alg;
- mp->key_type = key_type;
- mp->key_len = vec_len (key);
- clib_memcpy (mp->key, key, vec_len (key));
-
- S (mp);
- W (ret);
-
- return ret;
-}
-
static int
api_ipsec_tunnel_if_set_sa (vat_main_t * vam)
{
vat_json_object_add_string_copy (node, "link_layer",
format (0, "%U", format_vl_api_mac_address,
&mp->neighbor.mac_address));
- vat_json_object_add_address (node, &mp->neighbor.ip_address);
+ vat_json_object_add_address (node, "ip", &mp->neighbor.ip_address);
}
static int
u8 prefix_set = 0;
u32 vrf_id = ~0;
u8 is_add = 1;
- u8 is_ipv6 = 0;
int ret;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
}
static int
-api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
+api_ipsec_gre_tunnel_add_del (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_ipsec_gre_add_del_tunnel_t *mp;
+ vl_api_ipsec_gre_tunnel_add_del_t *mp;
u32 local_sa_id = 0;
u32 remote_sa_id = 0;
- ip4_address_t src_address;
- ip4_address_t dst_address;
+ vl_api_ip4_address_t src_address;
+ vl_api_ip4_address_t dst_address;
u8 is_add = 1;
int ret;
;
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, "src %U", unformat_vl_api_ip4_address, &src_address))
;
- else if (unformat (i, "dst %U", unformat_ip4_address, &dst_address))
+ else
+ if (unformat (i, "dst %U", unformat_vl_api_ip4_address, &dst_address))
;
else if (unformat (i, "del"))
is_add = 0;
}
}
- M (IPSEC_GRE_ADD_DEL_TUNNEL, mp);
+ M (IPSEC_GRE_TUNNEL_ADD_DEL, mp);
- 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->tunnel.local_sa_id = ntohl (local_sa_id);
+ mp->tunnel.remote_sa_id = ntohl (remote_sa_id);
+ clib_memcpy (mp->tunnel.src, &src_address, sizeof (src_address));
+ clib_memcpy (mp->tunnel.dst, &dst_address, sizeof (dst_address));
mp->is_add = is_add;
S (mp);
api_set_punt (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
+ vl_api_address_family_t af;
vl_api_set_punt_t *mp;
- u32 ipv = ~0;
u32 protocol = ~0;
u32 port = ~0;
int is_add = 1;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (i, "ip %d", &ipv))
+ if (unformat (i, "%U", unformat_vl_api_address_family, &af))
;
else if (unformat (i, "protocol %d", &protocol))
;
M (SET_PUNT, mp);
mp->is_add = (u8) is_add;
- mp->punt.ipv = (u8) ipv;
- mp->punt.l4_protocol = (u8) protocol;
- mp->punt.l4_port = htons ((u16) port);
+ mp->punt.type = PUNT_API_TYPE_L4;
+ mp->punt.punt.l4.af = af;
+ mp->punt.punt.l4.protocol = (u8) protocol;
+ mp->punt.punt.l4.port = htons ((u16) port);
S (mp);
W (ret);
vat_main_t *vam = &vat_main;
print (vam->ofp, "%11d%15U%15U%14d%14d",
- 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));
+ ntohl (mp->tunnel.sw_if_index),
+ format_vl_api_ip4_address, mp->tunnel.src,
+ format_vl_api_ip4_address, mp->tunnel.dst,
+ ntohl (mp->tunnel.local_sa_id), ntohl (mp->tunnel.remote_sa_id));
+}
+
+static void
+vat_json_object_add_vl_api_ip4 (vat_json_node_t * node,
+ const char *name,
+ const vl_api_ip4_address_t addr)
+{
+ struct in_addr ip4;
+
+ clib_memcpy (&ip4, addr, sizeof (ip4));
+ vat_json_object_add_ip4 (node, name, ip4);
}
static void vl_api_ipsec_gre_tunnel_details_t_handler_json
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
- struct in_addr ip4;
if (VAT_JSON_ARRAY != vam->json_tree.type)
{
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));
+ vat_json_object_add_uint (node, "sw_if_index",
+ ntohl (mp->tunnel.sw_if_index));
+ vat_json_object_add_vl_api_ip4 (node, "src", mp->tunnel.src);
+ vat_json_object_add_vl_api_ip4 (node, "src", mp->tunnel.dst);
+ vat_json_object_add_uint (node, "local_sa_id",
+ ntohl (mp->tunnel.local_sa_id));
+ vat_json_object_add_uint (node, "remote_sa_id",
+ ntohl (mp->tunnel.remote_sa_id));
}
static int
"<vpp-if-name> | sw_if_index <id>") \
_(sw_interface_tap_v2_dump, "") \
_(virtio_pci_create, \
- "pci-addr <pci-address> [use_random_mac | hw-addr <mac-addr>] [tx-ring-size <num> [rx-ring-size <num>] [features <hex-value>]") \
+ "pci-addr <pci-address> [use_random_mac | hw-addr <mac-addr>] [features <hex-value>] [gso-enabled]") \
_(virtio_pci_delete, \
"<vpp-if-name> | sw_if_index <id>") \
_(sw_interface_virtio_pci_dump, "") \
"[outer_vlan_id <n>][inner_vlan_id <n>]\n" \
"[no_tags][one_tag][two_tags][dot1ad][exact_match][default_sub]\n" \
"[outer_vlan_id_any][inner_vlan_id_any]") \
-_(oam_add_del, "src <ip4-address> dst <ip4-address> [vrf <n>] [del]") \
_(reset_fib, "vrf <n> [ipv6]") \
_(dhcp_proxy_config, \
"svr <v46-address> src <v46-address>\n" \
"vni <vni> [encap-vrf-id <nn>] [decap-next <l2|nn>] [del]") \
_(vxlan_tunnel_dump, "[<intfc> | sw_if_index <nn>]") \
_(geneve_tunnel_dump, "[<intfc> | sw_if_index <nn>]") \
-_(gre_add_del_tunnel, \
+_(gre_tunnel_add_del, \
"src <ip-addr> dst <ip-addr> [outer-fib-id <nn>] [instance <n>]\n" \
"[teb | erspan <session-id>] [del]") \
_(gre_tunnel_dump, "[<intfc> | sw_if_index <nn>]") \
" (inbound|outbound) [sa_id <n>] laddr_start <ip4|ip6>\n" \
" laddr_stop <ip4|ip6> raddr_start <ip4|ip6> raddr_stop <ip4|ip6>\n" \
" [lport_start <n> lport_stop <n>] [rport_start <n> rport_stop <n>]" ) \
-_(ipsec_sa_set_key, "sa_id <n> crypto_key <hex> integ_key <hex>") \
_(ipsec_tunnel_if_add_del, "local_spi <n> remote_spi <n>\n" \
" crypto_alg <alg> local_crypto_key <hex> remote_crypto_key <hex>\n" \
" integ_alg <alg> local_integ_key <hex> remote_integ_key <hex>\n" \
" local_ip <addr> remote_ip <addr> [esn] [anti_replay] [del]\n" \
" [instance <n>]") \
_(ipsec_sa_dump, "[sa_id <n>]") \
-_(ipsec_tunnel_if_set_key, "<intfc> <local|remote> <crypto|integ>\n" \
- " <alg> <hex>\n") \
_(ipsec_tunnel_if_set_sa, "<intfc> sa_id <n> <inbound|outbound>\n") \
_(delete_loopback,"sw_if_index <nn>") \
_(bd_ip_mac_add_del, "bd_id <bridge-domain-id> <ip4/6-addr> <mac-addr> [del]") \
_(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>]") \
-_(ipsec_gre_add_del_tunnel, \
+_(ipsec_gre_tunnel_add_del, \
"src <addr> dst <addr> local_sa <sa-id> remote_sa <sa-id> [del]") \
_(ipsec_gre_tunnel_dump, "[sw_if_index <nn>]") \
_(delete_subif,"<intfc> | sw_if_index <nn>") \