]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
batman-adv: tt: track roam count per VID
authorSven Eckelmann <sven@narfation.org>
Sat, 13 Jun 2026 21:32:57 +0000 (23:32 +0200)
committerSven Eckelmann <sven@narfation.org>
Sun, 14 Jun 2026 07:21:31 +0000 (09:21 +0200)
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.

Cc: stable@kernel.org
Fixes: c018ad3de61a ("batman-adv: add the VLAN ID attribute to the TT entry")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/translation-table.c
net/batman-adv/types.h

index 016ad100153bde64079b58b0ba769277110d83dd..4bfad36a4b7043b1a1e24ec4118c0e65edf8c2b8 100644 (file)
@@ -3450,6 +3450,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
@@ -3457,7 +3458,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;
@@ -3470,6 +3471,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;
@@ -3491,6 +3495,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;
@@ -3527,7 +3532,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,
index c1b3f989566f534a027015d1a2d5d5be1f1104ea..3de3c1ac0244f43b8b06f6437db1895beff2fecf 100644 (file)
@@ -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)