20 #include <vpp/app/version.h> 59 #define _(sym,string) string, 122 u32 n_left_from, *from, *to_next;
130 error = IGMP_ERROR_NONE;
136 while (n_left_from > 0)
142 while (n_left_from > 0 && n_left_to_next > 0)
161 error = IGMP_ERROR_INVALID_PROTOCOL;
173 clib_net_to_host_u16 (ip->
length) -
177 if (checksum != csum)
179 error = IGMP_ERROR_BAD_CHECKSUM;
187 case IGMP_TYPE_membership_query:
190 case IGMP_TYPE_membership_report_v3:
194 error = IGMP_ERROR_UNKNOWN_TYPE;
212 n_left_to_next, bi, next);
224 .name =
"igmp-input",
225 .vector_size =
sizeof (
u32),
248 u32 n_left_from, *from, *to_next;
257 while (n_left_from > 0)
263 while (n_left_from > 0 && n_left_to_next > 0)
266 u32 sw_if_index, bi, next;
288 IGMP_DBG (
"No config on interface %u", sw_if_index);
319 n_left_to_next, bi, next);
331 .name =
"igmp-parse-query",
332 .vector_size =
sizeof (
u32),
354 u32 n_left_from, *from, *to_next;
365 ip46_address_t saddr;
366 memset (&saddr, 0,
sizeof (ip46_address_t));
367 ip46_address_t gaddr;
368 memset (&gaddr, 0,
sizeof (ip46_address_t));
378 while (n_left_from > 0)
384 while (n_left_from > 0 && n_left_to_next > 0)
387 u32 sw_if_index, bi, next;
399 error = IGMP_ERROR_NONE;
415 IGMP_DBG (
"Interface %u has (S,G)s configured by CLI/API",
417 error = IGMP_ERROR_CLI_API_CONFIG;
422 IGMP_DBG (
"interface %u", sw_if_index);
424 for (i = 0; i < clib_net_to_host_u16 (igmp->
n_groups); i++)
428 if (igmp_group->
type ==
429 IGMP_MEMBERSHIP_GROUP_mode_is_filter_include)
435 IGMP_MEMBERSHIP_GROUP_mode_is_filter_include;
447 skey.
data, src_addr);
456 else if (igmp_group->
type ==
457 IGMP_MEMBERSHIP_GROUP_mode_is_filter_exclude)
467 else if (igmp_group->
type ==
468 IGMP_MEMBERSHIP_GROUP_change_to_filter_include)
475 saddr.ip4 = *src_addr;
481 else if (igmp_group->
type ==
482 IGMP_MEMBERSHIP_GROUP_change_to_filter_exclude)
489 saddr.ip4 = *src_addr;
495 else if (igmp_group->
type ==
496 IGMP_MEMBERSHIP_GROUP_allow_new_sources)
506 else if (igmp_group->
type ==
507 IGMP_MEMBERSHIP_GROUP_block_old_sources)
514 saddr.ip4 = *src_addr;
540 n_left_to_next, bi, next);
552 .name =
"igmp-parse-report",
553 .vector_size =
sizeof (
u32),
igmp_membership_group_v3_type_t type
#define IGMP_CONFIG_FLAG_CAN_SEND_REPORT
vlib_node_registration_t igmp_timer_process_node
(constructor) VLIB_REGISTER_NODE (igmp_timer_process_node)
static int ip4_header_bytes(ip4_header_t *i)
static f64 vlib_time_now(vlib_main_t *vm)
static igmp_group_t * igmp_group_lookup(igmp_config_t *config, igmp_key_t *key)
igmp group lookup
vlib_error_t * errors
Vector of errors for this node.
#define foreach_igmp_error
void igmp_send_report(vlib_main_t *vm, vlib_node_runtime_t *rt, igmp_main_t *im, igmp_timer_t *timer)
igmp send report (igmp_timer_function_t)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define IGMP_CONFIG_FLAG_QUERY_RESP_RECVED
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_REGISTER_NODE(x,...)
static igmp_src_t * igmp_src_lookup(igmp_group_t *group, igmp_key_t *key)
igmp group lookup
static ip_csum_t ip_incremental_checksum(ip_csum_t sum, void *_data, uword n_bytes)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
#define clib_memcpy(a, b, c)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
ip4_address_t dst_address
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define ip46_address_set_ip4(ip46, ip)
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
int igmp_listen(vlib_main_t *vm, u8 enable, u32 sw_if_index, ip46_address_t saddr, ip46_address_t gaddr, u8 cli_api_configured)
igmp listen
static igmp_config_t * igmp_config_lookup(igmp_main_t *im, u32 sw_if_index)
igmp config lookup
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
ip4_address_t src_addresses[0]
u16 flags
Copy of main node flags.
#define group_ptr(p, l)
helper macro to get igmp mebership group from pointer plus offset
#define VLIB_NODE_FLAG_TRACE
void igmp_create_int_timer(f64 time, u32 sw_if_index, igmp_timer_function_t *func)
igmp create int timer
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip_csum_fold(ip_csum_t c)