All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno
@ 2010-11-22 21:45 Linus Lüssing
  2010-11-22 21:45 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Fix (skipped) substitutions of mac addresses Linus Lüssing
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Linus Lüssing @ 2010-11-22 21:45 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Linus Lüssing

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;
 	}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/2] batctl: Fix (skipped) substitutions of mac addresses
  2010-11-22 21:45 [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Linus Lüssing
@ 2010-11-22 21:45 ` Linus Lüssing
  2010-11-22 23:48   ` Marek Lindner
  2010-11-22 21:46 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bitseqno slnxumalo
  2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
  2 siblings, 1 reply; 11+ messages in thread
From: Linus Lüssing @ 2010-11-22 21:45 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Linus Lüssing

This patch fixes two parts: For one thing "batctl l" won't remove commas
anymore if it cannot find the mac address in the bat-hosts file.
For another, it now allows the correct substitution of mac addresses
which have the suffix ')'.

Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
 functions.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/functions.c b/functions.c
index ce046ba..52cfe4b 100644
--- a/functions.c
+++ b/functions.c
@@ -177,9 +177,17 @@ read:
 			*space_ptr = '\0';
 			extra_char = '\0';
 
-			if ((strlen(buff_ptr) == ETH_STR_LEN + 1) && (buff_ptr[ETH_STR_LEN] == ',')) {
-				extra_char = ',';
-				buff_ptr[ETH_STR_LEN] = '\0';
+			if (strlen(buff_ptr) == ETH_STR_LEN + 1) {
+				extra_char = buff_ptr[ETH_STR_LEN]; 
+				switch (extra_char) {
+				case ',':
+				case ')':
+					buff_ptr[ETH_STR_LEN] = '\0';
+					break;
+				default:
+					extra_char = '\0';
+					break;
+				}
 			}
 
 			if (strlen(buff_ptr) != ETH_STR_LEN)
@@ -201,16 +209,16 @@ read:
 				/* keep table format */
 				printf("%17s", bat_host->name);
 
-			if (extra_char != '\0')
-				printf("%c", extra_char);
-
-			printf(" ");
 			goto written;
 
 print_plain_buff:
-			printf("%s ", buff_ptr);
+			printf("%s", buff_ptr);
 
 written:
+			if (extra_char != '\0')
+				printf("%c", extra_char);
+
+			printf(" ");
 			buff_ptr = space_ptr + 1;
 		}
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bitseqno
  2010-11-22 21:45 [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Linus Lüssing
  2010-11-22 21:45 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Fix (skipped) substitutions of mac addresses Linus Lüssing
@ 2010-11-22 21:46 ` slnxumalo
  2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
  2 siblings, 0 replies; 11+ messages in thread
From: slnxumalo @ 2010-11-22 21:46 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

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(-)

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;
 	}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno
  2010-11-22 21:45 [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Linus Lüssing
  2010-11-22 21:45 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Fix (skipped) substitutions of mac addresses Linus Lüssing
  2010-11-22 21:46 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bitseqno slnxumalo
@ 2010-11-22 23:44 ` Marek Lindner
  2010-11-23  9:50   ` Linus Lüssing
                     ` (4 more replies)
  2 siblings, 5 replies; 11+ messages in thread
From: Marek Lindner @ 2010-11-22 23:44 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday 22 November 2010 22:45:53 Linus Lüssing wrote:
> -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)

Didn't you forget to adjust the seqno size in the seqno_event and seqno_trace 
struct ? Simply declaring it 64bit in the function header won't do much good 
...

Regards,
Marek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 2/2] batctl: Fix (skipped) substitutions of mac addresses
  2010-11-22 21:45 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Fix (skipped) substitutions of mac addresses Linus Lüssing
