batadv_tt_check_roam_count() is supposed to track roaming of a TT entry.
But TT entries are for a MAC + VID. The VID was completely missed and thus
leads to incorrect detection of ROAM counts when a client MAC exists in
multiple VLANs.

Fixes: 580d7919f19e ("batman-adv: add the VLAN ID attribute to the TT entry")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 net/batman-adv/translation-table.c | 9 +++++++--
 net/batman-adv/types.h             | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/translation-table.c 
b/net/batman-adv/translation-table.c
index 884bb0c0..4a9f876d 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -3487,6 +3487,7 @@ static void batadv_tt_roam_purge(struct batadv_priv 
*bat_priv)
  * batadv_tt_check_roam_count() - check if a client has roamed too frequently
  * @bat_priv: the bat priv with all the mesh interface information
  * @client: mac address of the roaming client
+ * @vid: VLAN identifier
  *
  * This function checks whether the client already reached the
  * maximum number of possible roaming phases. In this case the ROAMING_ADV
@@ -3494,7 +3495,7 @@ static void batadv_tt_roam_purge(struct batadv_priv 
*bat_priv)
  *
  * Return: true if the ROAMING_ADV can be sent, false otherwise
  */
-static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 
*client)
+static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 
*client, u16 vid)
 {
        struct batadv_tt_roam_node *tt_roam_node;
        bool ret = false;
@@ -3507,6 +3508,9 @@ static bool batadv_tt_check_roam_count(struct batadv_priv 
*bat_priv, u8 *client)
                if (!batadv_compare_eth(tt_roam_node->addr, client))
                        continue;
 
+               if (tt_roam_node->vid != vid)
+                       continue;
+
                if (batadv_has_timed_out(tt_roam_node->first_time,
                                         BATADV_ROAMING_MAX_TIME))
                        continue;
@@ -3528,6 +3532,7 @@ static bool batadv_tt_check_roam_count(struct batadv_priv 
*bat_priv, u8 *client)
                atomic_set(&tt_roam_node->counter,
                           BATADV_ROAMING_MAX_COUNT - 1);
                ether_addr_copy(tt_roam_node->addr, client);
+               tt_roam_node->vid = vid;
 
                list_add(&tt_roam_node->list, &bat_priv->tt.roam_list);
                ret = true;
@@ -3564,7 +3569,7 @@ static void batadv_send_roam_adv(struct batadv_priv 
*bat_priv, u8 *client,
        /* before going on we have to check whether the client has
         * already roamed to us too many times
         */
-       if (!batadv_tt_check_roam_count(bat_priv, client))
+       if (!batadv_tt_check_roam_count(bat_priv, client, vid))
                goto out;
 
        batadv_dbg(BATADV_DBG_TT, bat_priv,
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index c1b3f989..3de3c1ac 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -1961,6 +1961,9 @@ struct batadv_tt_roam_node {
        /** @addr: mac address of the client in the roaming phase */
        u8 addr[ETH_ALEN];
 
+       /** @vid: VLAN identifier */
+       u16 vid;
+
        /**
         * @counter: number of allowed roaming events per client within a single
         * OGM interval (changes are committed with each OGM)

---
base-commit: c7518adb8b6ebdc481f6ed1fc42c7f45099806af
change-id: 20260613-tt-roam-vid-7e77427e2eb1

Best regards,
--  
Sven Eckelmann <[email protected]>

Reply via email to