[1/2] batctl: Fix bisecting of OGMs with 32bitseqno
Commit Message
I would like to unsubscribe from this forum.
Sent via my BlackBerry from Vodacom - let your email find you!
-----Original Message-----
From: Linus Lüssing <linus.luessing@ascom.ch>
Sender: b.a.t.m.a.n-bounces@lists.open-mesh.org
Date: Mon, 22 Nov 2010 22:45:53
To: <b.a.t.m.a.n@lists.open-mesh.org>
Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Cc: Linus Lüssing<linus.luessing@ascom.ch>
Subject: [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit
seqno
This patch increases the size of the seqno variable for bisect and now
uses UINT32_MAX for format checking. To be consistent, also "255"s got
substituted by UINT8_MAX
Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
bisect.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
--
1.7.1
@@ -385,7 +385,7 @@ err:
return 0;
}
-static int seqno_event_new(char *iface_addr, char *orig, char *prev_sender, char *neigh, int seqno, int tq, int ttl)
+static int seqno_event_new(char *iface_addr, char *orig, char *prev_sender, char *neigh, int64_t seqno, int tq, int ttl)
{
struct bat_node *orig_node, *neigh_node, *prev_sender_node;
struct orig_event *orig_event;
@@ -406,17 +406,17 @@ static int seqno_event_new(char *iface_addr, char *orig, char *prev_sender, char
goto err;
}
- if ((seqno < 0) || (seqno > 65535)) {
- fprintf(stderr, "Invalid sequence number found (%i) - skipping", seqno);
+ if ((seqno < 0) || (seqno > UINT32_MAX)) {
+ fprintf(stderr, "Invalid sequence number found (%lli) - skipping", seqno);
goto err;
}
- if ((tq < 0) || (tq > 255)) {
+ if ((tq < 0) || (tq > UINT8_MAX)) {
fprintf(stderr, "Invalid tq value found (%i) - skipping", tq);
goto err;
}
- if ((ttl < 0) || (ttl > 255)) {
+ if ((ttl < 0) || (ttl > UINT8_MAX)) {
fprintf(stderr, "Invalid ttl value found (%i) - skipping", ttl);
goto err;
}