summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2010-03-07 12:41:42 +0000
committerhrs <hrs@FreeBSD.org>2010-03-07 12:41:42 +0000
commit93d607e00c6c00b7ea7c8754bf4172c73cc10799 (patch)
tree1ee0a6c02f1eb353667eaf7271b2f69c1b8fb3b4 /usr.sbin
parent8768ee6ddf6699a57758bbaedbf5366d41f694d5 (diff)
downloadFreeBSD-src-93d607e00c6c00b7ea7c8754bf4172c73cc10799.zip
FreeBSD-src-93d607e00c6c00b7ea7c8754bf4172c73cc10799.tar.gz
- Use RTF_PROTO2 for routes handled by RIPng and ignore the other
routes. The route6d depends on RTF_WASCLONED to prevent connected network routes (normally configured automatically when ifconfig assigns an address with a prefix) from being removed. However, that flag is no longer used on 8.0 and later due to lltable rework. The route6d now sees routes with RTF_PROTO2 only. The flag can be changed by the -Q <num> flag. The default is 2. - -Q and -P now allow the value "0". It clears the flag itself.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/route6d/route6d.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 594736a..1866d0a 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -184,7 +184,7 @@ int aflag = 0; /* age out even the statically defined routes */
int hflag = 0; /* don't split horizon */
int lflag = 0; /* exchange site local routes */
int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */
-int Qflag = 0; /* set RTF_PROTO[123] flag to routes by RIPng */
+int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */
int sflag = 0; /* announce static routes w/ split horizon */
int Sflag = 0; /* announce static routes to every interface */
unsigned long routetag = 0; /* route tag attached on originating case */
@@ -337,10 +337,12 @@ main(argc, argv)
case 'P':
ep = NULL;
proto = strtoul(optarg, &ep, 0);
- if (!ep || *ep != '\0' || (proto < 1) || (3 < proto)) {
+ if (!ep || *ep != '\0' || 3 < proto) {
fatal("invalid P flag");
/*NOTREACHED*/
}
+ if (proto == 0)
+ Pflag = 0;
if (proto == 1)
Pflag |= RTF_PROTO1;
if (proto == 2)
@@ -351,10 +353,12 @@ main(argc, argv)
case 'Q':
ep = NULL;
proto = strtoul(optarg, &ep, 0);
- if (!ep || *ep != '\0' || (proto < 1) || (3 < proto)) {
+ if (!ep || *ep != '\0' || 3 < proto) {
fatal("invalid Q flag");
/*NOTREACHED*/
}
+ if (proto == 0)
+ Qflag = 0;
if (proto == 1)
Qflag |= RTF_PROTO1;
if (proto == 2)
@@ -2747,6 +2751,14 @@ rt_entry(rtm, again)
if (rtm->rtm_flags & RTF_CLONED)
return;
#endif
+ /* Ignore RTF_PROTO<num> mismached routes */
+ /*
+ * XXX: can we know if it is a connected network route or not?
+ * RTF_WASCLONED was the flag for that, but we no longer
+ * use it. Rely on Qflag instead here.
+ */
+ if (Qflag && !(rtm->rtm_flags & Qflag))
+ return;
/*
* do not look at dynamic routes.
* netbsd/openbsd cloned routes have UGHD.
OpenPOWER on IntegriCloud