diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-24 20:36:35 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-24 20:36:35 +0000 |
commit | 9532101f5c2adccee06553a9d1fc35675b77c820 (patch) | |
tree | f675796b977ad1138963c7d1c6fe9e0950c705c2 | |
parent | 578ab3d946b38901b51eea00507c46894054dc0b (diff) |
Bring back a few things from route/show.c which I like better.
-rw-r--r-- | usr.bin/netstat/show.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/netstat/show.c b/usr.bin/netstat/show.c index e054bc44b30..173f60c3115 100644 --- a/usr.bin/netstat/show.c +++ b/usr.bin/netstat/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.8 2007/07/21 15:43:42 claudio Exp $ */ +/* $OpenBSD: show.c,v 1.9 2007/07/24 20:36:34 claudio Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -243,7 +243,6 @@ p_rtentry(struct rt_msghdr *rtm) struct sockaddr *mask, *rti_info[RTAX_MAX]; char ifbuf[IF_NAMESIZE]; - if (sa->sa_family == AF_KEY) return; @@ -377,12 +376,12 @@ p_encap(struct sockaddr *sa, struct sockaddr *mask, int width) else cp = routename(sa); switch (sa->sa_family) { + case AF_INET: + port = ntohs(((struct sockaddr_in *)sa)->sin_port); + break; case AF_INET6: port = ntohs(((struct sockaddr_in6 *)sa)->sin6_port); break; - default: - port = ntohs(((struct sockaddr_in *)sa)->sin_port); - break; } if (width < 0) printf("%s", cp); @@ -399,6 +398,7 @@ p_protocol(struct sadb_protocol *sap, struct sockaddr *sa, struct sadb_protocol *saft, int proto) { printf("%-6u", sap->sadb_protocol_proto); + if (sa) p_sockaddr(sa, NULL, 0, -1); else @@ -574,7 +574,7 @@ routename(struct sockaddr *sa) struct sockaddr_rtlabel *sr; sr = (struct sockaddr_rtlabel *)sa; - strlcpy(name, sr->sr_label, sizeof(name)); + (void)strlcpy(name, sr->sr_label, sizeof(name)); return (name); } /* FALLTHROUGH */ |