From ad72fb6dccf97723b0a689dc64909424bcf3dd34 Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 16 Jul 2016 10:50:28 +0000 Subject: MFC r302784: 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. Approved by: re (kib) Reviewed by: ae PR: 210943 --- sys/netinet6/ip6_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/netinet6/ip6_output.c') diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index c03bf5e..a768f74 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -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 && -- cgit v1.1