@ 2010-11-22 23:48   ` Marek Lindner
  0 siblings, 0 replies; 11+ messages in thread
From: Marek Lindner @ 2010-11-22 23:48 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Monday 22 November 2010 22:45:54 Linus Lüssing wrote:
> This patch fixes two parts: For one thing "batctl l" won't remove commas
> anymore if it cannot find the mac address in the bat-hosts file.
> For another, it now allows the correct substitution of mac addresses
> which have the suffix ')'.

Would you mind splitting these changes into 2 different patches ?

Regards,
Marek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno
  2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
@ 2010-11-23  9:50   ` Linus Lüssing
  2010-11-23 12:13   ` [B.A.T.M.A.N.] batctl bisect fixes, 2nd version Linus Lüssing
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Linus Lüssing @ 2010-11-23  9:50 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking; +Cc: Marek Lindner

On Tue, Nov 23, 2010 at 12:44:57AM +0100, Marek Lindner wrote:
> On Monday 22 November 2010 22:45:53 Linus Lüssing wrote:
> > -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)
> 
> Didn't you forget to adjust the seqno size in the seqno_event and seqno_trace 
> struct ? Simply declaring it 64bit in the function header won't do much good 
> ...
> 
> Regards,
> Marek
>
Urgh, just noticed, that there seem to be even more places that
need to be modified. E.g. all those seqno_min and seqno_max
occurences or strtol probably needs to be stroll for the seqno,
too. Using int64_t for any seqno(_min/max) occurence probably
won't be sufficient either, as then printf()s for int64_t (even
with %lld) won't be so nice, I guess.

Do you think using long long instead of ints for the seqnos is ok
(without any int64_t usage), hoping that on every architecture a
long long will be at least 8 Bytes large?

Cheers, Linus

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [B.A.T.M.A.N.] batctl bisect fixes, 2nd version
  2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
  2010-11-23  9:50   ` Linus Lüssing
@ 2010-11-23 12:13   ` Linus Lüssing
  2010-11-28 16:15     ` Marek Lindner
  2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 1/3] batctl: Fix bisecting of OGMs with 32bit seqno Linus Lüssing
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Linus Lüssing @ 2010-11-23 12:13 UTC (permalink / raw)
  To: b.a.t.m.a.n

Ok, this is the second version, let me know what you think it about it.

Cheers, Linus

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2 1/3] batctl: Fix bisecting of OGMs with 32bit seqno
  2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
  2010-11-23  9:50   ` Linus Lüssing
  2010-11-23 12:13   ` [B.A.T.M.A.N.] batctl bisect fixes, 2nd version Linus Lüssing
