X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d26ffc64f583ab2d29df48f13518685602bc8832..d9a64523371fa019c4575bb400cbbc3a50ac9903:/bsd/net/route.c diff --git a/bsd/net/route.c b/bsd/net/route.c index 1eda0fa30..986c2f6a2 100644 --- a/bsd/net/route.c +++ b/bsd/net/route.c @@ -92,6 +92,7 @@ #include #include #include +#include #include #include @@ -1687,6 +1688,16 @@ ifa_ifwithroute_common_locked(int flags, const struct sockaddr *dst, ifa = NULL; } + /* + * ifa's address family must match destination's address family + * after all is said and done. + */ + if (ifa != NULL && + ifa->ifa_addr->sa_family != dst->sa_family) { + IFA_REMREF(ifa); + ifa = NULL; + } + return (ifa); } @@ -3464,8 +3475,15 @@ rtinit_locked(struct ifaddr *ifa, int cmd, int flags) * If rmx_mtu is not locked, update it * to the MTU used by the new interface. */ - if (!(rt->rt_rmx.rmx_locks & RTV_MTU)) + if (!(rt->rt_rmx.rmx_locks & RTV_MTU)) { rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; + if (dst->sa_family == AF_INET && + INTF_ADJUST_MTU_FOR_CLAT46(rt->rt_ifp)) { + rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp); + /* Further adjust the size for CLAT46 expansion */ + rt->rt_rmx.rmx_mtu -= CLAT46_HDR_EXPANSION_OVERHD; + } + } /* * Now ask the protocol to check if it needs