RTF_PROTO1 and RTF_PROTO2 are in theory available for users. Quagga uses 1 to denote routes added by a routing protocol, leaving 2 as the only one really available. RTF_ANNOUNCE silently overloads RTF_PROTO2, leading to non-obvious and undesired behavior, particularly in IPv6, where routes with PROTO2 basically don't work. We used to have only 16 bits of flags, but now have 32, so they aren't scarce. The only issue is the old compat structures. RTF_ANNOUNCE is used in very few places, and binary compat with old programs that publish proxy arp routes seems to be a non-issue. Also, there are two other RTF_ flgs defined but not used aywhere, aliasing PROTO1. The following diffs clean up the situation, removing the other flags, giving RTF_ANNOUNCE its own bit, and adding support for that bit to netstat and route. A previous incarnation was tested on netbsd-5 with PROTO2 on v4 and v6, and this exacct patch is currently undergoing testing. Figuring this out and the changes are due to Bev Schwartz of BBN, and <a word from our sponsor> Approved for Public Release, Distribution Unlimited This material is based upon work supported by the Defense Advanced Research Projects Agency and Space and Naval Warfare Systems Center, Pacific, under Contract No. N66001-09-C-2073. </a>. Does anyone have objections to me comitting this to -current? Author: Bev Schwartz <bschwart%bbn.com@localhost> Date: Fri Jul 1 14:45:45 2011 -0400 removed unused RTF_ flags that collide with RTF_PROTO1 netinet/icmp6.h defines RTF_PROBEMTU as RTF_PROTO1 netinet/if_inarp.h defines RTF_USETRAILERS as RTF_PROTO1 Neither of these flags are used anywhere. Both have been removed to reduce changes of collision with RTF_PROTO1. diff --git a/netbsd/src/sys/netinet/icmp6.h b/netbsd/src/sys/netinet/icmp6.h index c541f86..3e5a3ef 100644 --- a/netbsd/src/sys/netinet/icmp6.h +++ b/netbsd/src/sys/netinet/icmp6.h @@ -623,8 +623,6 @@ struct icmp6_filter { { "nd6_maxqueuelen", CTLTYPE_INT }, \ } -#define RTF_PROBEMTU RTF_PROTO1 - #ifdef _KERNEL struct rtentry; struct rttimer; diff --git a/netbsd/src/sys/netinet/if_inarp.h b/netbsd/src/sys/netinet/if_inarp.h index 6efc5d4..bed92d6 100644 --- a/netbsd/src/sys/netinet/if_inarp.h +++ b/netbsd/src/sys/netinet/if_inarp.h @@ -53,11 +53,6 @@ struct sockaddr_inarp { #define SIN_PROXY 1 }; -/* - * IP and ethernet specific routing flags - */ -#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ - #ifdef _KERNEL extern struct ifqueue arpintrq; void arp_ifinit(struct ifnet *, struct ifaddr *); Author: Bev Schwartz <bschwart%bbn.com@localhost> Date: Fri Jul 1 14:25:22 2011 -0400 Moved RTF_ANNOUNCE flag so that it no longer conflicts with RTF_PROTO2 RTF_ANNOUNCE was defined as RTF_PROTO2. The flag is used to indicated that host should act as a proxy for a link level arp or ndp request. If RTF_PROTO2 is used as an experimental flag (as advertised), additional link layer traffic *may* be produced if RTF_ANNOUNCE conflicts with RTF_PROTO2. In addition, in certain cases in IPv6, it impedes correct traffic from being transmitted. Not only is the flag moved, but some user space applications are modified to properly support this flag. KERNEL - sys/net/route.h: added definition for RTF_ANNOUNCE - sys/netinet/if_inarp.h: - sys/netinet6nd6.h: removed previous definitions for RTF_ANNOUNCE NETSTAT - usr.bin/netstat/show.c: added this new flag ('p' proxy/RTF_ANNOUNCE) to the bits structure - usr.bin/netstat/netstat.1: added documentation describing what the 'p' (proxy/RTF_ANNOUNCE) flag is ROUTE - sbin/route/keywords.c: - sbin/route/keywords.h: - sbin/route/keywords.sh: keywords.[ch] was out of sync with keywords.sh. So I corrected the previous error. (It appeared someone hand-coded support for "nocloned" and "nocloning" in keywords.[ch] rather than adding "nocloned" and "nocloning" to keywords.sh.) In addition, I added my new "proxy" key word. - sbin/route/show.c Added this new flag ('p' proxy/RTF_ANNOUNCE) to the bits structure. Its usefulness is questionable, because the show function only displays the flags it finds interesting: UGHRL. If someone decides to remove the "interesting" mask, then the proxy flag is there for future use. - sbin/route/route.c Added new option to the route program to turn the RTF_ANNOUNCE on. - sbin/route/route.8 added documentation for the new -proxy option diff --git a/netbsd/src/sbin/route/keywords.c b/netbsd/src/sbin/route/keywords.c index 59c0390..4f9da79 100644 --- a/netbsd/src/sbin/route/keywords.c +++ b/netbsd/src/sbin/route/keywords.c @@ -1,4 +1,4 @@ -/* $NetBSD: keywords.c,v 1.6 2006/08/06 17:44:56 dyoung Exp $ */ +/* $NetBSD$ */ /* WARNING! This file was generated by keywords.sh */ @@ -12,8 +12,6 @@ struct keytab keywords[] = { {"change", K_CHANGE}, {"cloned", K_CLONED}, {"cloning", K_CLONING}, - {"nocloned", K_NOCLONED}, - {"nocloning", K_NOCLONING}, {"delete", K_DELETE}, {"dst", K_DST}, {"expire", K_EXPIRE}, @@ -57,6 +55,9 @@ struct keytab keywords[] = { {"xns", K_XNS}, {"xresolve", K_XRESOLVE}, {"flushall", K_FLUSHALL}, + {"nocloned", K_NOCLONED}, + {"nocloning", K_NOCLONING}, + {"proxy", K_PROXY}, {0, 0} }; diff --git a/netbsd/src/sbin/route/keywords.h b/netbsd/src/sbin/route/keywords.h index fae34f4..688297b 100644 --- a/netbsd/src/sbin/route/keywords.h +++ b/netbsd/src/sbin/route/keywords.h @@ -1,4 +1,4 @@ -/* $NetBSD: keywords.h,v 1.9 2006/08/06 17:44:56 dyoung Exp $ */ +/* $NetBSD$ */ /* WARNING! This file was generated by keywords.sh */ @@ -59,3 +59,4 @@ extern struct keytab { #define K_FLUSHALL 49 #define K_NOCLONED 50 #define K_NOCLONING 51 +#define K_PROXY 52 diff --git a/netbsd/src/sbin/route/keywords.sh b/netbsd/src/sbin/route/keywords.sh index 41e9985..2aa743a 100755 --- a/netbsd/src/sbin/route/keywords.sh +++ b/netbsd/src/sbin/route/keywords.sh @@ -57,6 +57,9 @@ x25 xns xresolve flushall +nocloned +nocloning +proxy _EOF_ @@ -81,7 +84,7 @@ echo '/* $'NetBSD'$ */ /* WARNING! This file was generated by keywords.sh */ extern struct keytab { - char *kt_cp; + const char *kt_cp; int kt_i; } keywords[]; diff --git a/netbsd/src/sbin/route/route.8 b/netbsd/src/sbin/route/route.8 index 868fee5..83c02ff 100644 --- a/netbsd/src/sbin/route/route.8 +++ b/netbsd/src/sbin/route/route.8 @@ -280,6 +280,7 @@ by indicating the following corresponding modifiers: -proto1 RTF_PROTO1 - set protocol specific routing flag #1 -proto2 RTF_PROTO2 - set protocol specific routing flag #2 -llinfo RTF_LLINFO - validly translates proto addr to link addr +-proxy RTF_ANNOUNCE - make entry a link level proxy .Ed .Pp The optional modifiers diff --git a/netbsd/src/sbin/route/route.c b/netbsd/src/sbin/route/route.c index 2b9642e..ddde403 100644 --- a/netbsd/src/sbin/route/route.c +++ b/netbsd/src/sbin/route/route.c @@ -858,6 +858,9 @@ newroute(int argc, char *const *argv) case K_PROTO2: flags |= RTF_PROTO2; break; + case K_PROXY: + flags |= RTF_ANNOUNCE; + break; case K_CLONING: flags |= RTF_CLONING; break; diff --git a/netbsd/src/sbin/route/show.c b/netbsd/src/sbin/route/show.c index 9bc238e..360caf0 100644 --- a/netbsd/src/sbin/route/show.c +++ b/netbsd/src/sbin/route/show.c @@ -70,7 +70,7 @@ __RCSID("$NetBSD: show.c,v 1.38 2008/09/10 01:06:58 dyoung Exp $"); * Definitions for showing gateway flags. */ struct bits { - short b_mask; + int b_mask; char b_val; }; static const struct bits bits[] = { @@ -90,6 +90,7 @@ static const struct bits bits[] = { { RTF_CLONED, 'c' }, { RTF_PROTO1, '1' }, { RTF_PROTO2, '2' }, + { RTF_ANNOUNCE, 'p' }, { 0, '\0' } }; diff --git a/netbsd/src/sys/net/route.h b/netbsd/src/sys/net/route.h index 3c91d24..ad2f971 100644 --- a/netbsd/src/sys/net/route.h +++ b/netbsd/src/sys/net/route.h @@ -153,6 +153,7 @@ struct ortentry { #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ #define RTF_PROTO1 0x8000 /* protocol specific routing flag */ #define RTF_SRC 0x10000 /* route has fixed source address */ +#define RTF_ANNOUNCE 0x20000 /* announce new arp or ndp entry */ /* diff --git a/netbsd/src/sys/netinet/if_inarp.h b/netbsd/src/sys/netinet/if_inarp.h index e7b1986..6efc5d4 100644 --- a/netbsd/src/sys/netinet/if_inarp.h +++ b/netbsd/src/sys/netinet/if_inarp.h @@ -57,7 +57,6 @@ struct sockaddr_inarp { * IP and ethernet specific routing flags */ #define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ -#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */ #ifdef _KERNEL extern struct ifqueue arpintrq; diff --git a/netbsd/src/sys/netinet6/nd6.h b/netbsd/src/sys/netinet6/nd6.h index 177d9fc..ed2ebfa 100644 --- a/netbsd/src/sys/netinet6/nd6.h +++ b/netbsd/src/sys/netinet6/nd6.h @@ -33,11 +33,6 @@ #ifndef _NETINET6_ND6_H_ #define _NETINET6_ND6_H_ -/* see net/route.h, or net/if_inarp.h */ -#ifndef RTF_ANNOUNCE -#define RTF_ANNOUNCE RTF_PROTO2 -#endif - #include <sys/queue.h> #include <sys/callout.h> diff --git a/netbsd/src/usr.bin/netstat/netstat.1 b/netbsd/src/usr.bin/netstat/netstat.1 index c4d6a6a..fc8ea98 100644 --- a/netbsd/src/usr.bin/netstat/netstat.1 +++ b/netbsd/src/usr.bin/netstat/netstat.1 @@ -322,6 +322,7 @@ G RTF_GATEWAY Destination requires forwarding by intermediary H RTF_HOST Host entry (net otherwise) L RTF_LLINFO Valid protocol to link address translation. M RTF_MODIFIED Modified dynamically (by redirect) +p RTF_ANNOUNCE Link level proxy R RTF_REJECT Host or net unreachable S RTF_STATIC Manually added U RTF_UP Route usable diff --git a/netbsd/src/usr.bin/netstat/show.c b/netbsd/src/usr.bin/netstat/show.c index 3232e44..3417807 100644 --- a/netbsd/src/usr.bin/netstat/show.c +++ b/netbsd/src/usr.bin/netstat/show.c @@ -92,6 +92,7 @@ static const struct bits bits[] = { /* { RTF_PROTO3, '3' }, */ { RTF_CLONED, 'c' }, /* { RTF_JUMBO, 'J' }, */ + { RTF_ANNOUNCE, 'p' }, { 0 } };
Attachment:
pgpfON_NYRh8A.pgp
Description: PGP signature