@ 2010-11-23 12:13   ` Linus Lüssing
  2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 2/3] batctl: Fix skipped substitutions of mac addresses with a following ', ' Linus Lüssing
  2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 3/3] batctl: Fix substitution of mac addresses with a following ')' Linus Lüssing
  4 siblings, 0 replies; 11+ messages in thread
From: Linus Lüssing @ 2010-11-23 12:13 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Linus Lüssing

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 |   75 ++++++++++++++++++++++++++++++++-----------------------------
 bisect.h |    4 +-
 2 files changed, 41 insertions(+), 38 deletions(-)

diff --git a/bisect.c b/bisect.c
index b7d8969..bdb51a8 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, long long 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;
 	}
@@ -468,7 +468,8 @@ static int parse_log_file(char *file_path)
 	FILE *fd;
 	char line_buff[MAX_LINE], *start_ptr, *start_ptr_safe, *tok_ptr;
 	char *neigh, *iface_addr, *orig, *prev_sender, rt_flag;
-	int line_count = 0, tq, ttl, seqno, i, res, max;
+	int line_count = 0, tq, ttl, i, res, max;
+	long long seqno;
 
 	fd = fopen(file_path, "r");
 
@@ -510,7 +511,7 @@ static int parse_log_file(char *file_path)
 					prev_sender[strlen(prev_sender) - 1] = 0;
 					break;
 				case 16:
-					seqno = strtol(tok_ptr, NULL, 10);
+					seqno = strtoll(tok_ptr, NULL, 10);
 					break;
 				case 18:
 					tq = strtol(tok_ptr, NULL, 10);
@@ -602,7 +603,7 @@ static int parse_log_file(char *file_path)
 	return 1;
 }
 
-static struct rt_hist *get_rt_hist_by_seqno(struct orig_event *orig_event, int seqno)
+static struct rt_hist *get_rt_hist_by_seqno(struct orig_event *orig_event, long long seqno)
 {
 	struct seqno_event *seqno_event;
 	struct rt_hist *rt_hist = NULL;
@@ -618,7 +619,7 @@ static struct rt_hist *get_rt_hist_by_seqno(struct orig_event *orig_event, int s
 	return rt_hist;
 }
 
-static struct rt_hist *get_rt_hist_by_node_seqno(struct bat_node *bat_node, struct bat_node *orig_node, int seqno)
+static struct rt_hist *get_rt_hist_by_node_seqno(struct bat_node *bat_node, struct bat_node *orig_node, long long seqno)
 {
 	struct orig_event *orig_event;
 	struct rt_hist *rt_hist;
@@ -632,7 +633,7 @@ static struct rt_hist *get_rt_hist_by_node_seqno(struct bat_node *bat_node, stru
 }
 
 static int print_rt_path_at_seqno(struct bat_node *src_node, struct bat_node *dst_node,
-                            struct bat_node *next_hop, int seqno, int seqno_rand, int read_opt)
+                            struct bat_node *next_hop, long long seqno, long long seqno_rand, int read_opt)
 {
 	struct bat_node *next_hop_tmp;
 	struct orig_event *orig_event;
@@ -640,10 +641,10 @@ static int print_rt_path_at_seqno(struct bat_node *src_node, struct bat_node *ds
 	char curr_loop_magic[LOOP_MAGIC_LEN];
 
 	memset(curr_loop_magic, 0, LOOP_MAGIC_LEN);
-	snprintf(curr_loop_magic, LOOP_MAGIC_LEN, "%s%s%i%i", src_node->name,
+	snprintf(curr_loop_magic, LOOP_MAGIC_LEN, "%s%s%lli%lli", src_node->name,
 	         dst_node->name, seqno, seqno_rand);
 
-	printf("Path towards %s (seqno %i ",
+	printf("Path towards %s (seqno %lli ",
 	       get_name_by_macstr(dst_node->name, read_opt), seqno);
 
 	printf("via neigh %s):", get_name_by_macstr(next_hop->name, read_opt));
@@ -694,13 +695,14 @@ out:
 }
 
 static int find_rt_table_change(struct bat_node *src_node, struct bat_node *dst_node,
-                                struct bat_node *curr_node, int seqno_min, int seqno_max,
-                                int seqno_rand, int read_opt)
+                                struct bat_node *curr_node, long long seqno_min, long long seqno_max,
+                                long long seqno_rand, int read_opt)
 {
 	struct orig_event *orig_event;
 	struct rt_hist *rt_hist, *rt_hist_tmp;
 	char curr_loop_magic[LOOP_MAGIC_LEN], loop_check = 0;
-	int res, seqno_tmp, seqno_min_tmp = seqno_min;
+	int res;
+	long long seqno_tmp, seqno_min_tmp = seqno_min;
 
 	/* printf("%i: curr_node: %s ", bla,
 		       get_name_by_macstr(curr_node->name, read_opt));
@@ -719,7 +721,7 @@ static int find_rt_table_change(struct bat_node *src_node, struct bat_node *dst_
 	}
 
 	memset(curr_loop_magic, 0, LOOP_MAGIC_LEN);
-	snprintf(curr_loop_magic, LOOP_MAGIC_LEN, "%s%s%i%i",
+	snprintf(curr_loop_magic, LOOP_MAGIC_LEN, "%s%s%lli%lli",
 	         src_node->name, dst_node->name,
 	         seqno_min_tmp, seqno_rand);
 
@@ -819,13 +821,14 @@ loop:
 	return -2;
 }
 
-static void loop_detection(char *loop_orig, int seqno_min, int seqno_max, char *filter_orig, int read_opt)
+static void loop_detection(char *loop_orig, long long seqno_min, long long seqno_max, char *filter_orig, int read_opt)
 {
 	struct bat_node *bat_node;
 	struct orig_event *orig_event;
 	struct hash_it_t *hashit = NULL;
 	struct rt_hist *rt_hist, *prev_rt_hist;
-	int last_seqno = -1, seqno_count = 0, res;
+	long long last_seqno = -1, seqno_count = 0;
+	int res;
 	char check_orig[NAME_LEN];
 
 	printf("\nAnalyzing routing tables ");
@@ -839,9 +842,9 @@ static void loop_detection(char *loop_orig, int seqno_min, int seqno_max, char *
 	if ((seqno_min == -1) && (seqno_max == -1))
 		printf("[all sequence numbers]");
 	else if (seqno_min == seqno_max)
-		printf("[sequence number: %i]", seqno_min);
+		printf("[sequence number: %lli]", seqno_min);
 	else
-		printf("[sequence number range: %i-%i]", seqno_min, seqno_max);
+		printf("[sequence number range: %lli-%lli]", seqno_min, seqno_max);
 
 	if (!compare_name(filter_orig, check_orig))
 		printf(" [filter originator: %s]",
@@ -915,7 +918,7 @@ static void loop_detection(char *loop_orig, int seqno_min, int seqno_max, char *
 				    (rt_hist->seqno_event->seqno != prev_rt_hist->seqno_event->seqno)) {
 					if (rt_hist->seqno_event->seqno < prev_rt_hist->seqno_event->seqno) {
 						fprintf(stderr,
-						        "Smaller seqno (%i) than previously received seqno (%i) of orig %s triggered routing table change - skipping recursive check\n",
+						        "Smaller seqno (%lli) than previously received seqno (%lli) of orig %s triggered routing table change - skipping recursive check\n",
 						        rt_hist->seqno_event->seqno, prev_rt_hist->seqno_event->seqno,
 						        get_name_by_macstr(rt_hist->seqno_event->orig->name, read_opt));
 						goto validate_path;
@@ -984,7 +987,7 @@ static void seqno_trace_print_neigh(struct seqno_trace_neigh *seqno_trace_neigh,
 }
 
 static void seqno_trace_print(struct list_head_first *trace_list, char *trace_orig,
-                              int seqno_min, int seqno_max, char *filter_orig, int read_opt)
+                              long long seqno_min, long long seqno_max, char *filter_orig, int read_opt)
 {
 	struct seqno_trace *seqno_trace;
 	char head[MAX_LINE], check_orig[NAME_LEN];
@@ -999,9 +1002,9 @@ static void seqno_trace_print(struct list_head_first *trace_list, char *trace_or
 	if ((seqno_min == -1) && (seqno_max == -1))
 		printf("[all sequence numbers]");
 	else if (seqno_min == seqno_max)
-		printf("[sequence number: %i]", seqno_min);
+		printf("[sequence number: %lli]", seqno_min);
 	else
-		printf("[sequence number range: %i-%i]", seqno_min, seqno_max);
+		printf("[sequence number range: %lli-%lli]", seqno_min, seqno_max);
 
 	if (!compare_name(filter_orig, check_orig))
 		printf(" [filter originator: %s]",
@@ -1013,7 +1016,7 @@ static void seqno_trace_print(struct list_head_first *trace_list, char *trace_or
 		if (!seqno_trace->print)
 			continue;
 
-		printf("+=> %s (seqno %i)\n",
+		printf("+=> %s (seqno %lli)\n",
 		       get_name_by_macstr(trace_orig, read_opt),
 		       seqno_trace->seqno);
 
@@ -1251,7 +1254,7 @@ err:
 	return 0;
 }
 
-static void trace_seqnos(char *trace_orig, int seqno_min, int seqno_max, char *filter_orig, int read_opt)
+static void trace_seqnos(char *trace_orig, long long seqno_min, long long seqno_max, char *filter_orig, int read_opt)
 {
 	struct bat_node *bat_node;
 	struct orig_event *orig_event;
@@ -1315,7 +1318,7 @@ out:
 	return;
 }
 
-static void print_rt_tables(char *rt_orig, int seqno_min, int seqno_max, char *filter_orig, int read_opt)
+static void print_rt_tables(char *rt_orig, long long seqno_min, long long seqno_max, char *filter_orig, int read_opt)
 {
 	struct bat_node *bat_node;
 	struct rt_table *rt_table;
@@ -1332,9 +1335,9 @@ static void print_rt_tables(char *rt_orig, int seqno_min, int seqno_max, char *f
 	if ((seqno_min == -1) && (seqno_max == -1))
 		printf("[all sequence numbers]");
 	else if (seqno_min == seqno_max)
-		printf("[sequence number: %i]", seqno_min);
+		printf("[sequence number: %lli]", seqno_min);
 	else
-		printf("[sequence number range: %i-%i]", seqno_min, seqno_max);
+		printf("[sequence number range: %lli-%lli]", seqno_min, seqno_max);
 
 	if (!compare_name(filter_orig, check_orig))
 		printf(" [filter originator: %s]",
@@ -1364,7 +1367,7 @@ static void print_rt_tables(char *rt_orig, int seqno_min, int seqno_max, char *f
 			continue;
 
 		if (seqno_event->seqno > -1) {
-			printf("rt change triggered by OGM from: %s (tq: %i, ttl: %i, seqno %i",
+			printf("rt change triggered by OGM from: %s (tq: %i, ttl: %i, seqno %lli",
 			       get_name_by_macstr(seqno_event->orig->name, read_opt),
 			       seqno_event->tq, seqno_event->ttl, seqno_event->seqno);
 			printf(", neigh: %s",
@@ -1443,7 +1446,7 @@ int bisect(int argc, char **argv)
 {
 	int ret = EXIT_FAILURE, res, optchar, found_args = 1;
 	int read_opt = USE_BAT_HOSTS, num_parsed_files;
-	int tmp_seqno, seqno_max = -1, seqno_min = -1;
+	long long tmp_seqno, seqno_max = -1, seqno_min = -1;
 	char *trace_orig_ptr = NULL, *rt_orig_ptr = NULL, *loop_orig_ptr = NULL;
 	char orig[NAME_LEN], filter_orig[NAME_LEN], *dash_ptr, *filter_orig_ptr = NULL;
 
@@ -1477,17 +1480,17 @@ int bisect(int argc, char **argv)
 				*dash_ptr = 0;
 
 			tmp_seqno = strtol(optarg, NULL , 10);
-			if ((tmp_seqno >= 0) && (tmp_seqno <= 65535))
+			if ((tmp_seqno >= 0) && (tmp_seqno <= UINT32_MAX))
 				seqno_min = tmp_seqno;
 			else
-				fprintf(stderr, "Warning - given sequence number is out of range: %i\n", tmp_seqno);
+				fprintf(stderr, "Warning - given sequence number is out of range: %lli\n", tmp_seqno);
 
 			if (dash_ptr) {
 				tmp_seqno = strtol(dash_ptr + 1, NULL , 10);
-				if ((tmp_seqno >= 0) && (tmp_seqno <= 65535))
+				if ((tmp_seqno >= 0) && (tmp_seqno <= UINT32_MAX))
 					seqno_max = tmp_seqno;
 				else
-					fprintf(stderr, "Warning - given sequence number is out of range: %i\n", tmp_seqno);
+					fprintf(stderr, "Warning - given sequence number is out of range: %lli\n", tmp_seqno);
 
 				*dash_ptr = '-';
 			}
@@ -1551,7 +1554,7 @@ int bisect(int argc, char **argv)
 		seqno_max = seqno_min;
 
 	if (seqno_min > seqno_max) {
-		printf("Error - the sequence range minimum (%i) should be smaller than the maximum (%i)\n",
+		printf("Error - the sequence range minimum (%lli) should be smaller than the maximum (%lli)\n",
 		       seqno_min, seqno_max);
 		goto err;
 	}
diff --git a/bisect.h b/bisect.h
index 70673e8..56cb861 100644
--- a/bisect.h
+++ b/bisect.h
@@ -76,7 +76,7 @@ struct seqno_event {
 	struct bat_node *orig;
 	struct bat_node *neigh;
 	struct bat_node *prev_sender;
-	int seqno;
+	long long seqno;
 	int tq;
 	int ttl;
 	struct rt_hist *rt_hist;
@@ -91,7 +91,7 @@ struct seqno_trace_neigh {
 
 struct seqno_trace {
 	struct list_head list;
-	int seqno;
+	long long seqno;
 	char print;
 	struct seqno_trace_neigh seqno_trace_neigh;
 };
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2 2/3] batctl: Fix skipped substitutions of mac addresses with a following ', '
  2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
                     ` (2 preceding siblings ...)
  2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 1/3] batctl: Fix bisecting of OGMs with 32bit seqno Linus Lüssing
