summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-05-19 10:30:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-05-19 10:30:28 +0000
commit34a51dcec8b5a3572f630fe358d982edcb20546f (patch)
treedd77db54e1c1cbddb016a7ca23731689f8156dbb /sbin
parenta0866af4df0a13d49dfc920d45fada2f6db41c84 (diff)
Do not default to rdomain 1 for route exec use 0 as default like every other
route command. Found by Christophe Fillo (cf (at) utc fr). While there cleanup the code a bit there is no need for special rtableid handling for route exec. OK reyk@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/route.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 4978eebf236..3b3de7edc95 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.142 2010/03/23 15:01:50 claudio Exp $ */
+/* $OpenBSD: route.c,v 1.143 2010/05/19 10:30:27 claudio Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -81,7 +81,7 @@ int locking, lockrest, debugonly;
u_long mpls_flags = MPLS_OP_LOCAL;
u_long rtm_inits;
uid_t uid;
-u_int tableid = 0;
+u_int tableid;
struct rt_metrics rt_metrics;
@@ -109,8 +109,8 @@ void set_metric(char *, int);
void inet_makenetandmask(u_int32_t, struct sockaddr_in *, int);
void interfaces(void);
void getlabel(char *);
-int gettable(const char *);
-int rdomain(int, int, char **);
+void gettable(const char *);
+int rdomain(int, char **);
__dead void
usage(char *cp)
@@ -136,7 +136,6 @@ main(int argc, char **argv)
{
int ch;
int rval = 0;
- int rtableid = 1;
int kw;
if (argc < 2)
@@ -157,7 +156,7 @@ main(int argc, char **argv)
tflag = 1;
break;
case 'T':
- rtableid = gettable(optarg);
+ gettable(optarg);
break;
case 'd':
debugonly = 1;
@@ -192,7 +191,7 @@ main(int argc, char **argv)
}
switch (kw) {
case K_EXEC:
- rval = rdomain(rtableid, argc - 1, argv + 1);
+ rval = rdomain(argc - 1, argv + 1);
break;
case K_GET:
uid = 0;
@@ -1601,7 +1600,7 @@ getlabel(char *name)
rtm_addrs |= RTA_LABEL;
}
-int
+void
gettable(const char *s)
{
const char *errstr;
@@ -1609,15 +1608,14 @@ gettable(const char *s)
tableid = strtonum(s, 0, RT_TABLEID_MAX, &errstr);
if (errstr)
errx(1, "invalid table id: %s", errstr);
- return (tableid);
}
int
-rdomain(int rtableid, int argc, char **argv)
+rdomain(int argc, char **argv)
{
if (!argc)
usage(NULL);
- if (setrdomain(rtableid) == -1)
+ if (setrdomain(tableid) == -1)
err(1, "setrdomain");
execvp(*argv, argv);
return (errno == ENOENT ? 127 : 126);