Hi, Neale Many thanks! I did the same job already ) My patch in attach. I'm trying to test it now and will write later about results.
Best regards, Aleksander On Mon, Aug 27, 2018 at 05:40 PM, Neale Ranns wrote: > > > > Hi Aleksander, > > > > > > > > The API required to enable router mode did not have a CLI equivalent. I > have added it in : > > > > https://gerrit.fd.io/r/#/c/14507/ > > > > > > > > now do: > > > > igmp enable router <INTERFACE> > > > > when done > > > > igmp disable router <INTERFACE> > > > > > >
--- src/plugins/igmp/igmp_cli.c.orig 2018-08-27 09:58:45.076027254 +0300 +++ src/plugins/igmp/igmp_cli.c 2018-08-27 15:09:17.709417958 +0300 @@ -78,6 +78,72 @@ /* *INDENT-ON* */ static clib_error_t * +igmp_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + unformat_input_t _line_input, *line_input = &_line_input; + clib_error_t *error = NULL; + vnet_main_t *vnm = vnet_get_main (); + u32 sw_if_index; + u8 enable = 1; + igmp_mode_t mode = IGMP_MODE_HOST; + + if (!unformat_user (input, unformat_line_input, line_input)) + { + error = + clib_error_return (0, + "'help igmp' or 'igmp ?' for help"); + return error; + } + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "enable")) + enable = 1; + else if (unformat (line_input, "disable")) + enable = 0; + else + if (unformat + (line_input, "int %U", unformat_vnet_sw_interface, vnm, + &sw_if_index)); + else + if (unformat (line_input, "mode host")); + else + if (unformat (line_input, "mode router")) + mode = IGMP_MODE_ROUTER; + else + { + error = + clib_error_return (0, "unknown input '%U'", format_unformat_error, + line_input); + goto done; + } + } + + if ((vnet_sw_interface_get_flags (vnm, sw_if_index) + && VNET_SW_INTERFACE_FLAG_ADMIN_UP) == 0) + { + error = clib_error_return (0, "Interface is down"); + goto done; + } + + igmp_enable_disable (sw_if_index, enable, mode); + +done: + unformat_free (line_input); + return error; +} + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (igmp_enable_disable_command, static) = { + .path = "igmp", + .short_help = "igmp [<enable|disable>] " + "int <interface> mode [<host|router>]", + .function = igmp_enable_disable_command_fn, +}; +/* *INDENT-ON* */ + +static clib_error_t * igmp_listen_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) {
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#10313): https://lists.fd.io/g/vpp-dev/message/10313 Mute This Topic: https://lists.fd.io/mt/24971765/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-