summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2021-10-23 09:28:49 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2021-10-23 09:28:49 +0000
commit6179d43ca66a26c1630a21e98008aff20074b515 (patch)
tree300a20a8faa2dbcfe4f6f36014d098b7a1232ad1 /sbin
parent14b2482ada88223c3e2d48cf5e00e21da6427fc9 (diff)
Move "-T" and "exec" support out of SMALL
Ramdisk kernels lack support for alternate routing tables, so "-T N" for N > 0 always fails. "route -T0 exec" is just a useless "exec", so zap it completely. OK benno
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/route.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 1b82260c05f..952d9446943 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.258 2021/08/30 18:49:19 kn Exp $ */
+/* $OpenBSD: route.c,v 1.259 2021/10/23 09:28:48 kn Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -134,7 +134,11 @@ usage(char *cp)
if (cp)
warnx("botched keyword: %s", cp);
fprintf(stderr,
+#ifndef SMALL
"usage: %s [-dnqtv] [-T rtable] command [[modifiers] args]\n",
+#else
+ "usage: %s [-dnqtv] command [[modifiers] args]\n",
+#endif
__progname);
exit(1);
}
@@ -150,14 +154,18 @@ main(int argc, char **argv)
int ch;
int rval = 0;
int kw;
- int Terr = 0;
int af = AF_UNSPEC;
+#ifndef SMALL
+ int Terr = 0;
u_int rtable_any = RTABLE_ANY;
+#endif
if (argc < 2)
usage(NULL);
+#ifndef SMALL
tableid = getrtable();
+#endif
while ((ch = getopt(argc, argv, "dnqtT:v")) != -1)
switch (ch) {
case 'n':
@@ -172,10 +180,12 @@ main(int argc, char **argv)
case 't':
tflag = 1;
break;
+#ifndef SMALL
case 'T':
Terr = gettable(optarg);
Tflag = 1;
break;
+#endif
case 'd':
debugonly = 1;
break;
@@ -192,12 +202,14 @@ main(int argc, char **argv)
usage(NULL);
kw = keyword(*argv);
+#ifndef SMALL
if (Tflag && Terr != 0 && kw != K_ADD) {
errno = Terr;
err(1, "routing table %u", tableid);
}
if (kw == K_EXEC)
exit(rdomain(argc - 1, argv + 1));
+#endif
if (kw == K_MONITOR) {
while (--argc > 0) {
@@ -237,6 +249,7 @@ main(int argc, char **argv)
err(1, "setsockopt(ROUTE_MSGFILTER)");
}
+#ifndef SMALL
if (!tflag) {
/* force socket onto table user requested */
if (Tflag == 1 && Terr == 0) {
@@ -249,6 +262,7 @@ main(int argc, char **argv)
err(1, "setsockopt(ROUTE_TABLEFILTER)");
}
}
+#endif
if (pledge("stdio dns route", NULL) == -1)
err(1, "pledge");
@@ -2104,6 +2118,7 @@ getlabel(char *name)
rtm_addrs |= RTA_LABEL;
}
+#ifndef SMALL
int
gettable(const char *s)
{
@@ -2141,6 +2156,7 @@ rdomain(int argc, char **argv)
warn("%s", argv[0]);
return (errno == ENOENT ? 127 : 126);
}
+#endif /* SMALL */
/*
* Print RTM_PROPOSAL DNS server addresses.