@ 2010-11-23 12:13   ` Linus Lüssing
  2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 3/3] batctl: Fix substitution of mac addresses with a following ')' Linus Lüssing
  4 siblings, 0 replies; 11+ messages in thread
From: Linus Lüssing @ 2010-11-23 12:13 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Linus Lüssing

When batctl does not find a matching name for a given mac address in the
bat-hosts file, then it unfortunately removes the following ',' instead
of leaving the string unmodified. batctl bisect is then not able to find
the mac address anymore. This commit fixes this issue.

Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
 functions.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/functions.c b/functions.c
index ce046ba..9b1e22b 100644
--- a/functions.c
+++ b/functions.c
@@ -201,16 +201,16 @@ read:
 				/* keep table format */
 				printf("%17s", bat_host->name);
 
-			if (extra_char != '\0')
-				printf("%c", extra_char);
-
-			printf(" ");
 			goto written;
 
 print_plain_buff:
-			printf("%s ", buff_ptr);
+			printf("%s", buff_ptr);
 
 written:
+			if (extra_char != '\0')
+				printf("%c", extra_char);
+
+			printf(" ");
 			buff_ptr = space_ptr + 1;
 		}
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2 3/3] batctl: Fix substitution of mac addresses with a following ')'
  2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
                     ` (3 preceding siblings ...)
  2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 2/3] batctl: Fix skipped substitutions of mac addresses with a following ', ' Linus Lüssing
