19 #include <sys/ioctl.h> 75 .short_help =
"clear igmp int <interface>",
87 ip46_address_t saddr, *saddrs =
NULL, gaddr;
96 "'help igmp listen' or 'igmp listen ?' for help");
102 if (
unformat (line_input,
"enable"))
104 else if (
unformat (line_input,
"disable"))
131 rv =
igmp_listen (vm, enable, sw_if_index, saddrs, &gaddr);
145 "Failed to add configuration, interface is in router mode");
155 .path =
"igmp listen",
156 .short_help =
"igmp listen [<enable|disable>] " 157 "int <interface> saddr <ip4-address> gaddr <ip4-address>",
179 if (
unformat (line_input,
"enable"))
181 else if (
unformat (line_input,
"disable"))
184 mode = IGMP_MODE_HOST;
185 else if (
unformat (line_input,
"router"))
186 mode = IGMP_MODE_ROUTER;
187 else if (
unformat (line_input,
"%U",
198 if (~0 == sw_if_index)
217 .short_help =
"igmp <enable|disable> <host|router> <interface>",
236 vlib_cli_output (vm,
"interface: %U mode:%U",
237 format_vnet_sw_if_index_name, vnm, config->sw_if_index,
238 format_igmp_mode, config->mode);
240 FOR_EACH_GROUP (group, config,
242 vlib_cli_output (vm,
"\t%U", format_igmp_key, group->key);
243 FOR_EACH_SRC (src, group, IGMP_FILTER_MODE_INCLUDE,
245 vlib_cli_output (vm,
"\t\t%U", format_igmp_key, src->key);
256 .path =
"show igmp config",
257 .short_help =
"show igmp config",
267 #define _(n,f) vlib_cli_output (vm, "%s: %d", #f, igmp_timer_type_get(n)); 275 .path =
"show igmp timers",
276 .short_help =
"show igmp timers",
290 if (
unformat (input,
"query %d", &value))
292 else if (
unformat (input,
"src %d", &value))
294 else if (
unformat (input,
"leave %d", &value))
305 .path =
"test igmp timers",
306 .short_help =
"Change the default values for IGMP timers - only sensible during unit tests",
int igmp_listen(vlib_main_t *vm, igmp_filter_mode_t mode, u32 sw_if_index, const ip46_address_t *saddrs, const ip46_address_t *gaddr)
igmp listen Called by a host to request reception of multicast packets
vnet_main_t * vnet_get_main(void)
igmp_config_t * configs
pool of configs
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
unformat_function_t unformat_vnet_sw_interface
static clib_error_t * igmp_show_timers_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void igmp_clear_config(igmp_config_t *config)
igmp clear config
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
#define clib_error_return(e, args...)
static clib_error_t * test_igmp_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
igmp_config_t * igmp_config_lookup(u32 sw_if_index)
igmp config lookup
int igmp_enable_disable(u32 sw_if_index, u8 enable, igmp_mode_t mode)
IGMP interface enable/disable.
static clib_error_t * igmp_clear_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void igmp_timer_type_set(igmp_timer_type_t t, u32 v)
static clib_error_t * igmp_listen_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
collection of data related to IGMP
#define vec_free(V)
Free vector's memory (no header).
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * igmp_show_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
IGMP interface configuration.
IGMP group A multicast group address for which reception has been requested.
clib_error_t * igmp_cli_init(vlib_main_t *vm)
enum igmp_mode_t_ igmp_mode_t
static vnet_sw_interface_flags_t vnet_sw_interface_get_flags(vnet_main_t *vnm, u32 sw_if_index)
static clib_error_t * igmp_enable_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
IGMP source The representation of a specified source address with in multicast group.