summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorkp <kp@FreeBSD.org>2015-12-14 19:44:49 +0000
committerkp <kp@FreeBSD.org>2015-12-14 19:44:49 +0000
commit30ed5ce1ff6645dcdcc03a75644cb64a37e521f3 (patch)
tree13bc9dd01c70b2c298ecddcf47228eae20e89ca6 /sys/netinet6
parent237e91b5a1bbaac1ccd6b091e8b2ae3cc09f128e (diff)
downloadFreeBSD-src-30ed5ce1ff6645dcdcc03a75644cb64a37e521f3.zip
FreeBSD-src-30ed5ce1ff6645dcdcc03a75644cb64a37e521f3.tar.gz
inet6: Do not assume every interface has ip6 enabled.
Certain interfaces (e.g. pfsync0) do not have ip6 addresses (in other words, ifp->if_afdata[AF_INET6] is NULL). Ensure we don't panic when the MTU is updated. pfsync interfaces will never have ip6 support, because it's explicitly disabled in in6_domifattach(). PR: 205194 Reviewed by: melifaro, hrs Differential Revision: https://reviews.freebsd.org/D4522
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6.c2
-rw-r--r--sys/netinet6/nd6.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 5c1563c..2b022ba 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2432,6 +2432,8 @@ in6_domifattach(struct ifnet *ifp)
int
in6_domifmtu(struct ifnet *ifp)
{
+ if (ifp->if_afdata[AF_INET6] == NULL)
+ return ifp->if_mtu;
return (IN6_LINKMTU(ifp));
}
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index a79922b..5e9a067 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -285,6 +285,8 @@ nd6_ifdetach(struct nd_ifinfo *nd)
void
nd6_setmtu(struct ifnet *ifp)
{
+ if (ifp->if_afdata[AF_INET6] == NULL)
+ return;
nd6_setmtu0(ifp, ND_IFINFO(ifp));
}
OpenPOWER on IntegriCloud