diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 2ab35a0ffd7c..a5102ae3f294 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -527,6 +527,10 @@ routename(struct sockaddr *sa, int flags) static char line[NI_MAXHOST]; int error, f; + /* XXX: sa->sa_len doesn't match sizeof(struct sockaddr_dl) */ + if (sa->sa_family == AF_LINK) + sa->sa_len = sizeof(struct sockaddr_dl); + f = (flags) ? NI_NUMERICHOST : 0; error = getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0, f);