summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-02 16:38:26 +0200
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2010-10-02 16:38:26 +0200
commitb451464a088999137097e7b364942bac12a65e67 (patch)
tree088d45006fcfbd4682952e853e3c83330ee6eba1
parent5d3806897b1d9b406135ba9b8b460ed5b5a21cf0 (diff)
downloadMAC-Telnet-b451464a088999137097e7b364942bac12a65e67.tar.gz
MAC-Telnet-b451464a088999137097e7b364942bac12a65e67.zip
Drop double/old packets. No more random buggy terminal!
-rw-r--r--main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.c b/main.c
index 31ad820..e217b49 100644
--- a/main.c
+++ b/main.c
@@ -40,6 +40,7 @@
int sockfd;
int deviceIndex;
int outcounter=0;
+int incounter=0;
int sessionkey=0;
int running = 1;
@@ -129,6 +130,13 @@ void handlePacket(unsigned char *data, int data_len) {
if (DEBUG)
printf("ACK: Plen = %d, Send result: %d\n", plen, result);
+ if (incounter == 0 || pkthdr.counter > incounter)
+ incounter = pkthdr.counter;
+ else {
+ /* Ignore double or old packets */
+ return;
+ }
+
rest = data_len - 22;
p += 22;
while (rest > 0) {