summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>1999-06-26 21:21:47 +0000
committerHakan Olsson <ho@cvs.openbsd.org>1999-06-26 21:21:47 +0000
commitc1da0c612ee213cbca9ce22e3e9ccc39fe62e5cc (patch)
treef65f4e6613ee22d7912a00871c473bd8d28745cc
parent00a6465371d3b20edfe747a03434085133ebee07 (diff)
Use a.b.c.d/nn syntax for encap route output.
-rw-r--r--usr.bin/netstat/route.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 847706826a8..47f0b329fae 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.27 1999/03/15 15:59:08 deraadt Exp $ */
+/* $OpenBSD: route.c,v 1.28 1999/06/26 21:21:46 ho Exp $ */
/* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static char *rcsid = "$OpenBSD: route.c,v 1.27 1999/03/15 15:59:08 deraadt Exp $";
+static char *rcsid = "$OpenBSD: route.c,v 1.28 1999/06/26 21:21:46 ho Exp $";
#endif
#endif /* not lint */
@@ -238,8 +238,8 @@ pr_encaphdr()
{
if (Aflag)
printf("%-*s ", PLEN, "Address");
- printf("%-31s %-5s %-31s %-5s %-5s %-26s\n",
- "Source address/netmask", "Port", "Destination address/netmask",
+ printf("%-18s %-5s %-18s %-5s %-5s %-22s\n",
+ "Source", "Port", "Destination",
"Port", "Proto", "SA(Address/SPI/Proto)");
}
@@ -809,30 +809,19 @@ encap_print(rt)
register struct rtentry *rt;
{
struct sockaddr_encap sen1, sen2, sen3;
- u_char buffer[32];
- int i;
bcopy(kgetsa(rt_key(rt)), &sen1, sizeof(sen1));
bcopy(kgetsa(rt_mask(rt)), &sen2, sizeof(sen2));
bcopy(kgetsa(rt->rt_gateway), &sen3, sizeof(sen3));
- bzero(buffer, 32);
- strncpy(buffer, inet_ntoa(sen1.sen_ip_src), 15);
- i = strlen(buffer);
- strncpy(buffer + i, "/", 1);
- i++;
- strncpy(buffer + i, inet_ntoa(sen2.sen_ip_src), 15);
-
- printf("%-31s %-5u ", buffer, sen1.sen_sport);
-
- bzero(buffer, 32);
- strncpy(buffer, inet_ntoa(sen1.sen_ip_dst), 15);
- i = strlen(buffer);
- strncpy(buffer + i, "/", 1);
- i++;
- strncpy(buffer + i, inet_ntoa(sen2.sen_ip_dst), 15);
-
- printf("%-31s %-5u %-5u ", buffer, sen1.sen_dport, sen1.sen_proto);
+ printf("%-18s %-5u ", netname(sen1.sen_ip_src.s_addr,
+ sen2.sen_ip_src.s_addr),
+ sen1.sen_sport);
+
+ printf("%-18s %-5u %-5u ", netname(sen1.sen_ip_dst.s_addr,
+ sen2.sen_ip_dst.s_addr),
+ sen1.sen_dport, sen1.sen_proto);
+
printf("%s/%08x/%-lu\n", inet_ntoa(sen3.sen_ipsp_dst),
ntohl(sen3.sen_ipsp_spi), sen3.sen_ipsp_sproto);
}