From patchwork Mon Feb 6 14:04:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1528 Return-Path: Received: from nm10.bullet.mail.ukl.yahoo.com (nm10.bullet.mail.ukl.yahoo.com [217.146.182.251]) by open-mesh.org (Postfix) with SMTP id 0BF346007F8 for ; Mon, 6 Feb 2012 15:04:24 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.209] by nm10.bullet.mail.ukl.yahoo.com with NNFMP; 06 Feb 2012 14:04:24 -0000 Received: from [77.238.184.69] by tm2.bullet.mail.ukl.yahoo.com with NNFMP; 06 Feb 2012 14:04:24 -0000 Received: from [127.0.0.1] by smtp138.mail.ukl.yahoo.com with NNFMP; 06 Feb 2012 14:04:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1328537064; bh=ouPjiRMgG21qvN0bmr4cJ4dOPu0dGTfe75+6vjs5GQY=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer; b=5gxHzzW3ksQbH26ckx764MG0vDwa12AQZsBFiDwqcMHQNmCHrwJlJJwbnIbdCu8VOotlH4hDMhLYO6/hbkbJsa0sg0S/FiCec0xPyNe0O7hKXX1XBEJXst17J9iJwrQdQkJG1RamXdrxfmx1ZHGQMRSQELmCmSb3+pyvQL+mLXs= X-Yahoo-Newman-Id: 684784.36904.bm@smtp138.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: WDxTEO8VM1lSdd5XsDZxIFiiC4KLggyZSr_ecX7iWvoCfOr OovDqwHHJ8kvmlL1r059AR2iA6lYP_VsatgUWzvUFDriPEU3hyjftArlNxO5 pZpWHlRYVH8ckV5xxHzqwc70v8ZDN6sYRvstxaRXmunCsuKR7__eNjD929yR _VglcGxyLvZIflXIpxfpmoliYElqwUG_GqyxA5JMIJWE02O_c2kVNCiF752q vgiihf53ES3J.2F6k4RmvSNOO4rL5sxC_hASf6XrZ2ymySYFeOyju1_ft7vA iMRRwbFcEkMRtdkgs1mY8ojAvYxfOCTmxtCbKDgE5qhWENSXFtMXdhgwcAfT sRL2iYlNYHmeQbhlcIEpYOeaChBfbgC6rXZon7WQu0agVZUB0IWBkTB1TmIe alg-- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@210.177.7.38 with plain) by smtp138.mail.ukl.yahoo.com with SMTP; 06 Feb 2012 14:04:23 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 6 Feb 2012 22:04:17 +0800 Message-Id: <1328537057-19373-1-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH] batctl: tr / ping - ignore packets with wrong sequence number X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2012 14:04:25 -0000 Signed-off-by: Marek Lindner --- ping.c | 5 +++++ traceroute.c | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/ping.c b/ping.c index dff0f33..791cfb7 100644 --- a/ping.c +++ b/ping.c @@ -196,6 +196,7 @@ int ping(char *mesh_iface, int argc, char **argv) goto sleep; } +read_packet: start_timer(); FD_ZERO(&read_socket); @@ -229,6 +230,10 @@ int ping(char *mesh_iface, int argc, char **argv) goto sleep; } + /* after receiving an unexpected seqno we keep waiting for our answer */ + if (htons(seq_counter) != icmp_packet_in.seqno) + goto read_packet; + switch (icmp_packet_in.msg_type) { case ECHO_REPLY: time_delta = end_timer(); diff --git a/traceroute.c b/traceroute.c index f9e62cd..fdc9e4a 100644 --- a/traceroute.c +++ b/traceroute.c @@ -142,6 +142,7 @@ int traceroute(char *mesh_iface, int argc, char **argv) continue; } +read_packet: start_timer(); tv.tv_sec = 2; @@ -168,6 +169,10 @@ int traceroute(char *mesh_iface, int argc, char **argv) continue; } + /* after receiving an unexpected seqno we keep waiting for our answer */ + if (htons(seq_counter) != icmp_packet_in.seqno) + goto read_packet; + switch (icmp_packet_in.msg_type) { case ECHO_REPLY: dst_reached = 1;