Make route monitor display changes in all routing domains by forcing
authorbenno <benno@openbsd.org>
Sat, 14 Jul 2018 13:37:44 +0000 (13:37 +0000)
committerbenno <benno@openbsd.org>
Sat, 14 Jul 2018 13:37:44 +0000 (13:37 +0000)
the route filter to set RTABLE_ANY. Previously only the routing
table/rdomain of the route process was displayed (that being the
kernel default).
ok kn@ claudio@ and henning@

sbin/route/route.c

index b61b484..115eae2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: route.c,v 1.221 2018/07/13 09:19:42 schwarze Exp $    */
+/*     $OpenBSD: route.c,v 1.222 2018/07/14 13:37:44 benno Exp $       */
 /*     $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $   */
 
 /*
@@ -150,6 +150,7 @@ main(int argc, char **argv)
        int kw;
        int Terr = 0;
        int af = AF_UNSPEC;
+       u_int rtable_any = RTABLE_ANY;
 
        if (argc < 2)
                usage(NULL);
@@ -231,10 +232,15 @@ main(int argc, char **argv)
        }
 
        /* force socket onto table user requested */
-       if (Tflag == 1 && Terr == 0 &&
-           setsockopt(s, AF_ROUTE, ROUTE_TABLEFILTER,
-           &tableid, sizeof(tableid)) == -1)
-               err(1, "setsockopt(ROUTE_TABLEFILTER)");
+       if (Tflag == 1 && Terr == 0) {
+               if (setsockopt(s, AF_ROUTE, ROUTE_TABLEFILTER,
+                   &tableid, sizeof(tableid)) == -1)
+                       err(1, "setsockopt(ROUTE_TABLEFILTER)");
+       } else {
+               if (setsockopt(s, AF_ROUTE, ROUTE_TABLEFILTER,
+                   &rtable_any, sizeof(tableid)) == -1)
+                       err(1, "setsockopt(ROUTE_TABLEFILTER)");
+       }
 
        if (pledge("stdio dns route", NULL) == -1)
                err(1, "pledge");