[5/5] batman-adv: Fix resizing of broadcast seqno buffers on if deletion

Message ID 1286685001-15227-5-git-send-email-linus.luessing@web.de (mailing list archive)
State Accepted, archived
Commit 36a6022e261e5804f9810572e0d370dafb7a6385
Headers

Commit Message

Linus Lüssing Oct. 10, 2010, 4:30 a.m. UTC
  Not only the entries of the deleted interface got erased, but also all
ones with a lower if_num. This commit fixes this issue by setting the
destination appropriately.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
 originator.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Marek Lindner Oct. 12, 2010, 9:51 a.m. UTC | #1
On Sunday 10 October 2010 06:30:01 Linus Lüssing wrote:
> Not only the entries of the deleted interface got erased, but also all
> ones with a lower if_num. This commit fixes this issue by setting the
> destination appropriately.

Applied in revision 1824.

Thanks,
Marek
  

Patch

diff --git a/originator.c b/originator.c
index a7b74f0..6868a2a 100644
--- a/originator.c
+++ b/originator.c
@@ -465,7 +465,7 @@  static int orig_node_del_if(struct orig_node *orig_node,
 	memcpy(data_ptr, orig_node->bcast_own, del_if_num * chunk_size);
 
 	/* copy second part */
-	memcpy(data_ptr,
+	memcpy(data_ptr + del_if_num * chunk_size,
 	       orig_node->bcast_own + ((del_if_num + 1) * chunk_size),
 	       (max_if_num - del_if_num) * chunk_size);
 
@@ -485,7 +485,7 @@  free_bcast_own:
 	memcpy(data_ptr, orig_node->bcast_own_sum,
 	       del_if_num * sizeof(uint8_t));
 
-	memcpy(data_ptr,
+	memcpy(data_ptr + del_if_num * sizeof(uint8_t),
 	       orig_node->bcast_own_sum + ((del_if_num + 1) * sizeof(uint8_t)),
 	       (max_if_num - del_if_num) * sizeof(uint8_t));