diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 985cbac56542..a3919c015533 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1496,16 +1496,18 @@ xns_status(int s __unused, struct rt_addrinfo * info) void link_status(int s __unused, struct rt_addrinfo *info) { - int n; struct sockaddr_dl *sdl = (struct sockaddr_dl *)info; - if ((n = sdl->sdl_alen) > 0) { + if (sdl->sdl_alen > 0) { if (sdl->sdl_type == IFT_ETHER && sdl->sdl_alen == ETHER_ADDR_LEN) printf("\tether %s\n", ether_ntoa((struct ether_addr *)LLADDR(sdl))); - else - printf("\tlladdr %s\n", link_ntoa(sdl) + n + 1); + else { + int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; + + printf("\tlladdr %s\n", link_ntoa(sdl) + n); + } } }