Replicate r328271 from legacy IP to IPv6 using a single macro

to clear L2 and L3 route caches.
Also mark one function argument as __unused.

Reviewed by:	karels, ae
Approved by:	re (rgrimes)
Differential Revision:	https://reviews.freebsd.org/D17007
This commit is contained in:
bz 2018-09-03 22:27:27 +00:00
parent 78d4f16823
commit 209555fd34
2 changed files with 6 additions and 17 deletions

View File

@ -846,13 +846,10 @@ in6_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp)
* (by a redirect), time to try a default gateway again. * (by a redirect), time to try a default gateway again.
*/ */
void void
in6_losing(struct inpcb *in6p) in6_losing(struct inpcb *inp)
{ {
RO_RTFREE(&in6p->inp_route6); RO_INVALIDATE_CACHE(&inp->inp_route6);
if (in6p->inp_route6.ro_lle)
LLE_FREE(in6p->inp_route6.ro_lle); /* zeros ro_lle */
return;
} }
/* /*
@ -860,12 +857,10 @@ in6_losing(struct inpcb *in6p)
* and allocate a (hopefully) better one. * and allocate a (hopefully) better one.
*/ */
struct inpcb * struct inpcb *
in6_rtchange(struct inpcb *inp, int errno) in6_rtchange(struct inpcb *inp, int errno __unused)
{ {
RO_RTFREE(&in6p->inp_route6); RO_INVALIDATE_CACHE(&inp->inp_route6);
if (inp->inp_route6.ro_lle)
LLE_FREE(inp->inp_route6.ro_lle); /* zeros ro_lle */
return inp; return inp;
} }

View File

@ -804,22 +804,16 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
error = netisr_queue(NETISR_IPV6, m); error = netisr_queue(NETISR_IPV6, m);
goto done; goto done;
} else { } else {
RO_RTFREE(ro); RO_INVALIDATE_CACHE(ro);
needfiblookup = 1; /* Redo the routing table lookup. */ needfiblookup = 1; /* Redo the routing table lookup. */
if (ro->ro_lle)
LLE_FREE(ro->ro_lle); /* zeros ro_lle */
ro->ro_lle = NULL;
} }
} }
/* See if fib was changed by packet filter. */ /* See if fib was changed by packet filter. */
if (fibnum != M_GETFIB(m)) { if (fibnum != M_GETFIB(m)) {
m->m_flags |= M_SKIP_FIREWALL; m->m_flags |= M_SKIP_FIREWALL;
fibnum = M_GETFIB(m); fibnum = M_GETFIB(m);
RO_RTFREE(ro); RO_INVALIDATE_CACHE(ro);
needfiblookup = 1; needfiblookup = 1;
if (ro->ro_lle)
LLE_FREE(ro->ro_lle); /* zeros ro_lle */
ro->ro_lle = NULL;
} }
if (needfiblookup) if (needfiblookup)
goto again; goto again;