diff options
-rw-r--r-- | sys/net/route.h | 3 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 11 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 2 | ||||
-rw-r--r-- | usr.sbin/ndp/ndp.c | 78 |
4 files changed, 49 insertions, 45 deletions
diff --git a/sys/net/route.h b/sys/net/route.h index c1d0997..66f4d77 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -83,6 +83,9 @@ struct rt_metrics { #define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ #define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) +/* lle state is exported in rmx_state rt_metrics field */ +#define rmx_state rmx_weight + #define RT_DEFAULT_FIB 0 /* Explicitly mark fib=0 restricted cases */ #define RT_ALL_FIBS -1 /* Announce event for every fib */ #ifdef _KERNEL diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index e815a96..c2f4397 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2359,13 +2359,20 @@ in6_lltable_dump_entry(struct lltable *llt, struct llentry *lle, sdl->sdl_index = ifp->if_index; sdl->sdl_type = ifp->if_type; bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen); - ndpc.rtm.rtm_rmx.rmx_expire = lle->la_expire + - lle->lle_remtime / hz; + if (lle->la_expire != 0) + ndpc.rtm.rtm_rmx.rmx_expire = lle->la_expire + + lle->lle_remtime / hz + + time_second - time_uptime; ndpc.rtm.rtm_flags |= (RTF_HOST | RTF_LLDATA); if (lle->la_flags & LLE_STATIC) ndpc.rtm.rtm_flags |= RTF_STATIC; if (lle->la_flags & LLE_IFADDR) ndpc.rtm.rtm_flags |= RTF_PINNED; + if (lle->ln_router != 0) + ndpc.rtm.rtm_flags |= RTF_GATEWAY; + ndpc.rtm.rtm_rmx.rmx_pksent = lle->la_asked; + /* Store state in rmx_weight value */ + ndpc.rtm.rtm_rmx.rmx_state = lle->ln_state; ndpc.rtm.rtm_index = ifp->if_index; error = SYSCTL_OUT(wr, &ndpc, sizeof(ndpc)); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index d0bcc9d..3c048bc 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1748,7 +1748,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) if (ln->la_expire == 0) nbi->expire = 0; else - nbi->expire = ln->la_expire + + nbi->expire = ln->la_expire + ln->lle_remtime / hz + (time_second - time_uptime); LLE_RUNLOCK(ln); break; diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 85cb67c..8c498ec 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -563,8 +563,8 @@ dump(struct sockaddr_in6 *addr, int cflag) struct sockaddr_in6 *sin; struct sockaddr_dl *sdl; extern int h_errno; - struct in6_nbrinfo *nbi; struct timeval now; + u_long expire; int addrwidth; int llwidth; int ifwidth; @@ -676,52 +676,46 @@ again:; llwidth, llwidth, ether_str(sdl), ifwidth, ifwidth, ifname); /* Print neighbor discovery specific information */ - nbi = getnbrinfo(&sin->sin6_addr, sdl->sdl_index, 1); - if (nbi) { - if (nbi->expire > now.tv_sec) { - printf(" %-9.9s", - sec2str(nbi->expire - now.tv_sec)); - } else if (nbi->expire == 0) - printf(" %-9.9s", "permanent"); - else - printf(" %-9.9s", "expired"); + expire = rtm->rtm_rmx.rmx_expire; + if (expire > now.tv_sec) + printf(" %-9.9s", sec2str(expire - now.tv_sec)); + else if (expire == 0) + printf(" %-9.9s", "permanent"); + else + printf(" %-9.9s", "expired"); - switch (nbi->state) { - case ND6_LLINFO_NOSTATE: - printf(" N"); - break; + switch (rtm->rtm_rmx.rmx_state) { + case ND6_LLINFO_NOSTATE: + printf(" N"); + break; #ifdef ND6_LLINFO_WAITDELETE - case ND6_LLINFO_WAITDELETE: - printf(" W"); - break; + case ND6_LLINFO_WAITDELETE: + printf(" W"); + break; #endif - case ND6_LLINFO_INCOMPLETE: - printf(" I"); - break; - case ND6_LLINFO_REACHABLE: - printf(" R"); - break; - case ND6_LLINFO_STALE: - printf(" S"); - break; - case ND6_LLINFO_DELAY: - printf(" D"); - break; - case ND6_LLINFO_PROBE: - printf(" P"); - break; - default: - printf(" ?"); - break; - } - - isrouter = nbi->isrouter; - prbs = nbi->asked; - } else { - warnx("failed to get neighbor information"); - printf(" "); + case ND6_LLINFO_INCOMPLETE: + printf(" I"); + break; + case ND6_LLINFO_REACHABLE: + printf(" R"); + break; + case ND6_LLINFO_STALE: + printf(" S"); + break; + case ND6_LLINFO_DELAY: + printf(" D"); + break; + case ND6_LLINFO_PROBE: + printf(" P"); + break; + default: + printf(" ?"); + break; } + isrouter = rtm->rtm_flags & RTF_GATEWAY; + prbs = rtm->rtm_rmx.rmx_pksent; + /* * other flags. R: router, P: proxy, W: ?? */ |