svn commit: r290372 - head/usr.bin/netstat

Hajimu UMEMOTO ume at FreeBSD.org
Wed Nov 4 19:09:44 UTC 2015


Author: ume
Date: Wed Nov  4 19:09:42 2015
New Revision: 290372
URL: https://svnweb.freebsd.org/changeset/base/290372

Log:
  Since sa->sa_len doesn't match sizeof(struct sockaddr_dl),
  getnameinfo() fails against sockaddr_dl.  This commit is workaround
  for this problem.

Modified:
  head/usr.bin/netstat/route.c

Modified: head/usr.bin/netstat/route.c
==============================================================================
--- head/usr.bin/netstat/route.c	Wed Nov  4 19:05:04 2015	(r290371)
+++ head/usr.bin/netstat/route.c	Wed Nov  4 19:09:42 2015	(r290372)
@@ -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);


More information about the svn-src-head mailing list