Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Separate nexthop caches from the routing table
details: https://anonhg.NetBSD.org/src/rev/2531a89539e3
branches: trunk
changeset: 344548:2531a89539e3
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Apr 04 07:37:07 2016 +0000
description:
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:
doc/CHANGES | 15 +-
external/bsd/ipf/dist/ipsend/44arp.c | 6 +-
sbin/route/keywords.c | 12 +-
sbin/route/keywords.h | 16 +-
sbin/route/route.8 | 34 +-
sbin/route/route.c | 30 +-
sbin/route/rtutil.c | 14 +-
sbin/route/show.c | 9 +-
sbin/routed/table.c | 15 +-
share/man/man4/route.4 | 26 +-
sys/net/if.c | 6 +-
sys/net/if_llatbl.c | 99 +++-
sys/net/if_llatbl.h | 14 +-
sys/net/route.c | 187 ++----
sys/net/route.h | 14 +-
sys/net/rtsock.c | 172 ++++++-
sys/netinet/if_arp.c | 464 ++++++-----------
sys/netinet/if_atm.c | 27 +-
sys/netinet/in.c | 39 +-
sys/netinet/ip_carp.c | 14 +-
sys/netinet6/icmp6.c | 23 +-
sys/netinet6/in6.c | 52 +-
sys/netinet6/ip6_input.c | 5 +-
sys/netinet6/nd6.c | 918 +++++++++++++---------------------
sys/netinet6/nd6.h | 11 +-
sys/netinet6/nd6_nbr.c | 50 +-
sys/netinet6/nd6_rtr.c | 23 +-
tests/net/arp/t_arp.sh | 58 +-
tests/net/if/t_ifconfig.sh | 4 +-
tests/net/ndp/t_ndp.sh | 6 +-
tests/net/net/t_forwarding.sh | 20 +-
tests/net/net/t_ipaddress.sh | 32 +-
tests/net/route/t_flags.sh | 97 +---
tests/net/route/t_route.sh | 26 +-
usr.bin/netstat/route.c | 7 +-
usr.sbin/arp/arp.4 | 26 +-
usr.sbin/arp/arp.c | 28 +-
usr.sbin/ldpd/mpls_routes.c | 10 +-
usr.sbin/ndp/ndp.c | 27 +-
usr.sbin/rarpd/mkarp.c | 33 +-
usr.sbin/route6d/route6d.c | 15 +-
41 files changed, 1205 insertions(+), 1479 deletions(-)
diffs (truncated from 5262 to 300 lines):
diff -r f7a94302afaa -r 2531a89539e3 doc/CHANGES
--- a/doc/CHANGES Mon Apr 04 07:02:31 2016 +0000
+++ b/doc/CHANGES Mon Apr 04 07:37:07 2016 +0000
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2147 $>
+# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2148 $>
#
#
# [Note: This file does not mention every change made to the NetBSD source tree.
@@ -264,3 +264,16 @@
wpa_supplicant(8): Added interface matching rules [roy 20160323]
lua: Applied second and third patch from http://lua.org/bugs.html
[mbalmer 20160325]
+ network: Drop the concept of cloning/cloned routes [ozaki-r 20160404]
+ network: Remove RTF_CLONING, RTF_XRESOLVE, RTF_LLINFO, RTF_CLONED and
+ RTM_RESOLVE [ozaki-r 20160404]
+ network: Add RTF_CONNECTED as a substitute of RTF_CLONING
+ [ozaki-r 20160404]
+ route(8): Remove -xresolve, -[no]cloned and -llinfo options and add
+ [no]connected option (same as -[no]cloning) [ozaki-r 20160404]
+ route(8): Remove 'c' and 'L' flags and 'C' is now for connected routes
+ [ozaki-r 20160404]
+ netstat(1): Remove 'c' and 'L' flags and 'C' is now for connected routes
+ [ozaki-r 20160404]
+ route(8): route show doesn't contain nexthop caches [ozaki-r 20160404]
+ netstat(1): netstat -r doesn't contain nexthop caches [ozaki-r 20160404]
diff -r f7a94302afaa -r 2531a89539e3 external/bsd/ipf/dist/ipsend/44arp.c
--- a/external/bsd/ipf/dist/ipsend/44arp.c Mon Apr 04 07:02:31 2016 +0000
+++ b/external/bsd/ipf/dist/ipsend/44arp.c Mon Apr 04 07:37:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: 44arp.c,v 1.1.1.1 2012/03/23 21:20:06 christos Exp $ */
+/* $NetBSD: 44arp.c,v 1.2 2016/04/04 07:37:07 ozaki-r Exp $ */
/*
* Based upon 4.4BSD's /usr/sbin/arp
@@ -85,7 +85,11 @@
mib[2] = 0;
mib[3] = AF_INET;
mib[4] = NET_RT_FLAGS;
+#ifdef RTF_LLINFO
mib[5] = RTF_LLINFO;
+#else
+ mib[5] = 0;
+#endif
if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1)
{
perror("route-sysctl-estimate");
diff -r f7a94302afaa -r 2531a89539e3 sbin/route/keywords.c
--- a/sbin/route/keywords.c Mon Apr 04 07:02:31 2016 +0000
+++ b/sbin/route/keywords.c Mon Apr 04 07:37:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: keywords.c,v 1.10 2013/03/01 18:25:17 joerg Exp $ */
+/* $NetBSD: keywords.c,v 1.11 2016/04/04 07:37:07 ozaki-r Exp $ */
/* WARNING! This file was generated by keywords.sh */
@@ -10,8 +10,8 @@
{"atalk", K_ATALK},
{"blackhole", K_BLACKHOLE},
{"change", K_CHANGE},
- {"cloned", K_CLONED},
- {"cloning", K_CLONING},
+ {"cloning", K_CONNECTED}, /* For backward compatibility */
+ {"connected", K_CONNECTED},
{"delete", K_DELETE},
{"dst", K_DST},
{"expire", K_EXPIRE},
@@ -28,7 +28,6 @@
{"inet", K_INET},
{"inet6", K_INET6},
{"link", K_LINK},
- {"llinfo", K_LLINFO},
{"lock", K_LOCK},
{"lockrest", K_LOCKREST},
{"mask", K_MASK},
@@ -51,10 +50,9 @@
{"static", K_STATIC},
{"x25", K_X25},
{"xns", K_XNS},
- {"xresolve", K_XRESOLVE},
{"flushall", K_FLUSHALL},
- {"nocloned", K_NOCLONED},
- {"nocloning", K_NOCLONING},
+ {"nocloning", K_NOCONNECTED}, /* For backward compatibility */
+ {"noconnected", K_NOCONNECTED},
{"noblackhole", K_NOBLACKHOLE},
{"noreject", K_NOREJECT},
{"mpls", K_MPLS},
diff -r f7a94302afaa -r 2531a89539e3 sbin/route/keywords.h
--- a/sbin/route/keywords.h Mon Apr 04 07:02:31 2016 +0000
+++ b/sbin/route/keywords.h Mon Apr 04 07:37:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: keywords.h,v 1.13 2013/03/01 18:25:17 joerg Exp $ */
+/* $NetBSD: keywords.h,v 1.14 2016/04/04 07:37:07 ozaki-r Exp $ */
/* WARNING! This file was generated by keywords.sh */
@@ -12,8 +12,9 @@
#define K_ATALK 2
#define K_BLACKHOLE 3
#define K_CHANGE 4
-#define K_CLONED 5
-#define K_CLONING 6
+/* #define K_CLONED 5 */
+/* #define K_CLONING 6 */
+#define K_CONNECTED 6
#define K_DELETE 7
#define K_DST 8
#define K_EXPIRE 9
@@ -30,7 +31,7 @@
#define K_INET 20
#define K_INET6 21
#define K_LINK 22
-#define K_LLINFO 23
+/* #define K_LLINFO 23 */
#define K_LOCK 24
#define K_LOCKREST 25
#define K_MASK 26
@@ -53,10 +54,11 @@
#define K_STATIC 43
#define K_X25 44
#define K_XNS 45
-#define K_XRESOLVE 46
+/* #define K_XRESOLVE 46 */
#define K_FLUSHALL 47
-#define K_NOCLONED 48
-#define K_NOCLONING 49
+/* #define K_NOCLONED 48 */
+/* #define K_NOCLONING 49 */
+#define K_NOCONNECTED 49
#define K_NOBLACKHOLE 50
#define K_NOREJECT 51
#define K_MPLS 52
diff -r f7a94302afaa -r 2531a89539e3 sbin/route/route.8
--- a/sbin/route/route.8 Mon Apr 04 07:02:31 2016 +0000
+++ b/sbin/route/route.8 Mon Apr 04 07:37:07 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: route.8,v 1.55 2015/03/23 18:33:17 roy Exp $
+.\" $NetBSD: route.8,v 1.56 2016/04/04 07:37:07 ozaki-r Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)route.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd March 19, 2015
+.Dd March 30, 2016
.Dt ROUTE 8
.Os
.Sh NAME
@@ -297,14 +297,15 @@
.It Li B Ta -blackhole Ta " RTF_BLACKHOLE" Ta discard pkts (during updates)
.It Li b Ta "" Ta " RTF_BROADCAST" Ta Route represents a broadcast address
.It Li " " Ta -noblackhole Ta ~RTF_BLACKHOLE Ta clear blackhole flag
-.It Li C Ta -cloning Ta " RTF_CLONING" Ta generates a new route on use
-.It Li " " Ta -nocloning Ta ~RTF_CLONING Ta stop generating new routes on use
-.It Li c Ta -cloned Ta " RTF_CLONED" Ta route generated by RTF_CLONING
-.It Li " " Ta -nocloned Ta ~RTF_CLONED Ta deny removal with RTF_CLONING
+.It Li C Ta -cloning Ta " RTF_CLONING" Ta (deprecated) same as
+.Fl connected
+.It Li " " Ta -nocloning Ta ~RTF_CLONING Ta (deprecated) same as
+.Fl noconnected
+.It Li C Ta -connected Ta " RTF_CONNECTED" Ta treat as a connected route
+.It Li " " Ta -noconnected Ta ~RTF_CONNECTED Ta stop treating a connected route
.It Li D Ta "" Ta " RTF_DYNAMIC" Ta created dynamically (redirect)
.It Li G Ta "" Ta " RTF_GATEWAY" Ta forwarded to dest by intermediary
.It Li H Ta "" Ta " RTF_HOST" Ta host entry (net otherwise)
-.It Li L Ta -llinfo Ta " RTF_LLINFO" Ta translate proto to link addr
.It Li l Ta "" Ta " RTF_LOCAL" Ta Route represents a local address
.It Li M Ta "" Ta " RTF_MODIFIED" Ta modified dynamically (redirect)
.It Li p Ta -proxy Ta " RTF_ANNOUNCE" Ta make entry a link level proxy
@@ -313,7 +314,6 @@
.It Li S Ta -static Ta " RTF_STATIC" Ta manually added route
.It Li " " Ta -nostatic Ta ~RTF_STATIC Ta pretend route added automatically
.It Li U Ta "" Ta " RTF_UP" Ta route usable
-.It Li X Ta -xresolve Ta " RTF_XRESOLVE" Ta emit mesg on use (for ext lookup)
.El
.Pp
The optional modifiers
@@ -430,6 +430,24 @@
command appeared in
.Bx 4.2 .
IPv6 support was added by WIDE/KAME project.
+.Pp
+Since
+.Nx 8.0 ,
+.Fl cloned ,
+.Fl nocloned ,
+.Fl llinfo
+and
+.Fl xresolve
+were obsolete and
+.Fl cloning
+and
+.Fl nocloning
+were deprecated.
+.Fl connected
+and
+.Fl noconnected
+appeared in
+.Nx 8.0 .
.Sh BUGS
The first paragraph may have slightly exaggerated
.Xr routed 8 Ns 's
diff -r f7a94302afaa -r 2531a89539e3 sbin/route/route.c
--- a/sbin/route/route.c Mon Apr 04 07:02:31 2016 +0000
+++ b/sbin/route/route.c Mon Apr 04 07:37:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.153 2016/01/23 21:05:51 christos Exp $ */
+/* $NetBSD: route.c,v 1.154 2016/04/04 07:37:07 ozaki-r Exp $ */
/*
* Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: route.c,v 1.153 2016/01/23 21:05:51 christos Exp $");
+__RCSID("$NetBSD: route.c,v 1.154 2016/04/04 07:37:07 ozaki-r Exp $");
#endif
#endif /* not lint */
@@ -332,8 +332,7 @@
print_rtmsg(rtm, rtm->rtm_msglen);
if ((rtm->rtm_flags & flags) != flags)
continue;
- if (!(rtm->rtm_flags & (RTF_GATEWAY | RTF_STATIC |
- RTF_LLINFO)) && !doall)
+ if (!(rtm->rtm_flags & (RTF_GATEWAY | RTF_STATIC)) && !doall)
continue;
if (af != AF_UNSPEC && sa->sa_family != af)
continue;
@@ -492,9 +491,6 @@
case K_NOSTATIC:
flags &= ~RTF_STATIC;
break;
- case K_LLINFO:
- flags |= RTF_LLINFO;
- break;
case K_LOCK:
locking = 1;
break;
@@ -516,12 +512,6 @@
case K_NOBLACKHOLE:
flags &= ~RTF_BLACKHOLE;
break;
- case K_CLONED:
- flags |= RTF_CLONED;
- break;
- case K_NOCLONED:
- flags &= ~RTF_CLONED;
- break;
case K_PROTO1:
flags |= RTF_PROTO1;
break;
@@ -531,14 +521,11 @@
case K_PROXY:
flags |= RTF_ANNOUNCE;
break;
- case K_CLONING:
- flags |= RTF_CLONING;
+ case K_CONNECTED:
+ flags |= RTF_CONNECTED;
break;
- case K_NOCLONING:
- flags &= ~RTF_CLONING;
- break;
- case K_XRESOLVE:
- flags |= RTF_XRESOLVE;
+ case K_NOCONNECTED:
+ flags &= ~RTF_CONNECTED;
break;
case K_STATIC:
flags |= RTF_STATIC;
@@ -1277,7 +1264,6 @@
[RTM_LOCK] = "RTM_LOCK: fix specified metrics",
[RTM_OLDADD] = "RTM_OLDADD: caused by SIOCADDRT",
[RTM_OLDDEL] = "RTM_OLDDEL: caused by SIOCDELRT",
- [RTM_RESOLVE] = "RTM_RESOLVE: Route created by cloning",
[RTM_NEWADDR] = "RTM_NEWADDR: address being added to iface",
[RTM_DELADDR] = "RTM_DELADDR: address being removed from iface",
[RTM_OOIFINFO] = "RTM_OOIFINFO: iface status change (pre-1.5)",
@@ -1291,7 +1277,7 @@
const char metricnames[] =
"\011pksent\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire\2hopcount\1mtu";
const char routeflags[] =
-"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016CLONED\017PROTO2\020PROTO1\023LOCAL\024BROADCAST";
+"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT\011CONNECTED\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016CLONED\017PROTO2\020PROTO1\023LOCAL\024BROADCAST";
const char ifnetflags[] =
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6NOTRAILERS\7RUNNING\010NOARP\011PPROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1\017LINK2\020MULTICAST";
const char addrnames[] =
diff -r f7a94302afaa -r 2531a89539e3 sbin/route/rtutil.c
--- a/sbin/route/rtutil.c Mon Apr 04 07:02:31 2016 +0000
+++ b/sbin/route/rtutil.c Mon Apr 04 07:37:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtutil.c,v 1.7 2016/01/23 21:05:51 christos Exp $ */
+/* $NetBSD: rtutil.c,v 1.8 2016/04/04 07:37:07 ozaki-r Exp $ */
/* $OpenBSD: show.c,v 1.1 2006/05/27 19:16:37 claudio Exp $ */
Home |
Main Index |
Thread Index |
Old Index