summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-12-03 15:42:08 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-12-03 15:42:08 +0000
commitbbf66f0ac2d95196cdd10c259f5bed4a577b2f75 (patch)
tree7255271915636f960c02bf450784cdf6dbeab939
parent8d5e53f21bd57382f1b93abab2ed17e36f8cd52a (diff)
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');