public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: alessandro@mediaspot.net
Subject: [B.A.T.M.A.N.] [PATCH-maint 4/4] batman-adv: detect local excess vlans in TT request
Date: Fri, 21 Aug 2015 17:15:18 +0200	[thread overview]
Message-ID: <1440170118-10876-5-git-send-email-sw@simonwunderlich.de> (raw)
In-Reply-To: <1440170118-10876-1-git-send-email-sw@simonwunderlich.de>

If the local representation of the global TT table of one originator has
more VLAN entries than the respective TT update, there is some
inconsistency present. By detecting and reporting this inconsistency,
the global table gets updated and the excess VLAN will get removed in
the process.

Reported-by: Alessandro Bolletta <alessandro@mediaspot.net>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/translation-table.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index dced2da..1adb72e 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2392,6 +2392,7 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
 	struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;
 	struct batadv_orig_node_vlan *vlan;
 	uint32_t crc;
+	bool found;
 	int i;
 
 	/* check if each received CRC matches the locally stored one */
@@ -2418,6 +2419,26 @@ static bool batadv_tt_global_check_crc(struct batadv_orig_node *orig_node,
 			return false;
 	}
 
+	/* check if any excess VLANs exist locally for the originator
+	 * which are not mentioned in the TVLV from the originator.
+	 */
+	rcu_read_lock();
+	list_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
+		found = false;
+
+		for (i = 0; i < num_vlan; i++) {
+			tt_vlan_tmp = tt_vlan + i;
+			if (ntohs(tt_vlan_tmp->vid) == vlan->vid) {
+				found = true;
+				break;
+			}
+		}
+
+		if (!found)
+			return false;
+	}
+	rcu_read_unlock();
+
 	return true;
 }
 
-- 
2.5.0


  parent reply	other threads:[~2015-08-21 15:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 15:15 [B.A.T.M.A.N.] [PATCH-maint 0/4] Some fixes for DAT/TT/Speedy join corner cases Simon Wunderlich
2015-08-21 15:15 ` [B.A.T.M.A.N.] [PATCH-maint 1/4] batman-adv: fix speedy join for DAT cache replies Simon Wunderlich
2015-08-25  9:42   ` Antonio Quartulli
2015-08-25 15:24     ` Simon Wunderlich
2015-08-21 15:15 ` [B.A.T.M.A.N.] [PATCH-maint 2/4] batman-adv: avoid keeping false temporary entry Simon Wunderlich
2015-08-25  9:49   ` Antonio Quartulli
2015-08-25 15:27     ` Simon Wunderlich
2015-08-21 15:15 ` [B.A.T.M.A.N.] [PATCH-maint 3/4] batman-adv: unify flags access style in tt global add Simon Wunderlich
2015-08-25  9:51   ` Antonio Quartulli
2015-08-25 15:28     ` Simon Wunderlich
2015-08-25 16:14       ` Antonio Quartulli
2015-08-21 15:15 ` Simon Wunderlich [this message]
2015-08-25  9:59   ` [B.A.T.M.A.N.] [PATCH-maint 4/4] batman-adv: detect local excess vlans in TT request Antonio Quartulli
2015-08-25 15:31     ` Simon Wunderlich
2015-08-25 18:28       ` Antonio Quartulli
2015-08-25 21:12         ` Simon Wunderlich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440170118-10876-5-git-send-email-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=alessandro@mediaspot.net \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox