int rv = 0;
clib_error_t *error = 0;
- /* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, NAT44_ED_EXPECTED_ARGUMENT);
u8 log_level = NAT_LOG_NONE;
clib_error_t *error = 0;
- /* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, NAT44_ED_EXPECTED_ARGUMENT);
clib_error_t *error = 0;
u32 mss;
- /* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, NAT44_ED_EXPECTED_ARGUMENT);
clib_error_t *error = 0;
u8 twice_nat = 0;
- /* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, NAT44_ED_EXPECTED_ARGUMENT);
sw_if_index = ~0;
- /* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, NAT44_ED_EXPECTED_ARGUMENT);
ip_protocol_t proto;
u8 proto_set = 0;
- /* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, NAT44_ED_EXPECTED_ARGUMENT);
vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
- snat_main_t *sm = &snat_main;
+ vnet_main_t *vnm = vnet_get_main ();
clib_error_t *error = 0;
int rv, is_del = 0;
u8 twice_nat = 0;
u32 sw_if_index;
+ sw_if_index = ~0;
+
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, NAT44_ED_EXPECTED_ARGUMENT);
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (line_input, "%U", unformat_vnet_sw_interface,
- sm->vnet_main, &sw_if_index))
+ if (unformat (line_input, "%U", unformat_vnet_sw_interface, vnm,
+ &sw_if_index))
;
else if (unformat (line_input, "twice-nat"))
{
}
}
- if (!is_del)
+ if (is_del)
{
- rv = nat44_ed_add_interface_address (sw_if_index, twice_nat);
- if (rv)
- {
- error = clib_error_return (0, "add address returned %d", rv);
- }
+ rv = nat44_ed_del_interface_address (sw_if_index, twice_nat);
}
else
{
- rv = nat44_ed_del_interface_address (sw_if_index, twice_nat);
- if (rv)
- {
- error = clib_error_return (0, "del address returned %d", rv);
- }
+ rv = nat44_ed_add_interface_address (sw_if_index, twice_nat);
+ }
+
+ if (0 != rv)
+ {
+ error =
+ clib_error_return (0, "%s %U address failed", is_del ? "del" : "add",
+ format_vnet_sw_if_index_name, vnm, sw_if_index);
+ goto done;
}
done:
* @cliexstart{nat44}
* Enable nat44 plugin
* To enable nat44-ed, use:
- * vpp# nat44 enable
+ * vpp# nat44 plugin enable
* To disable nat44-ed, use:
- * vpp# nat44 disable
+ * vpp# nat44 plugin disable
* To set inside-vrf outside-vrf, use:
- * vpp# nat44 enable inside-vrf <id> outside-vrf <id>
+ * vpp# nat44 plugin enable inside-vrf <id> outside-vrf <id>
* @cliexend
?*/
VLIB_CLI_COMMAND (nat44_ed_enable_disable_command, static) = {
- .path = "nat44",
- .short_help = "nat44 <enable [sessions <max-number>] [inside-vrf <vrf-id>] "
- "[outside-vrf <vrf-id>]>|disable",
+ .path = "nat44 plugin",
.function = nat44_ed_enable_disable_command_fn,
+ .short_help =
+ "nat44 plugin <enable [sessions <max-number>] [inside-vrf <vrf-id>] "
+ "[outside-vrf <vrf-id>]>|disable",
};
/*?
* @cliexend
?*/
VLIB_CLI_COMMAND (snat_add_interface_address_command, static) = {
- .path = "nat44 add interface address",
- .short_help = "nat44 add interface address <interface> [twice-nat] [del]",
- .function = snat_add_interface_address_command_fn,
+ .path = "nat44 add interface address",
+ .function = snat_add_interface_address_command_fn,
+ .short_help = "nat44 add interface address <interface> [twice-nat] [del]",
};
/*?
* @cliexstart{nat44 ei}
* Enable nat44 ei plugin
* To enable nat44-ei, use:
- * vpp# nat44 ei enable
+ * vpp# nat44 ei plugin enable
* To disable nat44-ei, use:
- * vpp# nat44 ei disable
+ * vpp# nat44 ei plugin disable
* To enable nat44 ei static mapping only, use:
- * vpp# nat44 ei enable static-mapping
+ * vpp# nat44 ei plugin enable static-mapping
* To enable nat44 ei static mapping with connection tracking, use:
- * vpp# nat44 ei enable static-mapping connection-tracking
+ * vpp# nat44 ei plugin enable static-mapping connection-tracking
* To enable nat44 ei out2in dpo, use:
- * vpp# nat44 ei enable out2in-dpo
+ * vpp# nat44 ei plugin enable out2in-dpo
* To set inside-vrf outside-vrf, use:
- * vpp# nat44 ei enable inside-vrf <id> outside-vrf <id>
+ * vpp# nat44 ei plugin enable inside-vrf <id> outside-vrf <id>
* @cliexend
?*/
VLIB_CLI_COMMAND (nat44_ei_enable_disable_command, static) = {
- .path = "nat44 ei",
+ .path = "nat44 ei plugin",
.short_help =
- "nat44 ei <enable [sessions <max-number>] [users <max-number>] "
+ "nat44 ei plugin <enable [sessions <max-number>] [users <max-number>] "
"[static-mappig-only [connection-tracking]|out2in-dpo] [inside-vrf "
"<vrf-id>] [outside-vrf <vrf-id>] [user-sessions <max-number>]>|disable",
.function = nat44_ei_enable_disable_command_fn,