[2/2] batman-adv: Fix aggregation direct-link bug

Message ID 1269055908-20369-2-git-send-email-linus.luessing@web.de (mailing list archive)
State Accepted, archived
Headers

Commit Message

Linus Lüssing March 20, 2010, 3:31 a.m. UTC
  So far, neighbour's secondary interface OGMs can involuntarily
piggyback on primary interface OGMs that arrived on the same secondary
interface before. Secondary interface OGMs should NEVER leave their
direct neighbour broadcast domain! This patch ensures that secondary
interface OGMs can only be aggregated to other secondary interface OGMs.

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

Comments

Linus Lüssing March 20, 2010, 9:36 a.m. UTC | #1
And there are two more things I'm wondering about:
- Why should primary interface OGMs from a different originator
  which already travelled over 49 hops not be aggregated to other
  primary interface OGMs?
- Why should secondary interface OGMs from neighbours not be
  aggregated on our own, neighboring secondary interface OGMs?
As far as I can tell, those two combinations are not being
aggregated at the moment. Is there a reason why they shouldn't?

Cheers, Linus
  
Marek Lindner March 20, 2010, 2:48 p.m. UTC | #2
Hi,

thanks for your patch and for testing mine. I applied both of them.

> And there are two more things I'm wondering about:
> - Why should primary interface OGMs from a different originator
>   which already travelled over 49 hops not be aggregated to other
>   primary interface OGMs?
> - Why should secondary interface OGMs from neighbours not be
>   aggregated on our own, neighboring secondary interface OGMs?
> As far as I can tell, those two combinations are not being
> aggregated at the moment. Is there a reason why they shouldn't?

Well, well - we happily apply more of your patches.  ;-)

Cheers,
Marek
  

Patch

diff --git a/batman-adv-kernelland/aggregation.c b/batman-adv-kernelland/aggregation.c
index 0635b5a..567c31a 100644
--- a/batman-adv-kernelland/aggregation.c
+++ b/batman-adv-kernelland/aggregation.c
@@ -81,9 +81,15 @@  static bool can_aggregate_with(struct batman_packet *new_batman_packet,
 		 * interface only - we still can aggregate */
 		if ((directlink) &&
 		    (new_batman_packet->ttl == 1) &&
-		    (forw_packet->if_incoming == if_incoming))
+		    (forw_packet->if_incoming == if_incoming) &&
+
+		    /* packets from direct neighbors or
+		     * own secondary interface packets
+		     * (= secondary interface packets in general) */
+		    (batman_packet->flags & DIRECTLINK ||
+		     (forw_packet->own &&
+		      forw_packet->if_incoming->if_num != 0)))
 			return true;
-
 	}
 
 	return false;