diff options
author | melifaro <melifaro@FreeBSD.org> | 2015-12-16 10:14:16 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2015-12-16 10:14:16 +0000 |
commit | fb12a509fe8b781ba3e865fcc78af667ed78c66c (patch) | |
tree | 37753ca0d04540927e3ad47c4a42a40617fe0efa /sys/netinet6 | |
parent | 9f3bc9ef2e9ce8d0e534c4fd223a21e90a97584f (diff) | |
download | FreeBSD-src-fb12a509fe8b781ba3e865fcc78af667ed78c66c.zip FreeBSD-src-fb12a509fe8b781ba3e865fcc78af667ed78c66c.tar.gz |
Provide additional lle data in IPv6 lltable dump used by ndp(8).
Before the change, things like lle state were queried via
SIOCGNBRINFO_IN6 by ndp(8) for _each_ lle entry in dump.
This ioctl was added in 1999, probably to avoid touching rtsock code.
This change maps SIOCGNBRINFO_IN6 data to standard rtsock dump the
following way:
expire (already) maps to rtm_rmx.rmx_expire
isrouter -> rtm_flags & RTF_GATEWAY
asked -> rtm_rmx.rmx_pksent
state -> rtm_rmx.rmx_state (maps to rmx_weight via define)
Reviewed by: ae
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 11 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 2 |
2 files changed, 10 insertions, 3 deletions
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; |