diff options
author | fjoe <fjoe@FreeBSD.org> | 2003-01-22 00:14:34 +0000 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2003-01-22 00:14:34 +0000 |
commit | aecb199acfbb6634f3874a30a1bed19632af5594 (patch) | |
tree | 6c545fd39ef4a25b1f1748e520361fa818df7f33 | |
parent | 1f669c4736b14de3aec929e9bf882a80cd835a53 (diff) | |
download | FreeBSD-src-aecb199acfbb6634f3874a30a1bed19632af5594.zip FreeBSD-src-aecb199acfbb6634f3874a30a1bed19632af5594.tar.gz |
fix link_status() in non-Ethernet case
MFC after: 1 week
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 985cbac..a3919c0 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); + } } } |