Fix a page fault in ip6_setpktopt(), occurring when the pflog module is

loaded, and syncthing is started, which uses setsockopt(IPV6_PKGINFO).

This is because pflog interfaces do not normally have an IPv6 address,
causing the ND_IFINFO() macro to dereference a NULL pointer.

Reviewed by:	ae
PR:		210943
MFC after:	3 days
This commit is contained in:
dim 2016-07-13 19:41:19 +00:00
parent 5908cb719e
commit 8a8ea0466a

View File

@ -2659,8 +2659,8 @@ ip6_setpktopt(int optname, u_char *buf, int len, struct ip6_pktopts *opt,
if (ifp == NULL)
return (ENXIO);
}
if (ifp != NULL && (
ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED))
if (ifp != NULL && (ifp->if_afdata[AF_INET6] == NULL ||
(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) != 0))
return (ENETDOWN);
if (ifp != NULL &&