aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/dslite_cli.c
diff options
context:
space:
mode:
authorJuraj Sloboda <jsloboda@cisco.com>2018-01-09 16:08:32 +0100
committerOle Trøan <otroan@employees.org>2018-01-11 09:34:17 +0000
commitc5c6a3342f3cbaaac647d52fd960b6f5b0fcd4e0 (patch)
tree3d54fcf6ff947fe45179a9ba47ef43f5f0caf7b8 /src/plugins/nat/dslite_cli.c
parent83d47438ae7c9b3fc53329846ee46a82a3087578 (diff)
Add basic support for DS-Lite CE (VPP-1059)
Change-Id: Ifcca60da3f77c0a4959f98b3365c846badbdc2d0 Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'src/plugins/nat/dslite_cli.c')
-rw-r--r--src/plugins/nat/dslite_cli.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/plugins/nat/dslite_cli.c b/src/plugins/nat/dslite_cli.c
index 7282762ebfc..f600c0350d6 100644
--- a/src/plugins/nat/dslite_cli.c
+++ b/src/plugins/nat/dslite_cli.c
@@ -161,6 +161,56 @@ dslite_show_aftr_ip6_addr_command_fn (vlib_main_t * vm,
return 0;
}
+static clib_error_t *
+dslite_set_b4_tunnel_addr_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ dslite_main_t *dm = &dslite_main;
+ unformat_input_t _line_input, *line_input = &_line_input;
+ ip6_address_t ip6_addr;
+ int rv;
+ clib_error_t *error = 0;
+
+ /* Get a line of input. */
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "%U", unformat_ip6_address, &ip6_addr))
+ ;
+ else
+ {
+ error = clib_error_return (0, "unknown input '%U'",
+ format_unformat_error, line_input);
+ goto done;
+ }
+ }
+
+ rv = dslite_set_b4_ip6_addr (dm, &ip6_addr);
+
+ if (rv)
+ error =
+ clib_error_return (0, "Set DS-Lite B4 tunnel endpoint address failed.");
+
+done:
+ unformat_free (line_input);
+
+ return error;
+}
+
+static clib_error_t *
+dslite_show_b4_ip6_addr_command_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ dslite_main_t *dm = &dslite_main;
+
+ vlib_cli_output (vm, "%U", format_ip6_address, &dm->b4_ip6_addr);
+ return 0;
+}
+
static u8 *
format_dslite_session (u8 * s, va_list * args)
{
@@ -263,6 +313,18 @@ VLIB_CLI_COMMAND (dslite_show_aftr_ip6_addr, static) = {
.function = dslite_show_aftr_ip6_addr_command_fn,
};
+VLIB_CLI_COMMAND (dslite_set_b4_tunnel_addr, static) = {
+ .path = "dslite set b4-tunnel-endpoint-address",
+ .short_help = "dslite set b4-tunnel-endpoint-address <ip6>",
+ .function = dslite_set_b4_tunnel_addr_command_fn,
+};
+
+VLIB_CLI_COMMAND (dslite_show_b4_ip6_addr, static) = {
+ .path = "show dslite b4-tunnel-endpoint-address",
+ .short_help = "show dslite b4-tunnel-endpoint-address",
+ .function = dslite_show_b4_ip6_addr_command_fn,
+};
+
VLIB_CLI_COMMAND (dslite_show_sessions, static) = {
.path = "show dslite sessions",
.short_help = "show dslite sessions",