diff options
author | Matus Fabian <matfabia@cisco.com> | 2018-05-14 06:20:28 -0700 |
---|---|---|
committer | Matus Fabian <matfabia@cisco.com> | 2018-05-17 01:06:17 -0700 |
commit | 70a26ac05f2ab9d4cc0669599b09f654de580f36 (patch) | |
tree | 4fd5d9f4a1db0f56d6300f399ae84bb92748edbc /src/plugins/nat/nat44_cli.c | |
parent | f9d0568344b4766bc1ddc1be9a7e9afd00e2d832 (diff) |
NAT44: nat44_del_session and nat44_user_session_details API update (VPP-1271)
Change-Id: I484d79000c1bbd87ff83847cf567bf3414a719d3
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44_cli.c')
-rw-r--r-- | src/plugins/nat/nat44_cli.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c index f07b6dde215..efde4be284c 100644 --- a/src/plugins/nat/nat44_cli.c +++ b/src/plugins/nat/nat44_cli.c @@ -959,10 +959,10 @@ nat44_del_session_command_fn (vlib_main_t * vm, { snat_main_t *sm = &snat_main; unformat_input_t _line_input, *line_input = &_line_input; - int is_in = 0; + int is_in = 0, is_ed = 0; clib_error_t *error = 0; - ip4_address_t addr; - u32 port = 0, vrf_id = sm->outside_vrf_id; + ip4_address_t addr, eh_addr; + u32 port = 0, eh_port = 0, vrf_id = sm->outside_vrf_id; snat_protocol_t proto; int rv; @@ -984,9 +984,19 @@ nat44_del_session_command_fn (vlib_main_t * vm, is_in = 1; vrf_id = sm->inside_vrf_id; } + else if (unformat (line_input, "out")) + { + is_in = 0; + vrf_id = sm->outside_vrf_id; + } else if (unformat (line_input, "vrf %u", &vrf_id)) ; else + if (unformat + (line_input, "external-host %U:%u", unformat_ip4_address, + &eh_addr, &eh_port)) + is_ed = 1; + else { error = clib_error_return (0, "unknown input '%U'", format_unformat_error, line_input); @@ -994,7 +1004,12 @@ nat44_del_session_command_fn (vlib_main_t * vm, } } - rv = nat44_del_session (sm, &addr, port, proto, vrf_id, is_in); + if (is_ed) + rv = + nat44_del_ed_session (sm, &addr, port, &eh_addr, eh_port, + snat_proto_to_ip_proto (proto), vrf_id, is_in); + else + rv = nat44_del_session (sm, &addr, port, proto, vrf_id, is_in); switch (rv) { @@ -1750,7 +1765,7 @@ VLIB_CLI_COMMAND (nat44_show_sessions_command, static) = { ?*/ VLIB_CLI_COMMAND (nat44_del_session_command, static) = { .path = "nat44 del session", - .short_help = "nat44 del session in|out <addr>:<port> tcp|udp|icmp [vrf <id>]", + .short_help = "nat44 del session in|out <addr>:<port> tcp|udp|icmp [vrf <id>] [external-host <addr>:<port>]", .function = nat44_del_session_command_fn, }; |