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
This commit is contained in:
Kristof Provost 2015-12-14 19:44:49 +00:00
parent a92fe02768
commit 7e037c12f2
2 changed files with 4 additions and 0 deletions

View file

@ -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));
}

View file

@ -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));
}