From: Marek Lindner <lindner_marek@yahoo.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Marek Lindner <lindner_marek@yahoo.de>
Subject: [B.A.T.M.A.N.] [PATCH] batctl: tr / ping - ignore packets with wrong sequence number
Date: Mon, 6 Feb 2012 22:04:17 +0800 [thread overview]
Message-ID: <1328537057-19373-1-git-send-email-lindner_marek@yahoo.de> (raw)
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
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;
--
1.7.5.4
next reply other threads:[~2012-02-06 14:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 14:04 Marek Lindner [this message]
2012-02-11 11:18 ` [B.A.T.M.A.N.] [PATCH] batctl: tr / ping - ignore packets with wrong sequence number Marek Lindner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328537057-19373-1-git-send-email-lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).