diff options
author | Matus Fabian <matfabia@cisco.com> | 2018-07-19 22:45:25 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-08-02 17:17:47 +0000 |
commit | c6c0d2a077a77a126d642ff12dd326222cf13a7a (patch) | |
tree | abcf965c9342a9fdb438e8c21386147850771b6a /src/plugins/nat/nat44_cli.c | |
parent | e4a9eb7873f140f88be7fffb83e1215fbf181116 (diff) |
NAT44: LB NAT - local backends in multiple VRFs (VPP-1345)
Add support for local backends in multiple VRFs for load-balancing NAT rules.
Change-Id: I64e6818bd67a7e69985003498cf1f16f7200c334
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 | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/plugins/nat/nat44_cli.c b/src/plugins/nat/nat44_cli.c index aa733a06a5a..e4fd0caa302 100644 --- a/src/plugins/nat/nat44_cli.c +++ b/src/plugins/nat/nat44_cli.c @@ -767,11 +767,20 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm, local.probability = (u8) probability; vec_add1 (locals, local); } + else if (unformat (line_input, "local %U:%u vrf %u probability %u", + unformat_ip4_address, &l_addr, &l_port, &vrf_id, + &probability)) + { + memset (&local, 0, sizeof (local)); + local.addr = l_addr; + local.port = (u16) l_port; + local.probability = (u8) probability; + local.vrf_id = vrf_id; + vec_add1 (locals, local); + } else if (unformat (line_input, "external %U:%u", unformat_ip4_address, &e_addr, &e_port)) ; - else if (unformat (line_input, "vrf %u", &vrf_id)) - ; else if (unformat (line_input, "protocol %U", unformat_snat_protocol, &proto)) proto_set = 1; @@ -803,9 +812,8 @@ add_lb_static_mapping_command_fn (vlib_main_t * vm, goto done; } - rv = nat44_add_del_lb_static_mapping (e_addr, (u16) e_port, proto, vrf_id, - locals, is_add, twice_nat, - out2in_only, 0); + rv = nat44_add_del_lb_static_mapping (e_addr, (u16) e_port, proto, locals, + is_add, twice_nat, out2in_only, 0); switch (rv) { @@ -1716,8 +1724,8 @@ VLIB_CLI_COMMAND (add_lb_static_mapping_command, static) = { .function = add_lb_static_mapping_command_fn, .short_help = "nat44 add load-balancing static mapping protocol tcp|udp " - "external <addr>:<port> local <addr>:<port> probability <n> " - "[twice-nat|self-twice-nat] [vrf <table-id>] [out2in-only] [del]", + "external <addr>:<port> local <addr>:<port> [vrf <table-id>] " + "probability <n> [twice-nat|self-twice-nat] [out2in-only] [del]", }; /*? |