git: 1c0d2f0b1a98 - main - ip_mroute: Don't assume that a multicast router is running

Mark Johnston <[email protected]> Mon, 03 Aug 2026 21:07:38 +0000
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a71031a.38726.67a84861__38170.8988033765$1785791276$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=1c0d2f0b1a98526e4f1f5a051ce6904b4c3164e1

commit 1c0d2f0b1a98526e4f1f5a051ce6904b4c3164e1
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-08-03 20:44:14 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-08-03 20:50:14 +0000

    ip_mroute: Don't assume that a multicast router is running
    
    The SIOCGETSGCNT handler may be invoked in this scenario, and if no
    router has initialized the lookup table, we'll have
    mfct->mfchashtbl == NULL.
    
    PR:             297148
    Reported by:    Robert Morris
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/netinet/ip_mroute.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 14bd458b74f3..d18a9865f9bc 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -383,6 +383,8 @@ mfc_find(const struct mfctable *mfct, const struct in_addr *o,
 
 	MRW_LOCK_ASSERT();
 
+	if (mfct->mfchashtbl == NULL)
+		return (NULL);
 	LIST_FOREACH(rt, &mfct->mfchashtbl[MFCHASH(*o, *g)], mfc_hash) {
 		if (in_hosteq(rt->mfc_origin, *o) &&
 		    in_hosteq(rt->mfc_mcastgrp, *g) &&