diff options
author | 2018-05-01 18:14:10 +0000 | |
---|---|---|
committer | 2018-05-01 18:14:10 +0000 | |
commit | 296f388277f00d5eeb93dd0363db2f4bebe5edea (patch) | |
tree | 91f0376ae9d615b6b7e93439f496f45e2958cd73 | |
parent | Sync p_rttables() to netstat(1) version. Pointed out by claudio and (diff) | |
download | wireguard-openbsd-296f388277f00d5eeb93dd0363db2f4bebe5edea.tar.xz wireguard-openbsd-296f388277f00d5eeb93dd0363db2f4bebe5edea.zip |
The -d flag should be a no-op in monitor mode since it does not modify
the routing table.
However, if -d is provided route monitor lists all interfaces and
their associated addresses and exits. This is confusing, unexpected
and no longer needed (if ever).
Make -d a proper no-op for route monitor and get rid of the interfaces
function which didn't use the correct sysctl idiom anyway.
OK benno
-rw-r--r-- | sbin/route/route.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index 60dfd19931c..c35a4375b8b 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.213 2018/05/01 18:13:21 florian Exp $ */ +/* $OpenBSD: route.c,v 1.214 2018/05/01 18:14:10 florian Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -115,7 +115,6 @@ int rtmsg(int, int, int, uint8_t); __dead void usage(char *); 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, char **); @@ -1070,36 +1069,6 @@ prefixlen(int af, char *s) } void -interfaces(void) -{ - size_t needed; - int mib[6]; - char *buf = NULL, *lim, *next; - struct rt_msghdr *rtm; - - mib[0] = CTL_NET; - mib[1] = PF_ROUTE; - mib[2] = 0; /* protocol */ - mib[3] = 0; /* wildcard address family */ - mib[4] = NET_RT_IFLIST; - mib[5] = 0; /* no flags */ - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) - err(1, "route-sysctl-estimate"); - if (needed) { - if ((buf = malloc(needed)) == NULL) - err(1, "malloc"); - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) - err(1, "actual retrieval of interface table"); - lim = buf + needed; - for (next = buf; next < lim; next += rtm->rtm_msglen) { - rtm = (struct rt_msghdr *)next; - print_rtmsg(rtm, rtm->rtm_msglen); - } - free(buf); - } -} - -void monitor(int argc, char *argv[]) { int n; @@ -1107,10 +1076,6 @@ monitor(int argc, char *argv[]) time_t now; verbose = 1; - if (debugonly) { - interfaces(); - exit(0); - } for (;;) { if ((n = read(s, msg, sizeof(msg))) == -1) { if (errno == EINTR) |