in6_clsroute() was applied to prefix routes causing some

of them to expire. in6_clsroute() was only applied to
cloned routes that are no longer applicable after the
arp-v2 commit.
This commit is contained in:
Qing Li 2008-12-17 10:03:49 +00:00
parent 818951afd8
commit bbd8aebaba
5 changed files with 35 additions and 39 deletions

View File

@ -987,6 +987,13 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
}
}
if (!rt) {
printf("in6_update_ifa #1: addr= %s, mask= %s, ia= %s, ifp = %s\n",
ip6_sprintf(ip6buf, &mltaddr.sin6_addr),
ip6_sprintf(ip6buf, &mltmask.sin6_addr),
ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
if_name(ifp));
error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr,
(struct sockaddr *)&ia->ia_addr,
(struct sockaddr *)&mltmask, RTF_UP,
@ -1061,6 +1068,12 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
}
}
if (!rt) {
printf("in6_update_ifa #2: addr= %s, mask= %s, ia= %s, ifp = %s\n",
ip6_sprintf(ip6buf, &mltaddr.sin6_addr),
ip6_sprintf(ip6buf, &mltmask.sin6_addr),
ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
if_name(ifp));
error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr,
(struct sockaddr *)&ia->ia_addr,
(struct sockaddr *)&mltmask, RTF_UP,

View File

@ -220,33 +220,6 @@ SYSCTL_V_INT(V_NET, vnet_inet6, _net_inet6_ip6, IPV6CTL_RTMAXCACHE,
rtmaxcache, CTLFLAG_RW, rtq_toomany6 , 0, "");
/*
* On last reference drop, mark the route as belong to us so that it can be
* timed out.
*/
static void
in6_clsroute(struct radix_node *rn, struct radix_node_head *head)
{
INIT_VNET_INET6(curvnet);
struct rtentry *rt = (struct rtentry *)rn;
RT_LOCK_ASSERT(rt);
if (!(rt->rt_flags & RTF_UP))
return; /* prophylactic measures */
/*
* As requested by David Greenman:
* If rtq_reallyold6 is 0, just delete the route without
* waiting for a timeout cycle to kill it.
*/
if (V_rtq_reallyold6 != 0) {
rt->rt_flags |= RTPRF_OURS;
rt->rt_rmx.rmx_expire = time_uptime + V_rtq_reallyold6;
} else {
rtexpunge(rt);
}
}
struct rtqk_arg {
struct radix_node_head *rnh;
@ -469,7 +442,6 @@ in6_inithead(void **head, int off)
rnh = *head;
rnh->rnh_addaddr = in6_addroute;
rnh->rnh_matchaddr = in6_matroute;
rnh->rnh_close = in6_clsroute;
callout_init(&V_rtq_timer6, CALLOUT_MPSAFE);
in6_rtqtimo(rnh); /* kick off timeout first time */
callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE);

View File

@ -1713,7 +1713,6 @@ nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
{
INIT_VNET_INET6(curvnet);
struct mbuf *m = m0;
struct rtentry *rt = rt0;
struct llentry *ln = lle;
int error = 0;
int flags = 0;
@ -1746,9 +1745,9 @@ nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
flags = ((m != NULL) || (lle != NULL)) ? LLE_EXCLUSIVE : 0;
if (ln == NULL) {
retry:
IF_AFDATA_LOCK(rt->rt_ifp);
IF_AFDATA_LOCK(ifp);
ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst);
IF_AFDATA_UNLOCK(rt->rt_ifp);
IF_AFDATA_UNLOCK(ifp);
if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp)) {
/*
* Since nd6_is_addr_neighbor() internally calls nd6_lookup(),
@ -1756,9 +1755,9 @@ nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
* it is tolerable, because this should be a rare case.
*/
flags = ND6_CREATE | (m ? ND6_EXCLUSIVE : 0);
IF_AFDATA_LOCK(rt->rt_ifp);
IF_AFDATA_LOCK(ifp);
ln = nd6_lookup(&dst->sin6_addr, flags, ifp);
IF_AFDATA_UNLOCK(rt->rt_ifp);
IF_AFDATA_UNLOCK(ifp);
}
}
if (ln == NULL) {
@ -1767,8 +1766,8 @@ nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
char ip6buf[INET6_ADDRSTRLEN];
log(LOG_DEBUG,
"nd6_output: can't allocate llinfo for %s "
"(ln=%p, rt=%p)\n",
ip6_sprintf(ip6buf, &dst->sin6_addr), ln, rt);
"(ln=%p)\n",
ip6_sprintf(ip6buf, &dst->sin6_addr), ln);
senderr(EIO); /* XXX: good error? */
}
goto sendpkt; /* send anyway */
@ -1915,9 +1914,9 @@ nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
}
if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
return ((*ifp->if_output)(origifp, m, (struct sockaddr *)dst,
rt));
NULL));
}
error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, rt);
error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, NULL);
return (error);
bad:
@ -2008,7 +2007,7 @@ nd6_need_cache(struct ifnet *ifp)
* the lle lock, drop here for now
*/
int
nd6_storelladdr(struct ifnet *ifp, struct rtentry *rt0, struct mbuf *m,
nd6_storelladdr(struct ifnet *ifp, struct mbuf *m,
struct sockaddr *dst, u_char *desten, struct llentry **lle)
{
struct llentry *ln;

View File

@ -397,7 +397,7 @@ int nd6_output_lle __P((struct ifnet *, struct ifnet *, struct mbuf *,
int nd6_output_flush __P((struct ifnet *, struct ifnet *, struct mbuf *,
struct sockaddr_in6 *, struct rtentry *));
int nd6_need_cache __P((struct ifnet *));
int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *,
int nd6_storelladdr __P((struct ifnet *, struct mbuf *,
struct sockaddr *, u_char *, struct llentry **));
/* nd6_nbr.c */

View File

@ -1554,6 +1554,12 @@ nd6_prefix_onlink(struct nd_prefix *pr)
char ip6buf[INET6_ADDRSTRLEN];
struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK};
log(LOG_DEBUG, "##1 nd6_prefix_onlink: %s, vltime = %x, pltime = %x\n",
ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_vltime, pr->ndpr_pltime);
/* sanity check */
if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) {
nd6log((LOG_ERR,
@ -1622,6 +1628,12 @@ nd6_prefix_onlink(struct nd_prefix *pr)
rtflags = ifa->ifa_flags | RTF_UP;
error = rtrequest(RTM_ADD, (struct sockaddr *)&pr->ndpr_prefix,
ifa->ifa_addr, (struct sockaddr *)&mask6, rtflags, &rt);
log(LOG_DEBUG, "##2 nd6_prefix_onlink: %s, vltime = %x, pltime = %x\n",
ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_vltime, pr->ndpr_pltime);
if (error == 0) {
if (rt != NULL) /* this should be non NULL, though */ {
rnh = V_rt_tables[rt->rt_fibnum][AF_INET6];