diff options
| author | ozaki-r <ozaki-r@NetBSD.org> | 2016-04-04 07:37:07 +0000 |
|---|---|---|
| committer | ozaki-r <ozaki-r@NetBSD.org> | 2016-04-04 07:37:07 +0000 |
| commit | 2c3eb313ce8d71b5406f306c5e9d8a54aaf13f33 (patch) | |
| tree | 4bd996fb39fe095432a94271b334470df345b72d /usr.sbin/ndp | |
| parent | 0cc22a1853dcd5be6b27d0170471487b26cda743 (diff) | |
Separate nexthop caches from the routing table
By this change, nexthop caches (IP-MAC address pair) are not stored
in the routing table anymore. Instead nexthop caches are stored in
each network interface; we already have lltable/llentry data structure
for this purpose. This change also obsoletes the concept of cloning/cloned
routes. Cloned routes no longer exist while cloning routes still exist
with renamed to connected routes.
Noticeable changes are:
- Nexthop caches aren't listed in route show/netstat -r
- sysctl(NET_RT_DUMP) doesn't return them
- If RTF_LLDATA is specified, it returns nexthop caches
- Several definitions of routing flags and messages are removed
- RTF_CLONING, RTF_XRESOLVE, RTF_LLINFO, RTF_CLONED and RTM_RESOLVE
- RTF_CONNECTED is added
- It has the same value of RTF_CLONING for backward compatibility
- route's -xresolve, -[no]cloned and -llinfo options are removed
- -[no]cloning remains because it seems there are users
- -[no]connected is introduced and recommended
to be used instead of -[no]cloning
- route show/netstat -r drops some flags
- 'L' and 'c' are not seen anymore
- 'C' now indicates a connected route
- Gateway value of a route of an interface address is now not
a L2 address but "link#N" like a connected (cloning) route
- Proxy ARP: "arp -s ... pub" doesn't create a route
You can know details of behavior changes by seeing diffs under tests/.
Proposed on tech-net and tech-kern:
http://mail-index.netbsd.org/tech-net/2016/03/11/msg005701.html
Diffstat (limited to 'usr.sbin/ndp')
| -rw-r--r-- | usr.sbin/ndp/ndp.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index ccda82184f5..6c42f4b8ff6 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ndp.c,v 1.46 2015/12/14 18:24:06 christos Exp $ */ +/* $NetBSD: ndp.c,v 1.47 2016/04/04 07:37:08 ozaki-r Exp $ */ /* $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $ */ /* @@ -394,7 +394,6 @@ set(int argc, char **argv) sdl = (struct sockaddr_dl *)(void *)(RT_ROUNDUP(mysin->sin6_len) + (char *)(void *)mysin); if (IN6_ARE_ADDR_EQUAL(&mysin->sin6_addr, &sin_m.sin6_addr)) { if (sdl->sdl_family == AF_LINK && - (rtm->rtm_flags & RTF_LLINFO) && !(rtm->rtm_flags & RTF_GATEWAY)) { switch (sdl->sdl_type) { case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023: @@ -478,7 +477,6 @@ delete(char *host) (char *)(void *)mysin); if (IN6_ARE_ADDR_EQUAL(&mysin->sin6_addr, &sin_m.sin6_addr)) { if (sdl->sdl_family == AF_LINK && - (rtm->rtm_flags & RTF_LLINFO) && !(rtm->rtm_flags & RTF_GATEWAY)) { goto delete; } @@ -545,7 +543,7 @@ again:; mib[2] = 0; mib[3] = AF_INET6; mib[4] = NET_RT_FLAGS; - mib[5] = RTF_LLINFO; + mib[5] = 0; if (prog_sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) err(1, "sysctl(PF_ROUTE estimate)"); if (needed > 0) { @@ -602,15 +600,8 @@ again:; host_buf, sizeof(host_buf), NULL, 0, (nflag ? NI_NUMERICHOST : 0)); if (cflag) { -#ifdef RTF_WASCLONED - if (rtm->rtm_flags & RTF_WASCLONED) + if ((rtm->rtm_flags & RTF_STATIC) == 0) (void)delete(host_buf); -#elif defined(RTF_CLONED) - if (rtm->rtm_flags & RTF_CLONED) - (void)delete(host_buf); -#else - (void)delete(host_buf); -#endif continue; } (void)gettimeofday(&tim, 0); @@ -806,8 +797,10 @@ rtmsg(int cmd) register int l; errno = 0; - if (cmd == RTM_DELETE) + if (cmd == RTM_DELETE) { + rtm->rtm_flags |= RTF_LLDATA; goto doit; + } (void)memset(&m_rtmsg, 0, sizeof(m_rtmsg)); rtm->rtm_flags = flags; rtm->rtm_version = RTM_VERSION; @@ -822,16 +815,18 @@ rtmsg(int cmd) rtm->rtm_rmx.rmx_expire = expire_time; rtm->rtm_inits = RTV_EXPIRE; } - rtm->rtm_flags |= (RTF_HOST | RTF_STATIC); + rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); #ifdef notdef /* we don't support ipv6addr/128 type proxying. */ if (rtm->rtm_flags & RTF_ANNOUNCE) { rtm->rtm_flags &= ~RTF_HOST; rtm->rtm_addrs |= RTA_NETMASK; } #endif - /* FALLTHROUGH */ - case RTM_GET: rtm->rtm_addrs |= RTA_DST; + break; + case RTM_GET: + rtm->rtm_flags |= RTF_LLDATA; + rtm->rtm_addrs |= RTA_DST | RTA_IFP; } #define NEXTADDR(w, s) \ if (rtm->rtm_addrs & (w)) { \ |
