netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [iputils] Print received packets as icmp_seq
@ 2007-08-07 13:49 Alexander Graf
  2007-08-07 13:49 ` [PATCH] [iputils] Print packet loss with more precision Alexander Graf
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2007-08-07 13:49 UTC (permalink / raw)
  To: netdev; +Cc: Alexander Graf

Now, ping and ping6 print the packets which are actually received, too, not
only the amount of sent packets.

It has the format:
icmp_seq=received/seq

Signed-off-by: Alexander Graf <sohalt@gmail.com>
---
 ping_common.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ping_common.c b/ping_common.c
index be36cbd..83be553 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -711,7 +711,7 @@ restamp:
 	} else {
 		int i;
 		__u8 *cp, *dp;
-		printf("%d bytes from %s: icmp_seq=%u", cc, from, seq);
+		printf("%d bytes from %s: icmp_seq=%li/%u", cc, from, nreceived, seq);
 
 		if (hops >= 0)
 			printf(" ttl=%d", hops);
-- 
1.5.2.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] [iputils] Print packet loss with more precision
  2007-08-07 13:49 [PATCH] [iputils] Print received packets as icmp_seq Alexander Graf
@ 2007-08-07 13:49 ` Alexander Graf
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2007-08-07 13:49 UTC (permalink / raw)
  To: netdev; +Cc: Alexander Graf

Signed-off-by: Alexander Graf <sohalt@gmail.com>
---
 ping_common.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ping_common.c b/ping_common.c
index 83be553..49acab2 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -795,9 +795,9 @@ void finish(void)
 	if (nerrors)
 		printf(", +%ld errors", nerrors);
 	if (ntransmitted) {
-		printf(", %d%% packet loss",
-		       (int) ((((long long)(ntransmitted - nreceived)) * 100) /
-			      ntransmitted));
+		printf(", %f%% packet loss",
+		       (((long long)(ntransmitted - nreceived)) * 100.0) /
+			      ntransmitted);
 		printf(", time %ldms", 1000*tv.tv_sec+tv.tv_usec/1000);
 	}
 	putchar('\n');
-- 
1.5.2.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-07 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-07 13:49 [PATCH] [iputils] Print received packets as icmp_seq Alexander Graf
2007-08-07 13:49 ` [PATCH] [iputils] Print packet loss with more precision Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).