#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
+#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/in_arp.h>
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);
}
* 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