-/* $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 $ */
/*
int kw;
int Terr = 0;
int af = AF_UNSPEC;
+ u_int rtable_any = RTABLE_ANY;
if (argc < 2)
usage(NULL);
}
/* 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");