From ff49597ed1a78c2ea0cbfc1d0600a756f8b51147 Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Mon, 11 Aug 1997 04:33:07 +0000 Subject: [PATCH] Add an ntohs() and format an IP address with inet_ntoa() when printing the details of a received ICMP packet. PR: bin/3766 Submitted by: denny1@home.com (Denton Gentry) --- sbin/ping/ping.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index ffab8251e5da..a5b9e0ecb542 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -45,7 +45,7 @@ static const char copyright[] = static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; */ static const char rcsid[] = - "$Id: ping.c,v 1.26 1997/07/20 06:09:55 bde Exp $"; + "$Id: ping.c,v 1.27 1997/08/07 02:41:15 julian Exp $"; #endif /* not lint */ /* @@ -992,7 +992,7 @@ pr_icmph(icp) break; case ICMP_UNREACH_NEEDFRAG: (void)printf("frag needed and DF set (MTU %d)\n", - icp->icmp_nextmtu); + ntohs(icp->icmp_nextmtu)); break; case ICMP_UNREACH_SRCFAIL: (void)printf("Source Route Failed\n"); @@ -1038,7 +1038,7 @@ pr_icmph(icp) (void)printf("Redirect, Bad Code: %d", icp->icmp_code); break; } - (void)printf("(New addr: 0x%08lx)\n", icp->icmp_gwaddr.s_addr); + (void)printf("(New addr: %s)\n", inet_ntoa(icp->icmp_gwaddr)); #ifndef icmp_data pr_retip(&icp->icmp_ip); #else