summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/devices/af_packet/af_packet.c5
-rw-r--r--vnet/vnet/devices/af_packet/af_packet.h2
-rw-r--r--vnet/vnet/devices/af_packet/cli.c4
-rw-r--r--vnet/vnet/devices/dpdk/vhost_user.c1
-rw-r--r--vnet/vnet/devices/netmap/cli.c4
-rw-r--r--vnet/vnet/devices/netmap/netmap.c5
-rw-r--r--vnet/vnet/devices/netmap/netmap.h3
-rw-r--r--vnet/vnet/devices/virtio/vhost-user.c2
-rw-r--r--vnet/vnet/ethernet/interface.c1
-rw-r--r--vnet/vnet/gre/interface.c4
-rw-r--r--vnet/vnet/interface_cli.c1
-rw-r--r--vnet/vnet/l2tp/l2tp.c1
-rw-r--r--vnet/vnet/mpls-gre/interface.c18
-rw-r--r--vnet/vnet/unix/tapcli.c6
-rw-r--r--vnet/vnet/vxlan-gpe/vxlan_gpe.c4
-rw-r--r--vnet/vnet/vxlan/vxlan.c5
-rw-r--r--vpp/api/api.c4
17 files changed, 48 insertions, 22 deletions
diff --git a/vnet/vnet/devices/af_packet/af_packet.c b/vnet/vnet/devices/af_packet/af_packet.c
index 20c61295bb0..b41eaf3ba82 100644
--- a/vnet/vnet/devices/af_packet/af_packet.c
+++ b/vnet/vnet/devices/af_packet/af_packet.c
@@ -162,7 +162,7 @@ error:
}
int
-af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set)
+af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set, u32 *sw_if_index)
{
af_packet_main_t * apm = &af_packet_main;
int ret, fd = -1;
@@ -258,7 +258,8 @@ af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set)
VNET_HW_INTERFACE_FLAG_LINK_UP);
mhash_set_mem (&apm->if_index_by_host_if_name, host_if_name, &if_index, 0);
-
+ if (sw_if_index)
+ *sw_if_index = apif->sw_if_index;
return 0;
error:
diff --git a/vnet/vnet/devices/af_packet/af_packet.h b/vnet/vnet/devices/af_packet/af_packet.h
index 21f41c7045c..258700b2b75 100644
--- a/vnet/vnet/devices/af_packet/af_packet.h
+++ b/vnet/vnet/devices/af_packet/af_packet.h
@@ -54,5 +54,5 @@ af_packet_main_t af_packet_main;
extern vnet_device_class_t af_packet_device_class;
extern vlib_node_registration_t af_packet_input_node;
-int af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set);
+int af_packet_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set, u32 *sw_if_index);
int af_packet_delete_if(vlib_main_t * vm, u8 * host_if_name);
diff --git a/vnet/vnet/devices/af_packet/cli.c b/vnet/vnet/devices/af_packet/cli.c
index 4ac51cb06a9..3153efe8baa 100644
--- a/vnet/vnet/devices/af_packet/cli.c
+++ b/vnet/vnet/devices/af_packet/cli.c
@@ -40,6 +40,7 @@ af_packet_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 * host_if_name = NULL;
u8 hwaddr [6];
u8 * hw_addr_ptr = 0;
+ u32 sw_if_index;
int r;
/* Get a line of input. */
@@ -60,7 +61,7 @@ af_packet_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (host_if_name == NULL)
return clib_error_return (0, "missing host interface name");
- r = af_packet_create_if(vm, host_if_name, hw_addr_ptr);
+ r = af_packet_create_if(vm, host_if_name, hw_addr_ptr, &sw_if_index);
if (r == VNET_API_ERROR_SYSCALL_ERROR_1)
return clib_error_return(0, "%s (errno %d)", strerror (errno), errno);
@@ -71,6 +72,7 @@ af_packet_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (r == VNET_API_ERROR_SUBIF_ALREADY_EXISTS)
return clib_error_return(0, "Interface elready exists");
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
return 0;
}
diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c
index 9bf76741588..a461d3907eb 100644
--- a/vnet/vnet/devices/dpdk/vhost_user.c
+++ b/vnet/vnet/devices/dpdk/vhost_user.c
@@ -1702,6 +1702,7 @@ dpdk_vhost_user_connect_command_fn (vlib_main_t * vm,
renumber, custom_dev_instance, hw);
vec_free(sock_filename);
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
return 0;
}
diff --git a/vnet/vnet/devices/netmap/cli.c b/vnet/vnet/devices/netmap/cli.c
index 584d68002d3..5bf80e7f7c3 100644
--- a/vnet/vnet/devices/netmap/cli.c
+++ b/vnet/vnet/devices/netmap/cli.c
@@ -36,6 +36,7 @@ netmap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
int r;
u8 is_pipe = 0;
u8 is_master = 0;
+ u32 sw_if_index = ~0;
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
@@ -61,7 +62,7 @@ netmap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (host_if_name == NULL)
return clib_error_return (0, "missing host interface name");
- r = netmap_create_if(vm, host_if_name, hw_addr_ptr, is_pipe, is_master);
+ r = netmap_create_if(vm, host_if_name, hw_addr_ptr, is_pipe, is_master, &sw_if_index);
if (r == VNET_API_ERROR_SYSCALL_ERROR_1)
return clib_error_return(0, "%s (errno %d)", strerror (errno), errno);
@@ -72,6 +73,7 @@ netmap_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (r == VNET_API_ERROR_SUBIF_ALREADY_EXISTS)
return clib_error_return(0, "Interface already exists");
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
return 0;
}
diff --git a/vnet/vnet/devices/netmap/netmap.c b/vnet/vnet/devices/netmap/netmap.c
index 2f3233a28e5..df3b2be499e 100644
--- a/vnet/vnet/devices/netmap/netmap.c
+++ b/vnet/vnet/devices/netmap/netmap.c
@@ -80,7 +80,7 @@ close_netmap_if(netmap_main_t * nm, netmap_if_t * nif)
int
netmap_create_if(vlib_main_t * vm, u8 * if_name, u8 * hw_addr_set,
- u8 is_pipe, u8 is_master)
+ u8 is_pipe, u8 is_master, u32 *sw_if_index)
{
netmap_main_t * nm = &netmap_main;
int ret = 0;
@@ -194,6 +194,9 @@ netmap_create_if(vlib_main_t * vm, u8 * if_name, u8 * hw_addr_set,
mhash_set_mem (&nm->if_index_by_host_if_name, if_name, &nif->if_index, 0);
+ if (sw_if_index)
+ *sw_if_index = nif->sw_if_index;
+
return 0;
error:
diff --git a/vnet/vnet/devices/netmap/netmap.h b/vnet/vnet/devices/netmap/netmap.h
index c5b3dfbc71a..6f7791c3732 100644
--- a/vnet/vnet/devices/netmap/netmap.h
+++ b/vnet/vnet/devices/netmap/netmap.h
@@ -90,7 +90,8 @@ netmap_main_t netmap_main;
extern vnet_device_class_t netmap_device_class;
extern vlib_node_registration_t netmap_input_node;
-int netmap_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set, u8 is_pipe, u8 is_master);
+int netmap_create_if(vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set,
+ u8 is_pipe, u8 is_master, u32 *sw_if_index);
int netmap_delete_if(vlib_main_t * vm, u8 * host_if_name);
diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c
index ef4993f94f7..4ed45e38853 100644
--- a/vnet/vnet/devices/virtio/vhost-user.c
+++ b/vnet/vnet/devices/virtio/vhost-user.c
@@ -1791,7 +1791,7 @@ vhost_user_connect_command_fn (vlib_main_t * vm,
renumber, custom_dev_instance, hw);
vec_free(sock_filename);
-
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
return 0;
}
diff --git a/vnet/vnet/ethernet/interface.c b/vnet/vnet/ethernet/interface.c
index 833ee3008b1..fd640308c95 100644
--- a/vnet/vnet/ethernet/interface.c
+++ b/vnet/vnet/ethernet/interface.c
@@ -431,6 +431,7 @@ create_simulated_ethernet_interfaces (vlib_main_t * vm,
if (rv)
return clib_error_return (0, "vnet_create_loopback_interface failed");
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
return 0;
}
diff --git a/vnet/vnet/gre/interface.c b/vnet/vnet/gre/interface.c
index 1e442bc94eb..ae59b246608 100644
--- a/vnet/vnet/gre/interface.c
+++ b/vnet/vnet/gre/interface.c
@@ -159,6 +159,7 @@ create_gre_tunnel_command_fn (vlib_main_t * vm,
int rv;
u32 num_m_args = 0;
u8 is_add = 1;
+ u32 sw_if_index;
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
@@ -191,11 +192,12 @@ create_gre_tunnel_command_fn (vlib_main_t * vm,
clib_memcpy(&a->src, &src, sizeof(src));
clib_memcpy(&a->dst, &dst, sizeof(dst));
- rv = vnet_gre_add_del_tunnel (a, 0);
+ rv = vnet_gre_add_del_tunnel (a, &sw_if_index);
switch(rv)
{
case 0:
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
break;
case VNET_API_ERROR_INVALID_VALUE:
return clib_error_return (0, "GRE tunnel already exists...");
diff --git a/vnet/vnet/interface_cli.c b/vnet/vnet/interface_cli.c
index 13a7d8cffd9..d0d75154349 100644
--- a/vnet/vnet/interface_cli.c
+++ b/vnet/vnet/interface_cli.c
@@ -608,6 +608,7 @@ create_sub_interfaces (vlib_main_t * vm,
if (error) goto done;
hash_set (hi->sub_interface_sw_if_index_by_id, id, sw_if_index);
hash_set_mem (im->sw_if_index_by_sup_and_sub, kp, sw_if_index);
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
}
if (error)
diff --git a/vnet/vnet/l2tp/l2tp.c b/vnet/vnet/l2tp/l2tp.c
index d359a50e54c..7dfbe156c46 100644
--- a/vnet/vnet/l2tp/l2tp.c
+++ b/vnet/vnet/l2tp/l2tp.c
@@ -466,6 +466,7 @@ create_l2tpv3_tunnel_command_fn (vlib_main_t * vm,
switch(rv)
{
case 0:
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
break;
case VNET_API_ERROR_INVALID_VALUE:
return clib_error_return (0, "session already exists...");
diff --git a/vnet/vnet/mpls-gre/interface.c b/vnet/vnet/mpls-gre/interface.c
index 75cd022a305..5b78072ff26 100644
--- a/vnet/vnet/mpls-gre/interface.c
+++ b/vnet/vnet/mpls-gre/interface.c
@@ -1083,6 +1083,8 @@ create_mpls_gre_tunnel_command_fn (vlib_main_t * vm,
switch (rv)
{
case 0:
+ if (!is_del)
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), tunnel_intfc_sw_if_index);
break;
case VNET_API_ERROR_NO_SUCH_INNER_FIB:
@@ -1521,6 +1523,7 @@ create_mpls_ethernet_tunnel_command_fn (vlib_main_t * vm,
u8 is_del = 0;
u8 l2_only = 0;
u32 tx_sw_if_index;
+ u32 sw_if_index = ~0;
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
@@ -1560,11 +1563,15 @@ create_mpls_ethernet_tunnel_command_fn (vlib_main_t * vm,
rv = vnet_mpls_ethernet_add_del_tunnel (dst, &intfc, mask_width,
inner_fib_id, tx_sw_if_index,
- 0 /* tunnel sw_if_index */,
+ &sw_if_index,
l2_only, !is_del);
switch (rv)
{
+ case 0:
+ if (!is_del)
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
+ break;
case VNET_API_ERROR_NO_SUCH_FIB:
return clib_error_return (0, "rx fib ID %d doesn't exist\n",
inner_fib_id);
@@ -1582,6 +1589,7 @@ create_mpls_ethernet_tunnel_command_fn (vlib_main_t * vm,
break;
default:
+ return clib_error_return (0, "vnet_mpls_ethernet_add_del_tunnel returned %d", rv);
break;
}
return 0;
@@ -1902,6 +1910,10 @@ create_mpls_ethernet_policy_tunnel_command_fn (vlib_main_t * vm,
l2_only, !is_del);
switch (rv)
{
+ case 0:
+ if (!is_del)
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), new_tunnel_index);
+ break;
case VNET_API_ERROR_NO_SUCH_FIB:
return clib_error_return (0, "rx fib ID %d doesn't exist\n",
inner_fib_id);
@@ -1919,12 +1931,10 @@ create_mpls_ethernet_policy_tunnel_command_fn (vlib_main_t * vm,
break;
default:
+ return clib_error_return (0, "vnet_mpls_ethernet_add_del_policy_tunnel returned %d", rv);
break;
}
- if (!is_del)
- vlib_cli_output (vm, "tunnel index %d", new_tunnel_index);
-
return 0;
}
diff --git a/vnet/vnet/unix/tapcli.c b/vnet/vnet/unix/tapcli.c
index a2999362713..1d5beba1b78 100644
--- a/vnet/vnet/unix/tapcli.c
+++ b/vnet/vnet/unix/tapcli.c
@@ -1090,12 +1090,8 @@ tap_connect_command_fn (vlib_main_t * vm,
return 0;
}
- vlib_cli_output (vm, "Created %U for Linux tap '%s'",
- format_vnet_sw_if_index_name, tm->vnet_main,
- sw_if_index, intfc_name);
-
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
return 0;
-
}
VLIB_CLI_COMMAND (tap_connect_command, static) = {
diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe.c b/vnet/vnet/vxlan-gpe/vxlan_gpe.c
index bee6e7c9243..76cba0537c9 100644
--- a/vnet/vnet/vxlan-gpe/vxlan_gpe.c
+++ b/vnet/vnet/vxlan-gpe/vxlan_gpe.c
@@ -326,6 +326,7 @@ vxlan_gpe_add_del_tunnel_command_fn (vlib_main_t * vm,
int rv;
u32 tmp;
vnet_vxlan_gpe_add_del_tunnel_args_t _a, * a = &_a;
+ u32 sw_if_index;
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
@@ -389,11 +390,12 @@ vxlan_gpe_add_del_tunnel_command_fn (vlib_main_t * vm,
foreach_gpe_copy_field;
#undef _
- rv = vnet_vxlan_gpe_add_del_tunnel (a, 0 /* hw_if_indexp */);
+ rv = vnet_vxlan_gpe_add_del_tunnel (a, &sw_if_index);
switch(rv)
{
case 0:
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
break;
case VNET_API_ERROR_INVALID_DECAP_NEXT:
return clib_error_return (0, "invalid decap-next...");
diff --git a/vnet/vnet/vxlan/vxlan.c b/vnet/vnet/vxlan/vxlan.c
index 89e56e7844f..9e0d0a5e418 100644
--- a/vnet/vnet/vxlan/vxlan.c
+++ b/vnet/vnet/vxlan/vxlan.c
@@ -419,6 +419,7 @@ vxlan_add_del_tunnel_command_fn (vlib_main_t * vm,
u32 tmp;
int rv;
vnet_vxlan_add_del_tunnel_args_t _a, * a = &_a;
+ u32 sw_if_index;
/* Get a line of input. */
if (! unformat_user (input, unformat_line_input, line_input))
@@ -504,11 +505,13 @@ vxlan_add_del_tunnel_command_fn (vlib_main_t * vm,
else foreach_copy_ipv6
#undef _
- rv = vnet_vxlan_add_del_tunnel (a, 0 /* hw_if_indexp */);
+ rv = vnet_vxlan_add_del_tunnel (a, &sw_if_index);
switch(rv)
{
case 0:
+ if (is_add)
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
break;
case VNET_API_ERROR_INVALID_DECAP_NEXT:
return clib_error_return (0, "invalid decap-next...");
diff --git a/vpp/api/api.c b/vpp/api/api.c
index 3b56d1c3746..3bf2ed47088 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -5930,7 +5930,7 @@ vl_api_af_packet_create_t_handler
vec_add1 (host_if_name, 0);
rv = af_packet_create_if(vm, host_if_name,
- mp->use_random_hw_addr ? 0 : mp->hw_addr);
+ mp->use_random_hw_addr ? 0 : mp->hw_addr, 0);
vec_free(host_if_name);
@@ -6077,7 +6077,7 @@ vl_api_netmap_create_t_handler
vec_add1 (if_name, 0);
rv = netmap_create_if(vm, if_name, mp->use_random_hw_addr ? 0 : mp->hw_addr,
- mp->is_pipe, mp->is_master);
+ mp->is_pipe, mp->is_master, 0);
vec_free(if_name);