1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Fix panic in IPv6 multicast code.

Add check that ifp supports IPv6 multicasts in in6_getmulti.
This fixes panic when user application tries to join into multicast
group on an interface that doesn't support IPv6 multicasts, like
IFT_PFLOG interfaces.

PR:             257302
Reviewed by:	melifaro
Differential Revision: https://reviews.freebsd.org/D31420

(cherry picked from commit d477a7feed)
This commit is contained in:
Andrey V. Elsukov 2021-08-05 11:51:46 +03:00
parent 7eb023696a
commit 40ec2323e6

View File

@ -374,9 +374,18 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr *group,
IN6_MULTI_LIST_LOCK();
IF_ADDR_WLOCK(ifp);
NET_EPOCH_ENTER(et);
inm = in6m_lookup_locked(ifp, group);
/*
* Does ifp support IPv6 multicasts?
*/
if (ifp->if_afdata[AF_INET6] == NULL)
error = ENODEV;
else
inm = in6m_lookup_locked(ifp, group);
NET_EPOCH_EXIT(et);
if (error != 0)
goto out_locked;
if (inm != NULL) {
/*
* If we already joined this group, just bump the