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

Function igmp_input_v3_query

freebsd/netinet/igmp.c:992–1149  ·  view source on GitHub ↗

* Process a received IGMPv3 general, group-specific or * group-and-source-specific query. * Assumes m has already been pulled up to the full IGMP message length. * Return 0 if successful, otherwise an appropriate error code is returned. */

Source from the content-addressed store, hash-verified

990 * Return 0 if successful, otherwise an appropriate error code is returned.
991 */
992static int
993igmp_input_v3_query(struct ifnet *ifp, const struct ip *ip,
994 /*const*/ struct igmpv3 *igmpv3)
995{
996 struct igmp_ifsoftc *igi;
997 struct in_multi *inm;
998 int is_general_query;
999 uint32_t maxresp, nsrc, qqi;
1000 uint16_t timer;
1001 uint8_t qrv;
1002
1003 is_general_query = 0;
1004
1005 CTR2(KTR_IGMPV3, "process v3 query on ifp %p(%s)", ifp, ifp->if_xname);
1006
1007 maxresp = igmpv3->igmp_code; /* in 1/10ths of a second */
1008 if (maxresp >= 128) {
1009 maxresp = IGMP_MANT(igmpv3->igmp_code) <<
1010 (IGMP_EXP(igmpv3->igmp_code) + 3);
1011 }
1012
1013 /*
1014 * Robustness must never be less than 2 for on-wire IGMPv3.
1015 * FUTURE: Check if ifp has IGIF_LOOPBACK set, as we will make
1016 * an exception for interfaces whose IGMPv3 state changes
1017 * are redirected to loopback (e.g. MANET).
1018 */
1019 qrv = IGMP_QRV(igmpv3->igmp_misc);
1020 if (qrv < 2) {
1021 CTR3(KTR_IGMPV3, "%s: clamping qrv %d to %d", __func__,
1022 qrv, IGMP_RV_INIT);
1023 qrv = IGMP_RV_INIT;
1024 }
1025
1026 qqi = igmpv3->igmp_qqi;
1027 if (qqi >= 128) {
1028 qqi = IGMP_MANT(igmpv3->igmp_qqi) <<
1029 (IGMP_EXP(igmpv3->igmp_qqi) + 3);
1030 }
1031
1032 timer = maxresp * PR_FASTHZ / IGMP_TIMER_SCALE;
1033 if (timer == 0)
1034 timer = 1;
1035
1036 nsrc = ntohs(igmpv3->igmp_numsrc);
1037
1038 /*
1039 * Validate address fields and versions upfront before
1040 * accepting v3 query.
1041 * XXX SMPng: Unlocked access to igmpstat counters here.
1042 */
1043 if (in_nullhost(igmpv3->igmp_group)) {
1044 /*
1045 * IGMPv3 General Query.
1046 *
1047 * General Queries SHOULD be directed to 224.0.0.1.
1048 * A general query with a source list has undefined
1049 * behaviour; discard it.

Callers 1

igmp_inputFunction · 0.85

Calls 4

igmp_set_versionFunction · 0.85
inm_lookupFunction · 0.85
ratecheckFunction · 0.50

Tested by

no test coverage detected