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

Function mld_handle_state_change

freebsd/netinet6/mld6.c:2125–2179  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2123 * Issue an intermediate state change during the life-cycle.
2124 */
2125static int
2126mld_handle_state_change(struct in6_multi *inm, struct mld_ifsoftc *mli)
2127{
2128 struct ifnet *ifp;
2129 int retval;
2130#ifdef KTR
2131 char ip6tbuf[INET6_ADDRSTRLEN];
2132#endif
2133
2134 CTR4(KTR_MLD, "%s: state change for %s on ifp %p(%s)",
2135 __func__, ip6_sprintf(ip6tbuf, &inm->in6m_addr),
2136 inm->in6m_ifp, if_name(inm->in6m_ifp));
2137
2138 ifp = inm->in6m_ifp;
2139
2140 IN6_MULTI_LIST_LOCK_ASSERT();
2141 MLD_LOCK_ASSERT();
2142
2143 KASSERT(mli && mli->mli_ifp == ifp,
2144 ("%s: inconsistent ifp", __func__));
2145
2146 if ((ifp->if_flags & IFF_LOOPBACK) ||
2147 (mli->mli_flags & MLIF_SILENT) ||
2148 !mld_is_addr_reported(&inm->in6m_addr) ||
2149 (mli->mli_version != MLD_VERSION_2)) {
2150 if (!mld_is_addr_reported(&inm->in6m_addr)) {
2151 CTR1(KTR_MLD,
2152"%s: not kicking state machine for silent group", __func__);
2153 }
2154 CTR1(KTR_MLD, "%s: nothing to do", __func__);
2155 in6m_commit(inm);
2156 CTR3(KTR_MLD, "%s: T1 -> T0 for %s/%s", __func__,
2157 ip6_sprintf(ip6tbuf, &inm->in6m_addr),
2158 if_name(inm->in6m_ifp));
2159 return (0);
2160 }
2161
2162 mbufq_drain(&inm->in6m_scq);
2163
2164 retval = mld_v2_enqueue_group_record(&inm->in6m_scq, inm, 1, 0, 0,
2165 (mli->mli_flags & MLIF_USEALLOW));
2166 CTR2(KTR_MLD, "%s: enqueue record = %d", __func__, retval);
2167 if (retval <= 0)
2168 return (-retval);
2169
2170 /*
2171 * If record(s) were enqueued, start the state-change
2172 * report timer for this group.
2173 */
2174 inm->in6m_scrv = mli->mli_rv;
2175 inm->in6m_sctimer = 1;
2176 V_state_change_timers_running6 = 1;
2177
2178 return (0);
2179}
2180
2181/*
2182 * Perform the final leave for a multicast address.

Callers 1

mld_change_stateFunction · 0.85

Calls 5

ip6_sprintfFunction · 0.85
mld_is_addr_reportedFunction · 0.85
in6m_commitFunction · 0.85
mbufq_drainFunction · 0.50

Tested by

no test coverage detected