net/bridge/br_multicast_eht.c

Source file repositories/reference/linux-study-clean/net/bridge/br_multicast_eht.c

File Facts

System
Linux kernel
Corpus path
net/bridge/br_multicast_eht.c
Extension
.c
Size
22518 bytes
Lines
823
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: implementation source
Status
source implementation candidate

Why This File Exists

Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.

Dependency Surface

Detected Declarations

Annotated Snippet

hlist_for_each_entry_safe(src_ent, tmp, &pg->src_list, node) {
			br_multicast_ip_src_to_eht_addr(&src_ent->addr,
							&eht_src_addr);
			if (!br_multicast_eht_set_lookup(pg, &eht_src_addr)) {
				br_multicast_del_group_src(src_ent, true);
				changed = true;
				continue;
			}
			/* this is an optimization for TO_INCLUDE where we lower
			 * the set's timeout to LMQT to catch timeout hosts:
			 * - host A (timing out): set entries X, Y
			 * - host B: set entry Z (new from current TO_INCLUDE)
			 *           sends BLOCK Z after LMQT but host A's EHT
			 *           entries still exist (unless lowered to LMQT
			 *           so they can timeout with the S,Gs)
			 * => we wait another LMQT, when we can just delete the
			 *    group immediately
			 */
			if (!(src_ent->flags & BR_SGRP_F_SEND) ||
			    filter_mode != MCAST_INCLUDE ||
			    !to_report)
				continue;
			eht_set = br_multicast_eht_set_lookup(pg,
							      &eht_src_addr);
			if (!eht_set)
				continue;
			mod_timer(&eht_set->timer, jiffies + br_multicast_lmqt(brmctx));
		}
	}

	return changed;
}

static bool br_multicast_eht_inc(const struct net_bridge_mcast *brmctx,
				 struct net_bridge_port_group *pg,
				 union net_bridge_eht_addr *h_addr,
				 void *srcs,
				 u32 nsrcs,
				 size_t addr_size,
				 bool to_report)
{
	bool changed;

	changed = __eht_inc_exc(brmctx, pg, h_addr, srcs, nsrcs, addr_size,
				MCAST_INCLUDE, to_report);
	br_eht_convert_host_filter_mode(brmctx, pg, h_addr, MCAST_INCLUDE);

	return changed;
}

static bool br_multicast_eht_exc(const struct net_bridge_mcast *brmctx,
				 struct net_bridge_port_group *pg,
				 union net_bridge_eht_addr *h_addr,
				 void *srcs,
				 u32 nsrcs,
				 size_t addr_size,
				 bool to_report)
{
	bool changed;

	changed = __eht_inc_exc(brmctx, pg, h_addr, srcs, nsrcs, addr_size,
				MCAST_EXCLUDE, to_report);
	br_eht_convert_host_filter_mode(brmctx, pg, h_addr, MCAST_EXCLUDE);

	return changed;
}

static bool __eht_ip4_handle(const struct net_bridge_mcast *brmctx,
			     struct net_bridge_port_group *pg,
			     union net_bridge_eht_addr *h_addr,
			     void *srcs,
			     u32 nsrcs,
			     int grec_type)
{
	bool changed = false, to_report = false;

	switch (grec_type) {
	case IGMPV3_ALLOW_NEW_SOURCES:
		br_multicast_eht_allow(brmctx, pg, h_addr, srcs, nsrcs,
				       sizeof(__be32));
		break;
	case IGMPV3_BLOCK_OLD_SOURCES:
		changed = br_multicast_eht_block(brmctx, pg, h_addr, srcs, nsrcs,
						 sizeof(__be32));
		break;
	case IGMPV3_CHANGE_TO_INCLUDE:
		to_report = true;
		fallthrough;
	case IGMPV3_MODE_IS_INCLUDE:
		changed = br_multicast_eht_inc(brmctx, pg, h_addr, srcs, nsrcs,

Annotation

Implementation Notes