- +static clib_error_t *
- +add_default_linux_route_command_fn (vlib_main_t * vm,
- + unformat_input_t * input,
- + vlib_cli_command_t * c)
- +{
- + int rv __attribute__((unused));
- + ip4_address_t ip4_addr;
- + u8 *cmd;
- +
- + if (!unformat (input, "%U", unformat_ip4_address, &ip4_addr))
- + return clib_error_return (0, "default gateway address required...");
- +
- + cmd = format (0, "/sbin/route add -net 0.0.0.0/0 gw %U",
- + format_ip4_address, &ip4_addr);
- + vec_add1 (cmd, 0);
- +
- + rv = system (cmd);
- +
- + vlib_cli_output (vm, "%s", cmd);
- +
- + vec_free(cmd);
- +
- + return 0;
- +}
- +
- +/* *INDENT-OFF* */
- +VLIB_CLI_COMMAND (add_default_linux_route_command, static) = {
- + .path = "add default linux route via",
- + .short_help = "Adds default linux route: 0.0.0.0/0 via <addr>",
- + .function = add_default_linux_route_command_fn,
- +};
- +/* *INDENT-ON* */
- +
- +