summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/ndp/ndp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index a1baebee283..c8aedbad3d3 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ndp.c,v 1.9 2001/02/08 08:35:17 itojun Exp $ */
-/* $KAME: ndp.c,v 1.56 2001/02/08 07:36:45 itojun Exp $ */
+/* $OpenBSD: ndp.c,v 1.10 2001/03/21 15:32:27 itojun Exp $ */
+/* $KAME: ndp.c,v 1.62 2001/03/21 15:26:32 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@@ -565,6 +565,7 @@ dump(addr)
int llwidth;
int ifwidth;
char flgbuf[8];
+ char *ifname;
/* Print header */
if (!tflag && !cflag)
@@ -629,14 +630,15 @@ again:;
llwidth = strlen(ether_str(sdl));
if (W_ADDR + W_LL - addrwidth > llwidth)
llwidth = W_ADDR + W_LL - addrwidth;
- ifwidth = strlen(if_indextoname(sdl->sdl_index,
- ifix_buf));
+ ifname = if_indextoname(sdl->sdl_index, ifix_buf);
+ if (!ifname)
+ ifname = "?";
+ ifwidth = strlen(ifname);
if (W_ADDR + W_LL + W_IF - addrwidth - llwidth > ifwidth)
ifwidth = W_ADDR + W_LL + W_IF - addrwidth - llwidth;
printf("%-*.*s %-*.*s %*.*s", addrwidth, addrwidth, host_buf,
- llwidth, llwidth, ether_str(sdl), ifwidth, ifwidth,
- if_indextoname(sdl->sdl_index, ifix_buf));
+ llwidth, llwidth, ether_str(sdl), ifwidth, ifwidth, ifname);
/* Print neighbor discovery specific informations */
nbi = getnbrinfo(&sin->sin6_addr, sdl->sdl_index, 1);