aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6/scope6.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6/scope6.c')
-rw-r--r--sys/netinet6/scope6.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c
index 0987ea7e99ad..08702a2e81ab 100644
--- a/sys/netinet6/scope6.c
+++ b/sys/netinet6/scope6.c
@@ -505,8 +505,23 @@ in6_set_unicast_scopeid(struct in6_addr *in6, uint32_t scopeid)
struct ifnet*
in6_getlinkifnet(uint32_t zoneid)
{
+ struct ifnet *ifp;
- return (ifnet_byindex((u_short)zoneid));
+ ifp = ifnet_byindex((u_short)zoneid);
+
+ if (ifp == NULL)
+ return (NULL);
+
+ /* An interface might not be IPv6 capable. */
+ if (ifp->if_afdata[AF_INET6] == NULL) {
+ log(LOG_NOTICE,
+ "%s: embedded scope points to an interface without "
+ "IPv6: %s%%%d.\n", __func__,
+ if_name(ifp), zoneid);
+ return (NULL);
+ }
+
+ return (ifp);
}
/*