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(-)
diff --git a/bisect.c b/bisect.c index b7d8969..ee9e2f1 100644 --- a/bisect.c +++ b/bisect.c @@ -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; }