summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-01-14 00:02:09 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-01-14 00:02:09 +0000
commit44b814d96d359e0f26046e89588f07e6b5a5c0d1 (patch)
tree5e91c69721485cdde852d2855ed97e70185f9d50
parent7c83f09f650529b91aee2f7ad55bce98a39c00ad (diff)
Similar fix for default route printing as done in netstat. Make sure mask
is 0 when sa_len is 0.
-rw-r--r--usr.bin/netstat/show.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/netstat/show.c b/usr.bin/netstat/show.c
index 0f9d35e3d98..c50e9f52bb1 100644
--- a/usr.bin/netstat/show.c
+++ b/usr.bin/netstat/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.28 2010/01/11 08:28:44 dlg Exp $ */
+/* $OpenBSD: show.c,v 1.29 2010/01/14 00:02:08 claudio Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -834,6 +834,7 @@ netname(struct sockaddr *sa, struct sockaddr *mask)
case AF_INET:
return netname4(((struct sockaddr_in *)sa)->sin_addr.s_addr,
+ mask->sa_len == 0 ? 0 :
((struct sockaddr_in *)mask)->sin_addr.s_addr);
case AF_INET6:
return netname6((struct sockaddr_in6 *)sa,