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

Function mld_v2_process_group_query

freebsd/netinet6/mld6.c:989–1093  ·  view source on GitHub ↗

* Process a received MLDv2 group-specific or group-and-source-specific * query. * Return <0 if any error occurred. Currently this is ignored. */

Source from the content-addressed store, hash-verified

987 * Return <0 if any error occurred. Currently this is ignored.
988 */
989static int
990mld_v2_process_group_query(struct in6_multi *inm, struct mld_ifsoftc *mli,
991 int timer, struct mbuf *m0, struct mldv2_query *mld, const int off)
992{
993 int retval;
994 uint16_t nsrc;
995
996 IN6_MULTI_LIST_LOCK_ASSERT();
997 MLD_LOCK_ASSERT();
998
999 retval = 0;
1000
1001 switch (inm->in6m_state) {
1002 case MLD_NOT_MEMBER:
1003 case MLD_SILENT_MEMBER:
1004 case MLD_SLEEPING_MEMBER:
1005 case MLD_LAZY_MEMBER:
1006 case MLD_AWAKENING_MEMBER:
1007 case MLD_IDLE_MEMBER:
1008 case MLD_LEAVING_MEMBER:
1009 return (retval);
1010 break;
1011 case MLD_REPORTING_MEMBER:
1012 case MLD_G_QUERY_PENDING_MEMBER:
1013 case MLD_SG_QUERY_PENDING_MEMBER:
1014 break;
1015 }
1016
1017 nsrc = ntohs(mld->mld_numsrc);
1018
1019 /* Length should be checked by calling function. */
1020 KASSERT((m0->m_flags & M_PKTHDR) == 0 ||
1021 m0->m_pkthdr.len >= off + sizeof(struct mldv2_query) +
1022 nsrc * sizeof(struct in6_addr),
1023 ("mldv2 packet is too short: (%d bytes < %zd bytes, m=%p)",
1024 m0->m_pkthdr.len, off + sizeof(struct mldv2_query) +
1025 nsrc * sizeof(struct in6_addr), m0));
1026
1027 /*
1028 * Deal with group-specific queries upfront.
1029 * If any group query is already pending, purge any recorded
1030 * source-list state if it exists, and schedule a query response
1031 * for this group-specific query.
1032 */
1033 if (nsrc == 0) {
1034 if (inm->in6m_state == MLD_G_QUERY_PENDING_MEMBER ||
1035 inm->in6m_state == MLD_SG_QUERY_PENDING_MEMBER) {
1036 in6m_clear_recorded(inm);
1037 timer = min(inm->in6m_timer, timer);
1038 }
1039 inm->in6m_state = MLD_G_QUERY_PENDING_MEMBER;
1040 inm->in6m_timer = MLD_RANDOM_DELAY(timer);
1041 V_current_state_timers_running6 = 1;
1042 return (retval);
1043 }
1044
1045 /*
1046 * Deal with the case where a group-and-source-specific query has

Callers 1

mld_v2_input_queryFunction · 0.85

Calls 4

in6m_clear_recordedFunction · 0.85
minFunction · 0.85
m_copydataFunction · 0.85
in6m_record_sourceFunction · 0.85

Tested by

no test coverage detected