summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-12-03 15:42:07 +0000
committermpi <mpi@openbsd.org>2015-12-03 15:42:07 +0000
commit7164459b6fef0f65591073094b16d02df2f666d7 (patch)
treefa56277e40c0eacb7f5171528ce22be900ae7b2b
parentLet the IP27 kernel build with DEBUG. (diff)
downloadwireguard-openbsd-7164459b6fef0f65591073094b16d02df2f666d7.tar.xz
wireguard-openbsd-7164459b6fef0f65591073094b16d02df2f666d7.zip
Print the interface index, we no longer have a pointer to the interface.
Found the hardway by deraadt@
-rw-r--r--usr.bin/netstat/route.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 09b2306456a..b2f0fe1bc55 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.98 2015/02/12 01:49:02 claudio Exp $ */
+/* $OpenBSD: route.c,v 1.99 2015/12/03 15:42:07 mpi Exp $ */
/* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */
/*
@@ -35,7 +35,6 @@
#include <sys/socket.h>
#include <net/if.h>
-#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#define _KERNEL
@@ -263,7 +262,6 @@ p_rtnode(void)
static void
p_krtentry(struct rtentry *rt)
{
- static struct ifnet ifnet, *lastif;
struct sockaddr_storage sock1, sock2;
struct sockaddr *sa = (struct sockaddr *)&sock1;
struct sockaddr *mask = (struct sockaddr *)&sock2;
@@ -295,12 +293,8 @@ p_krtentry(struct rtentry *rt)
putchar((rt->rt_rmx.rmx_locks & RTV_MTU) ? 'L' : ' ');
printf(" %2d", rt->rt_priority);
- if (rt->rt_ifp) {
- if (rt->rt_ifp != lastif) {
- kread((u_long)rt->rt_ifp, &ifnet, sizeof(ifnet));
- lastif = rt->rt_ifp;
- }
- printf(" %.16s%s", ifnet.if_xname,
+ if (rt->rt_ifidx != 0) {
+ printf(" if%d%s", rt->rt_ifidx,
rt->rt_nodes[0].rn_dupedkey ? " =>" : "");
}
putchar('\n');