MCPcopy Create free account
hub / github.com/F-Stack/f-stack / igmp_handle_state_change

Function igmp_handle_state_change

freebsd/netinet/igmp.c:2509–2556  ·  view source on GitHub ↗

* Issue an intermediate state change during the IGMP life-cycle. */

Source from the content-addressed store, hash-verified

2507 * Issue an intermediate state change during the IGMP life-cycle.
2508 */
2509static int
2510igmp_handle_state_change(struct in_multi *inm, struct igmp_ifsoftc *igi)
2511{
2512 struct ifnet *ifp;
2513 int retval;
2514
2515 CTR4(KTR_IGMPV3, "%s: state change for 0x%08x on ifp %p(%s)", __func__,
2516 ntohl(inm->inm_addr.s_addr), inm->inm_ifp, inm->inm_ifp->if_xname);
2517
2518 ifp = inm->inm_ifp;
2519
2520 IN_MULTI_LIST_LOCK_ASSERT();
2521 IGMP_LOCK_ASSERT();
2522
2523 KASSERT(igi && igi->igi_ifp == ifp, ("%s: inconsistent ifp", __func__));
2524
2525 if ((ifp->if_flags & IFF_LOOPBACK) ||
2526 (igi->igi_flags & IGIF_SILENT) ||
2527 !igmp_isgroupreported(inm->inm_addr) ||
2528 (igi->igi_version != IGMP_VERSION_3)) {
2529 if (!igmp_isgroupreported(inm->inm_addr)) {
2530 CTR1(KTR_IGMPV3,
2531"%s: not kicking state machine for silent group", __func__);
2532 }
2533 CTR1(KTR_IGMPV3, "%s: nothing to do", __func__);
2534 inm_commit(inm);
2535 CTR3(KTR_IGMPV3, "%s: T1 -> T0 for 0x%08x/%s", __func__,
2536 ntohl(inm->inm_addr.s_addr), inm->inm_ifp->if_xname);
2537 return (0);
2538 }
2539
2540 mbufq_drain(&inm->inm_scq);
2541
2542 retval = igmp_v3_enqueue_group_record(&inm->inm_scq, inm, 1, 0, 0);
2543 CTR2(KTR_IGMPV3, "%s: enqueue record = %d", __func__, retval);
2544 if (retval <= 0)
2545 return (-retval);
2546
2547 /*
2548 * If record(s) were enqueued, start the state-change
2549 * report timer for this group.
2550 */
2551 inm->inm_scrv = ((igi->igi_flags & IGIF_LOOPBACK) ? 1 : igi->igi_rv);
2552 inm->inm_sctimer = 1;
2553 V_state_change_timers_running = 1;
2554
2555 return (0);
2556}
2557
2558/*
2559 * Perform the final leave for an IGMP group.

Callers 1

igmp_change_stateFunction · 0.85

Calls 4

igmp_isgroupreportedFunction · 0.85
inm_commitFunction · 0.85
mbufq_drainFunction · 0.50

Tested by

no test coverage detected