@ 2010-11-23 12:13   ` Linus Lüssing
  4 siblings, 0 replies; 11+ messages in thread
From: Linus Lüssing @ 2010-11-23 12:13 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Linus Lüssing

So far, mac addresses which had a following closing bracket and not a
comma were ignored for the bat-hosts substitutions. This commit allows
the substitution of such mac addresses, too.

Signed-off-by: Linus Lüssing <linus.luessing@ascom.ch>
---
 functions.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/functions.c b/functions.c
index 9b1e22b..52cfe4b 100644
--- a/functions.c
+++ b/functions.c
@@ -177,9 +177,17 @@ read:
 			*space_ptr = '\0';
 			extra_char = '\0';
 
-			if ((strlen(buff_ptr) == ETH_STR_LEN + 1) && (buff_ptr[ETH_STR_LEN] == ',')) {
-				extra_char = ',';
-				buff_ptr[ETH_STR_LEN] = '\0';
+			if (strlen(buff_ptr) == ETH_STR_LEN + 1) {
+				extra_char = buff_ptr[ETH_STR_LEN]; 
+				switch (extra_char) {
+				case ',':
+				case ')':
+					buff_ptr[ETH_STR_LEN] = '\0';
+					break;
+				default:
+					extra_char = '\0';
+					break;
+				}
 			}
 
 			if (strlen(buff_ptr) != ETH_STR_LEN)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [B.A.T.M.A.N.] batctl bisect fixes, 2nd version
  2010-11-23 12:13   ` [B.A.T.M.A.N.] batctl bisect fixes, 2nd version Linus Lüssing
