From 17214eeed5ad7029ec0f437f6952e981fe67e1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 4 Jun 2012 10:01:11 +0300 Subject: mtu: just ignore uninteresting icmp replies ... we probably get the interesting one later. This is in case there's lot of icmp errors, we otherwise get tricked by those. --- mtu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mtu.c b/mtu.c index cc75e1e..77766eb 100644 --- a/mtu.c +++ b/mtu.c @@ -42,6 +42,7 @@ static int do_ping(int seq, int size) icmp_send_ping(fd, (struct sockaddr *) &to, sizeof(to), seq, size); +not_mine: if ((len = icmp_read_reply(fd, (struct sockaddr *) &from, sizeof(from), buf, sizeof(buf))) <= 0) continue; @@ -49,7 +50,7 @@ static int do_ping(int seq, int size) if (icmp_parse_reply(buf, len, seq, (struct sockaddr *) &from, (struct sockaddr *) &to)) - return -1; + goto not_mine; icp = (struct icmphdr *) &buf[ip->ihl * 4]; switch (icp->type) { -- cgit v1.2.3