aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip.api14
-rw-r--r--src/vnet/ip/ip46_cli.c39
-rw-r--r--src/vnet/ip/ip_api.c20
-rw-r--r--src/vnet/ip/ip_test.c5
4 files changed, 78 insertions, 0 deletions
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index fc7d7582dec..be151bdf4f4 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -446,6 +446,20 @@ autoreply define sw_interface_ip6_enable_disable
bool enable; /* set to true if enable */
};
+/** \brief IPv4 interface enable / disable request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param sw_if_index - interface used to reach neighbor
+ @param enable - if non-zero enable ip4 on interface, else disable
+*/
+autoendian autoreply define sw_interface_ip4_enable_disable
+{
+ u32 client_index;
+ u32 context;
+ vl_api_interface_index_t sw_if_index;
+ bool enable; /* set to true if enable */
+};
+
/** \brief Dump IP multicast fib table
@param client_index - opaque cookie to identify the sender
*/
diff --git a/src/vnet/ip/ip46_cli.c b/src/vnet/ip/ip46_cli.c
index e3da27914bd..022c4174174 100644
--- a/src/vnet/ip/ip46_cli.c
+++ b/src/vnet/ip/ip46_cli.c
@@ -292,6 +292,45 @@ VLIB_CLI_COMMAND (set_reassembly_command, static) = {
.function = set_reassembly_command_fn,
};
+static clib_error_t *
+enable_ip4_interface_cmd (vlib_main_t *vm, unformat_input_t *input,
+ vlib_cli_command_t *cmd)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ clib_error_t *error = NULL;
+ u32 sw_if_index;
+
+ sw_if_index = ~0;
+
+ if (unformat_user (input, unformat_vnet_sw_interface, vnm, &sw_if_index))
+ {
+ vnet_feature_enable_disable ("ip4-unicast", "ip4-not-enabled",
+ sw_if_index, 0, 0, 0);
+
+ vnet_feature_enable_disable ("ip4-multicast", "ip4-not-enabled",
+ sw_if_index, 0, 0, 0);
+ }
+ else
+ {
+ error = clib_error_return (0, "unknown interface\n'",
+ format_unformat_error, input);
+ }
+ return error;
+}
+
+/*?
+ * This command is used to enable IPv4 on a given interface.
+ *
+ * @cliexpar
+ * Example of how enable IPv4 on a given interface:
+ * @cliexcmd{enable ip4 interface GigabitEthernet2/0/0}
+?*/
+VLIB_CLI_COMMAND (enable_ip4_interface_command, static) = {
+ .path = "enable ip4 interface",
+ .function = enable_ip4_interface_cmd,
+ .short_help = "enable ip4 interface <interface>",
+};
+
/* Dummy init function to get us linked in. */
static clib_error_t *
ip4_cli_init (vlib_main_t * vm)
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 1f025fa1113..e7133a5021f 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -74,6 +74,26 @@ static void
}
static void
+vl_api_sw_interface_ip4_enable_disable_t_handler (
+ vl_api_sw_interface_ip4_enable_disable_t *mp)
+{
+ vl_api_sw_interface_ip4_enable_disable_reply_t *rmp;
+ int rv = 0;
+
+ VALIDATE_SW_IF_INDEX_END (mp);
+
+ vnet_feature_enable_disable ("ip4-unicast", "ip4-not-enabled",
+ mp->sw_if_index, mp->enable, 0, 0);
+
+ vnet_feature_enable_disable ("ip4-multicast", "ip4-not-enabled",
+ mp->sw_if_index, mp->enable, 0, 0);
+
+ BAD_SW_IF_INDEX_LABEL;
+
+ REPLY_MACRO_END (VL_API_SW_INTERFACE_IP4_ENABLE_DISABLE_REPLY);
+}
+
+static void
send_ip_table_details (vpe_api_main_t * am,
vl_api_registration_t * reg,
u32 context, const fib_table_t * table)
diff --git a/src/vnet/ip/ip_test.c b/src/vnet/ip/ip_test.c
index 0d1c71063ae..1e803dd4501 100644
--- a/src/vnet/ip/ip_test.c
+++ b/src/vnet/ip/ip_test.c
@@ -1325,6 +1325,11 @@ api_sw_interface_ip6_enable_disable (vat_main_t *vam)
}
static int
+api_sw_interface_ip4_enable_disable (vat_main_t *vam)
+{
+ return -1;
+}
+static int
api_set_ip_flow_hash_v2 (vat_main_t *vat)
{
return -1;