@ 2010-11-28 16:15     ` Marek Lindner
  0 siblings, 0 replies; 11+ messages in thread
From: Marek Lindner @ 2010-11-28 16:15 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Tuesday 23 November 2010 13:13:17 Linus Lüssing wrote:
> Ok, this is the second version, let me know what you think it about it.

Applied in revision 1881-1883.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-11-28 16:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-22 21:45 [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Linus Lüssing
2010-11-22 21:45 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: Fix (skipped) substitutions of mac addresses Linus Lüssing
2010-11-22 23:48   ` Marek Lindner
2010-11-22 21:46 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bitseqno slnxumalo
2010-11-22 23:44 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix bisecting of OGMs with 32bit seqno Marek Lindner
2010-11-23  9:50   ` Linus Lüssing
2010-11-23 12:13   ` [B.A.T.M.A.N.] batctl bisect fixes, 2nd version Linus Lüssing
2010-11-28 16:15     ` Marek Lindner
2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 1/3] batctl: Fix bisecting of OGMs with 32bit seqno Linus Lüssing
2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 2/3] batctl: Fix skipped substitutions of mac addresses with a following ', ' Linus Lüssing
2010-11-23 12:13   ` [B.A.T.M.A.N.] [PATCHv2 3/3] batctl: Fix substitution of mac addresses with a following ')' Linus Lüssing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.