FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
igmp.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vnet/plugin/plugin.h>
20 #include <vpp/app/version.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/mfib/mfib_entry.h>
23 #include <vlib/unix/unix.h>
24 #include <vnet/adj/adj_mcast.h>
25 #include <vnet/fib/fib_entry.h>
26 #include <vnet/fib/fib_table.h>
27 #include <vnet/mfib/mfib_table.h>
28 
29 #include <igmp/igmp.h>
30 #include <igmp/igmp_format.h>
31 #include <igmp/igmp_pkt.h>
32 
33 #include <limits.h>
34 #include <float.h>
35 
37 
38 /* *INDENT-OFF* */
39 /* General Query address */
42  .fp_len = 32,
43  .fp_grp_addr = {
44  .ip4 = {
46  },
47  },
48 };
49 
50 /* Report address */
51 const static mfib_prefix_t mpfx_report = {
53  .fp_len = 32,
54  .fp_grp_addr = {
55  .ip4 = {
57  },
58  },
59 };
60 /* *INDENT-ON* */
61 
62 /**
63  * @brief igmp send query (igmp_timer_function_t)
64  *
65  * Send an igmp query.
66  * If the timer holds group key, send Group-Specific query,
67  * else send General query.
68  */
69 static void
70 igmp_send_general_query (u32 obj, void *dat)
71 {
73  igmp_config_t *config;
74 
75  config = igmp_config_get (obj);
76 
77  IGMP_DBG ("send-general-query: %U",
79  config->sw_if_index);
80 
81  igmp_timer_retire (&config->timers[IGMP_CONFIG_TIMER_GENERAL_QUERY]);
82 
84  igmp_pkt_query_v3_add_group (&bq, NULL, NULL);
86 
87  /*
88  * re-schedule
89  */
90  config->timers[IGMP_CONFIG_TIMER_GENERAL_QUERY] =
91  igmp_timer_schedule (igmp_timer_type_get (IGMP_TIMER_QUERY),
92  igmp_config_index (config),
94 }
95 
96 static void
98  const igmp_group_t * group)
99 {
101 
102  IGMP_DBG ("state-change-group: %U", format_igmp_key, group->key);
103 
106  group,
107  IGMP_MEMBERSHIP_GROUP_allow_new_sources);
109 }
110 
111 static void
113 {
114  igmp_config_t *config;
115  igmp_group_t *group;
116 
117  group = igmp_group_get (gi);
118  config = igmp_config_get (group->config);
119 
120  igmp_timer_retire (&group->timers[IGMP_GROUP_TIMER_RESEND_REPORT]);
122 
123  if (++group->n_reports_sent < config->robustness_var)
124  {
125  group->timers[IGMP_GROUP_TIMER_RESEND_REPORT] =
126  igmp_timer_schedule (igmp_timer_type_get (IGMP_TIMER_REPORT_INTERVAL),
127  igmp_group_index (group),
129  }
130 }
131 
132 int
136  const ip46_address_t * saddrs, const ip46_address_t * gaddr)
137 {
138  const ip46_address_t *saddr;
139  igmp_config_t *config;
140  igmp_group_t *group;
141 
142  /*
143  * RFC 3376 Section 2
144  " For a given combination of socket, interface, and multicast address,
145  * only a single filter mode and source list can be in effect at any one
146  * time. However, either the filter mode or the source list, or both,
147  * may be changed by subsequent IPMulticastListen requests that specify
148  * the same socket, interface, and multicast address. Each subsequent
149  * request completely replaces any earlier request for the given socket,
150  * interface and multicast address."
151  */
152  int rv = 0;
153  IGMP_DBG ("listen: (%U, %U) %U %U",
158  /*
159  * find configuration, if it doesn't exist, then this interface is
160  * not IGMP enabled
161  */
162  config = igmp_config_lookup (sw_if_index);
163 
164  if (!config)
165  {
166  rv = VNET_API_ERROR_INVALID_INTERFACE;
167  goto error;
168  }
169  if (config->mode != IGMP_MODE_HOST)
170  {
171  rv = VNET_API_ERROR_INVALID_INTERFACE;
172  goto error;
173  }
174 
175  /* find igmp group, if it doesn't exist, create new */
176  group = igmp_group_lookup (config, gaddr);
177 
178  if (!group)
179  {
180  group = igmp_group_alloc (config, gaddr, mode);
181 
182  /* new group implies create all sources */
183  vec_foreach (saddr, saddrs)
184  {
185  igmp_group_src_update (group, saddr, IGMP_MODE_HOST);
186  }
187 
188  /*
189  * Send state changed event report for the group.
190  *
191  * RFC3376 Section 5.1
192  * "To cover the possibility of the State-Change Report being missed by
193  * one or more multicast routers, it is retransmitted [Robustness
194  * Variable] - 1 more times, at intervals chosen at random from the
195  * range (0, [Unsolicited Report Interval])."
196  */
198 
199  igmp_timer_retire (&group->timers[IGMP_GROUP_TIMER_RESEND_REPORT]);
200 
201  group->n_reports_sent = 1;
202  group->timers[IGMP_GROUP_TIMER_RESEND_REPORT] =
203  igmp_timer_schedule (igmp_timer_type_get (IGMP_TIMER_REPORT_INTERVAL),
204  igmp_group_index (group),
206  }
207  else
208  {
209  IGMP_DBG ("... update (%U, %U) %U %U",
214 
215  /*
216  * RFC 3367 Section 5.1
217  *
218  * Old State New State State-Change Record Sent
219  * --------- --------- ------------------------
220  *
221  * 1) INCLUDE (A) INCLUDE (B) ALLOW (B-A), BLOCK (A-B)
222  * 2) EXCLUDE (A) EXCLUDE (B) ALLOW (A-B), BLOCK (B-A)
223  * 3) INCLUDE (A) EXCLUDE (B) TO_EX (B)
224  * 4) EXCLUDE (A) INCLUDE (B) TO_IN (B)
225  *
226  * N.B. We do not split state-change records for pending transfer
227  * hence there is no merge logic required.
228  */
229 
230  if (IGMP_FILTER_MODE_INCLUDE == mode)
231  {
232  ip46_address_t *added, *removed;
234 
235  /*
236  * find the list of sources that have been added and removed from
237  * the include set
238  */
239  removed =
240  igmp_group_present_minus_new (group, IGMP_FILTER_MODE_INCLUDE,
241  saddrs);
242  added =
243  igmp_group_new_minus_present (group, IGMP_FILTER_MODE_INCLUDE,
244  saddrs);
245 
246  if (!(vec_len (added) || vec_len (removed)))
247  /* no change => done */
248  goto error;
249 
251 
252  if (vec_len (added))
253  {
255  group->key,
256  added,
257  IGMP_MEMBERSHIP_GROUP_allow_new_sources);
258  }
259 
260  if (vec_len (removed))
261  {
263  group->key,
264  removed,
265  IGMP_MEMBERSHIP_GROUP_block_old_sources);
266  }
267 
268  IGMP_DBG ("... added %U", format_igmp_src_addr_list, added);
269  IGMP_DBG ("... removed %U", format_igmp_src_addr_list, removed);
270 
272 
273  /*
274  * clear the group of the old sources and populate it with the new
275  * set requested
276  */
277  igmp_group_free_all_srcs (group);
278 
279  vec_foreach (saddr, saddrs)
280  {
281  igmp_group_src_update (group, saddr, IGMP_MODE_HOST);
282  }
283 
284  if (0 == igmp_group_n_srcs (group, mode))
285  igmp_group_clear (&group);
286 
287  vec_free (added);
288  vec_free (removed);
289  }
290  else
291  {
292  /*
293  * The control plane is excluding some sources.
294  * - First; check for those that are present in the include list
295  * - Second; check add them to the exclude list
296  *
297  * TODO
298  */
299  }
300  }
301 
302 error:
303  return (rv);
304 }
305 
306 static walk_rc_t
308 {
309  igmp_config_t *config;
310  config = igmp_config_lookup (sw_if_index);
311  IGMP_DBG ("down: %U",
313  if (NULL != config)
314  {
315  igmp_clear_config (config);
316  }
317 
318  return (WALK_CONTINUE);
319 }
320 
321 /** \brief igmp hardware interface link up down
322  @param vnm - vnet main
323  @param hw_if_index - interface hw_if_index
324  @param flags - hw interface flags
325 
326  If an interface goes down, remove its (S,G)s.
327 */
328 static clib_error_t *
330 {
331  clib_error_t *error = NULL;
332  /* remove igmp state from down interfaces */
334  vnet_hw_interface_walk_sw (vnm, hw_if_index, igmp_sw_if_down, NULL);
335  return error;
336 }
337 
339 int
341 {
342  igmp_config_t *config;
344  u32 mfib_index;
345  IGMP_DBG ("%s: %U", (enable ? "Enabled" : "Disabled"),
347 
348  /* *INDENT-OFF* */
349  fib_route_path_t via_itf_path =
350  {
352  .frp_addr = zero_addr,
353  .frp_sw_if_index = sw_if_index,
354  .frp_fib_index = 0,
355  .frp_weight = 1,
356  .frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT,
357  };
358  fib_route_path_t for_us_path = {
360  .frp_addr = zero_addr,
361  .frp_sw_if_index = 0xffffffff,
362  .frp_fib_index = 1,
363  .frp_weight = 0,
364  .frp_flags = FIB_ROUTE_PATH_LOCAL,
365  .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD,
366  };
367 
368  /* *INDENT-ON* */
369  /* find configuration, if it doesn't exist, create new */
370  config = igmp_config_lookup (sw_if_index);
372  sw_if_index);
373  if (!config && enable)
374  {
375  u32 ii;
376 
377  vec_validate_init_empty (im->igmp_config_by_sw_if_index,
378  sw_if_index, ~0);
379  pool_get (im->configs, config);
380  clib_memset (config, 0, sizeof (igmp_config_t));
381  config->sw_if_index = sw_if_index;
382  config->igmp_group_by_key =
383  hash_create_mem (0, sizeof (igmp_key_t), sizeof (uword));
385  config->mode = mode;
386  config->proxy_device_id = ~0;
387 
388  for (ii = 0; ii < IGMP_CONFIG_N_TIMERS; ii++)
389  config->timers[ii] = IGMP_TIMER_ID_INVALID;
390 
391  if (IGMP_MODE_ROUTER == mode)
392  {
393  config->timers[IGMP_CONFIG_TIMER_GENERAL_QUERY] =
394  igmp_timer_schedule (igmp_timer_type_get (IGMP_TIMER_QUERY),
395  igmp_config_index (config),
397  }
398 
399  config->adj_index =
401  config->sw_if_index);
402  im->igmp_config_by_sw_if_index[config->sw_if_index] =
403  (config - im->configs);
404  {
405  vec_validate (im->n_configs_per_mfib_index, mfib_index);
406  im->n_configs_per_mfib_index[mfib_index]++;
407  if (1 == im->n_configs_per_mfib_index[mfib_index])
408  {
409  /* first config in this FIB */
411  mfib_table_entry_path_update (mfib_index,
413  MFIB_SOURCE_IGMP, &for_us_path);
414  mfib_table_entry_path_update (mfib_index,
415  &mpfx_report,
416  MFIB_SOURCE_IGMP, &for_us_path);
417  }
418  mfib_table_entry_path_update (mfib_index,
420  MFIB_SOURCE_IGMP, &via_itf_path);
422  MFIB_SOURCE_IGMP, &via_itf_path);
423  }
424  }
425  else if (config && !enable)
426  {
427  vec_validate (im->n_configs_per_mfib_index, mfib_index);
428  im->n_configs_per_mfib_index[mfib_index]--;
429  if (0 == im->n_configs_per_mfib_index[mfib_index])
430  {
431  /* last config in this FIB */
432  mfib_table_entry_path_remove (mfib_index,
434  MFIB_SOURCE_IGMP, &for_us_path);
435  mfib_table_entry_path_remove (mfib_index,
436  &mpfx_report,
437  MFIB_SOURCE_IGMP, &for_us_path);
439  }
440 
441  mfib_table_entry_path_remove (mfib_index,
443  MFIB_SOURCE_IGMP, &via_itf_path);
444  mfib_table_entry_path_remove (mfib_index,
445  &mpfx_report,
446  MFIB_SOURCE_IGMP, &via_itf_path);
447 
448  /*
449  * remove interface from proxy device
450  * if this device is upstream, delete proxy device
451  */
452  if (config->mode == IGMP_MODE_ROUTER)
454  config->sw_if_index, 0);
455  else if (config->mode == IGMP_MODE_HOST)
457  config->sw_if_index, 0);
458 
459  igmp_clear_config (config);
460  im->igmp_config_by_sw_if_index[config->sw_if_index] = ~0;
461  hash_free (config->igmp_group_by_key);
462  pool_put (im->configs, config);
463  }
464  else
465  {
466  return -1;
467  }
468 
469  return (0);
470 }
471 
472 /** \brief igmp initialization
473  @param vm - vlib main
474 
475  initialize igmp plugin. Initialize igmp_main, set mfib to allow igmp traffic.
476 */
477 static clib_error_t *
479 {
481 
482  im->igmp_api_client_by_client_index = hash_create (0, sizeof (u32));
483  im->logger = vlib_log_register_class ("igmp", 0);
484 
485  IGMP_DBG ("initialized");
486 
487  return (0);
488 }
489 
490 /* *INDENT-OFF* */
492 {
493  .runs_after = VLIB_INITS("ip4_lookup_init"),
494 };
496 {
497  .version = VPP_BUILD_VER,
498  .description = "Internet Group Management Protocol (IGMP)",
499 };
500 /* *INDENT-ON* */
501 
502 /*
503  * fd.io coding-style-patch-verification: ON
504  *
505  * Local Variables:
506  * eval: (c-set-style "gnu")
507  * End:
508  */
vlib.h
igmp_mode_t
enum igmp_mode_t_ igmp_mode_t
im
vnet_interface_main_t * im
Definition: interface_output.c:395
fib_entry.h
igmp_send_general_query
static void igmp_send_general_query(u32 obj, void *dat)
igmp send query (igmp_timer_function_t)
Definition: igmp.c:70
igmp_group_n_srcs
u32 igmp_group_n_srcs(const igmp_group_t *group, igmp_filter_mode_t mode)
Definition: igmp_group.c:251
igmp_group_index
u32 igmp_group_index(const igmp_group_t *g)
Definition: igmp_group.c:273
IGMP_MEMBERSHIP_REPORT_ADDRESS
#define IGMP_MEMBERSHIP_REPORT_ADDRESS
Definition: igmp.h:52
WALK_CONTINUE
@ WALK_CONTINUE
Definition: interface_funcs.h:174
IGMP_DBG
#define IGMP_DBG(...)
Definition: igmp.h:38
zero_addr
const ip46_address_t zero_addr
#include <vnet/feature/feature.h>
Definition: lookup.c:182
igmp_config_get
igmp_config_t * igmp_config_get(u32 index)
Get the config from the pool index.
Definition: igmp_config.c:70
igmp_pkt_query_v3_add_group
void igmp_pkt_query_v3_add_group(igmp_pkt_build_query_t *bq, const igmp_group_t *group, const ip46_address_t *srcs)
Definition: igmp_pkt.c:447
mpfx_report
const static mfib_prefix_t mpfx_report
Definition: igmp.c:51
MFIB_ITF_FLAG_ACCEPT
@ MFIB_ITF_FLAG_ACCEPT
Definition: mfib_types.h:152
igmp_timer_retire
void igmp_timer_retire(igmp_timer_id_t *tid)
Definition: igmp_timer.c:221
igmp_config_t_
IGMP interface configuration.
Definition: igmp_config.h:47
IGMP_TIMER_ID_INVALID
#define IGMP_TIMER_ID_INVALID
Definition: igmp_timer.h:28
mfib_prefix_t_
Aggregate type for a prefix.
Definition: mfib_types.h:24
igmp_pkt_report_v3_add_report
void igmp_pkt_report_v3_add_report(igmp_pkt_build_report_t *br, const ip46_address_t *grp, const ip46_address_t *srcs, igmp_membership_group_v3_type_t type)
Definition: igmp_pkt.c:308
vlib_log_register_class
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
Definition: log.c:339
adj_mcast_add_or_lock
adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, vnet_link_t link_type, u32 sw_if_index)
Mcast Adjacency.
Definition: adj_mcast.c:51
VLIB_PLUGIN_REGISTER
VLIB_PLUGIN_REGISTER()
igmp.h
adj_mcast.h
igmp_group_clear
void igmp_group_clear(igmp_group_t **group)
Definition: igmp_group.c:68
igmp_pkt_query_v3_send
void igmp_pkt_query_v3_send(igmp_pkt_build_query_t *bq)
Definition: igmp_pkt.c:512
mfib_entry.h
fib_table.h
igmp_group_present_minus_new
ip46_address_t * igmp_group_present_minus_new(igmp_group_t *group, igmp_filter_mode_t mode, const ip46_address_t *saddrs)
the set of present sources minus the new set
Definition: igmp_group.c:144
igmp_config_t_::sw_if_index
u32 sw_if_index
Definition: igmp_config.h:52
igmp_group_t_
IGMP group A multicast group address for which reception has been requested.
Definition: igmp_group.h:56
mode
vl_api_tunnel_mode_t mode
Definition: gre.api:48
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
igmp_group_new_minus_present
ip46_address_t * igmp_group_new_minus_present(igmp_group_t *group, igmp_filter_mode_t mode, const ip46_address_t *saddrs)
the set of new sources minus the present set
Definition: igmp_group.c:190
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
igmp_group_t_::n_reports_sent
u32 n_reports_sent
The number of times the last report has been sent.
Definition: igmp_group.h:82
fib_route_path_t_::frp_proto
dpo_proto_t frp_proto
The protocol of the address below.
Definition: fib_types.h:505
igmp_config_lookup
igmp_config_t * igmp_config_lookup(u32 sw_if_index)
igmp config lookup
Definition: igmp_config.c:45
hash_create
#define hash_create(elts, value_bytes)
Definition: hash.h:695
igmp_group_src_update
igmp_src_t * igmp_group_src_update(igmp_group_t *group, const igmp_key_t *skey, igmp_mode_t mode)
Definition: igmp_group.c:45
error
Definition: cJSON.c:88
igmp_group_t_::config
u32 config
The pool index of the config object this group is in.
Definition: igmp_group.h:77
igmp_timer_type_get
u32 igmp_timer_type_get(igmp_timer_type_t t)
Definition: igmp_timer.c:68
igmp_pkt_build_query_init
void igmp_pkt_build_query_init(igmp_pkt_build_query_t *bq, u32 sw_if_index)
Definition: igmp_pkt.c:522
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(igmp_hw_interface_link_up_down)
mfib_table_lock
void mfib_table_lock(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Release a reference counting lock on the table.
Definition: mfib_table.c:806
mfib_table_get_index_for_sw_if_index
u32 mfib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
Definition: mfib_table.c:527
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
igmp_group_get
igmp_group_t * igmp_group_get(u32 index)
Definition: igmp_group.c:279
igmp_resend_state_change_group_report_v3
static void igmp_resend_state_change_group_report_v3(u32 gi, void *data)
Definition: igmp.c:112
VNET_LINK_IP4
@ VNET_LINK_IP4
Definition: interface.h:344
IGMP_CONFIG_N_TIMERS
#define IGMP_CONFIG_N_TIMERS
Definition: igmp_config.h:40
hash_free
#define hash_free(h)
Definition: hash.h:310
IGMP_GENERAL_QUERY_ADDRESS
#define IGMP_GENERAL_QUERY_ADDRESS
General Query address - 224.0.0.1 Membership Report address - 224.0.0.22 SSM default range 232/8.
Definition: igmp.h:51
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
igmp_group_t_::timers
u32 timers[IGMP_GROUP_N_TIMERS]
A vector of running timers for the group.
Definition: igmp_group.h:67
igmp_config_t_::timers
igmp_timer_id_t timers[IGMP_CONFIG_N_TIMERS]
A vector of scheduled query-response timers.
Definition: igmp_config.h:77
igmp_config_t_::adj_index
adj_index_t adj_index
Definition: igmp_config.h:57
igmp_config_index
u32 igmp_config_index(const igmp_config_t *c)
Get the pool index for a config.
Definition: igmp_config.c:64
igmp_config_t_::robustness_var
u8 robustness_var
Robustness variable (section 5.1)
Definition: igmp_config.h:67
igmp_group_lookup
igmp_group_t * igmp_group_lookup(igmp_config_t *config, const igmp_key_t *key)
igmp group lookup
Definition: igmp_config.c:76
igmp_pkt_report_v3_add_group
void igmp_pkt_report_v3_add_group(igmp_pkt_build_report_t *br, const igmp_group_t *group, igmp_membership_group_v3_type_t type)
Definition: igmp_pkt.c:348
igmp_config_t_::proxy_device_id
u32 proxy_device_id
ID of a proxy device this configuration is on.
Definition: igmp_config.h:82
igmp_pkt_build_query_t_
Definition: igmp_pkt.h:55
format_igmp_filter_mode
u8 * format_igmp_filter_mode(u8 *s, va_list *args)
Definition: igmp_format.c:50
uword
u64 uword
Definition: types.h:112
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
igmp_init
static clib_error_t * igmp_init(vlib_main_t *vm)
igmp initialization
Definition: igmp.c:478
hash_create_mem
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:660
igmp_hw_interface_link_up_down
static clib_error_t * igmp_hw_interface_link_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
igmp hardware interface link up down
Definition: igmp.c:329
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
mfib_table.h
mfib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: mfib_types.h:33
fib_proto_to_dpo
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:343
mfib_table_unlock
void mfib_table_unlock(u32 fib_index, fib_protocol_t proto, mfib_source_t source)
Take a reference counting lock on the table.
Definition: mfib_table.c:777
plugin.h
data
u8 data[128]
Definition: ipsec_types.api:92
igmp_listen
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
Definition: igmp.c:133
igmp_proxy_device_add_del
int igmp_proxy_device_add_del(u32 vrf_id, u32 sw_if_index, u8 add)
IGMP proxy device add/del.
Definition: igmp_proxy.c:80
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
igmp_proxy_device_add_del_interface
int igmp_proxy_device_add_del_interface(u32 vrf_id, u32 sw_if_index, u8 add)
IGMP proxy device add/del interface.
Definition: igmp_proxy.c:141
MFIB_SOURCE_IGMP
@ MFIB_SOURCE_IGMP
Definition: mfib_types.h:173
igmp_group_t_::key
igmp_key_t * key
The group's key within the per-interface config.
Definition: igmp_group.h:59
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:455
vec_validate_init_empty
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
Definition: vec.h:570
saddrs
vl_api_ip4_address_t saddrs[n_srcs]
Definition: igmp.api:71
igmp_pkt_report_v3_send
void igmp_pkt_report_v3_send(igmp_pkt_build_report_t *br)
Definition: igmp_pkt.c:207
igmp_config_t_::mode
igmp_mode_t mode
Definition: igmp_config.h:62
ip.h
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
gaddr
vl_api_ip4_address_t gaddr
Definition: igmp.api:70
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
IGMP_DEFAULT_ROBUSTNESS_VARIABLE
#define IGMP_DEFAULT_ROBUSTNESS_VARIABLE
RFC 3376 Section 8.1.
Definition: igmp.h:36
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
igmp_pkt_build_report_init
void igmp_pkt_build_report_init(igmp_pkt_build_report_t *br, u32 sw_if_index)
Definition: igmp_pkt.c:399
format_igmp_src_addr_list
u8 * format_igmp_src_addr_list(u8 *s, va_list *args)
Definition: igmp_format.c:186
igmp_config_t_::igmp_group_by_key
uword * igmp_group_by_key
Database of groups joined on the link.
Definition: igmp_config.h:72
format_igmp_key
u8 * format_igmp_key(u8 *s, va_list *args)
Definition: igmp_format.c:203
mfib_table_entry_path_remove
void mfib_table_entry_path_remove(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Remove n paths to an entry (aka route) in the FIB.
Definition: mfib_table.c:407
igmp_sw_if_down
static walk_rc_t igmp_sw_if_down(vnet_main_t *vnm, u32 sw_if_index, void *ctx)
Definition: igmp.c:307
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
igmp_pkt_build_report_t_
Definition: igmp_pkt.h:31
VLIB_INITS
#define VLIB_INITS(...)
Definition: init.h:352
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
unix.h
igmp_group_free_all_srcs
void igmp_group_free_all_srcs(igmp_group_t *group)
Definition: igmp_group.c:22
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
mfib_table_entry_path_update
fib_node_index_t mfib_table_entry_path_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
Definition: mfib_table.c:325
igmp_enable_disable
int igmp_enable_disable(u32 sw_if_index, u8 enable, igmp_mode_t mode)
IGMP interface enable/disable.
Definition: igmp.c:340
igmp_filter_mode_t
enum igmp_filter_mode_t_ igmp_filter_mode_t
MFIB_ITF_FLAG_FORWARD
@ MFIB_ITF_FLAG_FORWARD
Definition: mfib_types.h:153
rv
int __clib_unused rv
Definition: application.c:491
igmp_group_alloc
igmp_group_t * igmp_group_alloc(igmp_config_t *config, const igmp_key_t *gkey, igmp_filter_mode_t mode)
Definition: igmp_group.c:104
vnet_hw_interface_walk_sw
void vnet_hw_interface_walk_sw(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_sw_interface_walk_t fn, void *ctx)
Walk the SW interfaces on a HW interface - this is the super interface and any sub-interfaces.
Definition: interface.c:1123
igmp_format.h
igmp_send_state_change_group_report_v3
static void igmp_send_state_change_group_report_v3(u32 sw_if_index, const igmp_group_t *group)
Definition: igmp.c:97
igmp_main
igmp_main_t igmp_main
Definition: igmp.c:36
igmp_clear_config
void igmp_clear_config(igmp_config_t *config)
igmp clear config
Definition: igmp_config.c:22
igmp_pkt.h
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
mpfx_general_query
const static mfib_prefix_t mpfx_general_query
Definition: igmp.c:40
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
FIB_ROUTE_PATH_LOCAL
@ FIB_ROUTE_PATH_LOCAL
A for-us/local path.
Definition: fib_types.h:344
igmp_main_t_
collection of data related to IGMP
Definition: igmp.h:63
igmp_timer_schedule
igmp_timer_id_t igmp_timer_schedule(f64 when, u32 obj, igmp_timer_function_t fn, void *data)
Schedule a timer to expire in 'when' seconds.
Definition: igmp_timer.c:195
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
igmp_key_t
ip46_address_t igmp_key_t
IGMP Key Used to index groups within an interface config and sources within a list.
Definition: igmp_types.h:49