X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/ca66cea69e6e866fd781ae2260d9474bdd48f2ca..935ed37a5c468c8a1c07408573c08b8b7ef80e8b:/bsd/netinet6/in6_gif.c diff --git a/bsd/netinet6/in6_gif.c b/bsd/netinet6/in6_gif.c index 090d0ad31..029dd8810 100644 --- a/bsd/netinet6/in6_gif.c +++ b/bsd/netinet6/in6_gif.c @@ -67,6 +67,8 @@ #include +extern u_long route_generation; + static __inline__ void* _cast_non_const(const void * ptr) { union { @@ -172,7 +174,10 @@ in6_gif_output( ip6->ip6_flow |= htonl((u_int32_t)otos << 20); if (dst->sin6_family != sin6_dst->sin6_family || - !IN6_ARE_ADDR_EQUAL(&dst->sin6_addr, &sin6_dst->sin6_addr)) { + !IN6_ARE_ADDR_EQUAL(&dst->sin6_addr, &sin6_dst->sin6_addr) || + (sc->gif_ro6.ro_rt != NULL && + (sc->gif_ro6.ro_rt->generation_id != route_generation || + sc->gif_ro6.ro_rt->rt_ifp == ifp))) { /* cache route doesn't match */ bzero(dst, sizeof(*dst)); dst->sin6_family = sin6_dst->sin6_family; @@ -195,7 +200,7 @@ in6_gif_output( } /* if it constitutes infinite encapsulation, punt. */ - if (sc->gif_ro.ro_rt->rt_ifp == ifp) { + if (sc->gif_ro6.ro_rt->rt_ifp == ifp) { m_freem(m); return ENETUNREACH; /*XXX*/ }