Revert a part of the MRT commit that proved un-needed.
rt_check() in its original form proved to be sufficient and rt_check_fib() can go away (as can its evil twin in_rt_check()). I believe this does NOT address the crashes people have been seeing in rt_check. MFC after: 1 week
This commit is contained in:
parent
eb29d14ccb
commit
93fcb5a28d
@ -158,8 +158,7 @@ atm_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
* check route
|
||||
*/
|
||||
if (rt0 != NULL) {
|
||||
error = rt_check_fib(&rt, &rt0,
|
||||
dst, rt0->rt_fibnum);
|
||||
error = rt_check(&rt, &rt0, dst);
|
||||
if (error)
|
||||
goto bad;
|
||||
RT_UNLOCK(rt);
|
||||
|
@ -103,7 +103,7 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
|
||||
}
|
||||
|
||||
if (rt0 != NULL) {
|
||||
error = rt_check_fib(&rt, &rt0, dst, rt0->rt_fibnum);
|
||||
error = rt_check(&rt, &rt0, dst);
|
||||
if (error)
|
||||
goto bad;
|
||||
RT_UNLOCK(rt);
|
||||
|
@ -259,8 +259,7 @@ iso88025_output(ifp, m, dst, rt0)
|
||||
/* Calculate routing info length based on arp table entry */
|
||||
/* XXX any better way to do this ? */
|
||||
if (rt0 != NULL) {
|
||||
/* XXX MRT *//* Guess only */
|
||||
error = rt_check_fib(&rt, &rt0, dst, rt0->rt_fibnum);
|
||||
error = rt_check(&rt, &rt0, dst);
|
||||
if (error)
|
||||
goto bad;
|
||||
RT_UNLOCK(rt);
|
||||
|
@ -1675,7 +1675,6 @@ rtinit(struct ifaddr *ifa, int cmd, int flags)
|
||||
* final destination if directly reachable);
|
||||
* *lrt0 points to the cached route to the final destination;
|
||||
* *lrt is not meaningful;
|
||||
* fibnum is the index to the correct network fib for this packet
|
||||
*
|
||||
* === Operation ===
|
||||
* If the route is marked down try to find a new route. If the route
|
||||
@ -1691,20 +1690,15 @@ rtinit(struct ifaddr *ifa, int cmd, int flags)
|
||||
*/
|
||||
int
|
||||
rt_check(struct rtentry **lrt, struct rtentry **lrt0, struct sockaddr *dst)
|
||||
{
|
||||
return (rt_check_fib(lrt, lrt0, dst, 0));
|
||||
}
|
||||
|
||||
int
|
||||
rt_check_fib(struct rtentry **lrt, struct rtentry **lrt0, struct sockaddr *dst,
|
||||
u_int fibnum)
|
||||
{
|
||||
struct rtentry *rt;
|
||||
struct rtentry *rt0;
|
||||
u_int fibnum;
|
||||
int error;
|
||||
|
||||
KASSERT(*lrt0 != NULL, ("rt_check"));
|
||||
rt = rt0 = *lrt0;
|
||||
fibnum = (*rt0)->rt_fibnum;
|
||||
|
||||
/* NB: the locking here is tortuous... */
|
||||
RT_LOCK(rt);
|
||||
@ -1730,8 +1724,7 @@ rt_check_fib(struct rtentry **lrt, struct rtentry **lrt0, struct sockaddr *dst,
|
||||
rt0->rt_gwroute = NULL;
|
||||
lookup:
|
||||
RT_UNLOCK(rt0);
|
||||
/* XXX MRT link level looked up in table 0 */
|
||||
rt = rtalloc1_fib(rt->rt_gateway, 1, 0UL, 0);
|
||||
rt = rtalloc1_fib(rt->rt_gateway, 1, 0UL, fibnum);
|
||||
if (rt == rt0) {
|
||||
RT_REMREF(rt0);
|
||||
RT_UNLOCK(rt0);
|
||||
|
@ -357,6 +357,7 @@ int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *);
|
||||
|
||||
int rtexpunge(struct rtentry *);
|
||||
void rtfree(struct rtentry *);
|
||||
int rt_check(struct rtentry **, struct rtentry **, struct sockaddr *);
|
||||
|
||||
/* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */
|
||||
/* Thes are used by old code not yet converted to use multiple FIBS */
|
||||
@ -371,7 +372,6 @@ void rtredirect(struct sockaddr *, struct sockaddr *,
|
||||
int rtrequest(int, struct sockaddr *,
|
||||
struct sockaddr *, struct sockaddr *, int, struct rtentry **);
|
||||
int rtrequest1(int, struct rt_addrinfo *, struct rtentry **);
|
||||
int rt_check(struct rtentry **, struct rtentry **, struct sockaddr *);
|
||||
|
||||
/* defaults to "all" FIBs */
|
||||
int rtinit_fib(struct ifaddr *, int, int);
|
||||
@ -390,7 +390,6 @@ void rtredirect_fib(struct sockaddr *, struct sockaddr *,
|
||||
int rtrequest_fib(int, struct sockaddr *,
|
||||
struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
|
||||
int rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int);
|
||||
int rt_check_fib(struct rtentry **, struct rtentry **, struct sockaddr *, u_int);
|
||||
|
||||
#include <sys/eventhandler.h>
|
||||
typedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *);
|
||||
|
@ -364,7 +364,7 @@ arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m,
|
||||
struct rtentry *rt = NULL;
|
||||
struct sockaddr_dl *sdl;
|
||||
int error;
|
||||
int fibnum = 0;
|
||||
int fibnum = -1;
|
||||
|
||||
if (m) {
|
||||
if (m->m_flags & M_BCAST) {
|
||||
@ -385,7 +385,7 @@ arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m,
|
||||
/* Look for a cached arp (ll) entry. */
|
||||
if (m == NULL)
|
||||
fibnum = rt0->rt_fibnum;
|
||||
error = in_rt_check(&rt, &rt0, dst, fibnum);
|
||||
error = rt_check(&rt, &rt0, dst);
|
||||
if (error) {
|
||||
m_freem(m);
|
||||
return error;
|
||||
@ -394,14 +394,23 @@ arpresolve(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m,
|
||||
if (la == NULL)
|
||||
RT_UNLOCK(rt);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we had no mbuf and no route, then hope the caller
|
||||
* has a fib in mind because we are running out of ideas.
|
||||
* I think this should not happen in current code.
|
||||
* (kmacy would know).
|
||||
*/
|
||||
if (fibnum == -1)
|
||||
fibnum = curthread->td_proc->p_fibnum; /* last gasp */
|
||||
|
||||
if (la == NULL) {
|
||||
/*
|
||||
* We enter this block if rt0 was NULL,
|
||||
* or if rt found by in_rt_check() didn't have llinfo.
|
||||
* We should get a cloned route from the local interface,
|
||||
* so it should have an ll entry.
|
||||
* or if rt found by rt_check() didn't have llinfo.
|
||||
* we should get a cloned route, which since it should
|
||||
* come from the local interface should have a ll entry.
|
||||
* It may be incomplete but that's ok.
|
||||
* XXXMRT if we haven't found a fibnum is that OK?
|
||||
*/
|
||||
rt = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0, fibnum);
|
||||
if (rt == NULL) {
|
||||
|
@ -465,13 +465,6 @@ in_rtalloc1(struct sockaddr *dst, int report, u_long ignflags, u_int fibnum)
|
||||
return (rtalloc1_fib(dst, report, ignflags, fibnum));
|
||||
}
|
||||
|
||||
int
|
||||
in_rt_check(struct rtentry **lrt, struct rtentry **lrt0,
|
||||
struct sockaddr *dst, u_int fibnum)
|
||||
{
|
||||
return (rt_check_fib(lrt, lrt0, dst, fibnum));
|
||||
}
|
||||
|
||||
void
|
||||
in_rtredirect(struct sockaddr *dst,
|
||||
struct sockaddr *gateway,
|
||||
|
@ -314,7 +314,6 @@ void in_rtredirect(struct sockaddr *, struct sockaddr *,
|
||||
struct sockaddr *, int, struct sockaddr *, u_int);
|
||||
int in_rtrequest(int, struct sockaddr *,
|
||||
struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
|
||||
int in_rt_check(struct rtentry **, struct rtentry **, struct sockaddr *, u_int);
|
||||
|
||||
#if 0
|
||||
int in_rt_getifa(struct rt_addrinfo *, u_int fibnum);
|
||||
|
Loading…
x
Reference in New Issue
Block a user