Skip to content

Commit 3f82fc9

Browse files
ecsvgregkh
authored andcommitted
batman-adv: tt: track roam count per VID
commit 12407d5 upstream. 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: c018ad3 ("batman-adv: add the VLAN ID attribute to the TT entry") Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3470d58 commit 3f82fc9

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

net/batman-adv/translation-table.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,14 +3442,15 @@ static void batadv_tt_roam_purge(struct batadv_priv *bat_priv)
34423442
* batadv_tt_check_roam_count() - check if a client has roamed too frequently
34433443
* @bat_priv: the bat priv with all the mesh interface information
34443444
* @client: mac address of the roaming client
3445+
* @vid: VLAN identifier
34453446
*
34463447
* This function checks whether the client already reached the
34473448
* maximum number of possible roaming phases. In this case the ROAMING_ADV
34483449
* will not be sent.
34493450
*
34503451
* Return: true if the ROAMING_ADV can be sent, false otherwise
34513452
*/
3452-
static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client)
3453+
static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client, u16 vid)
34533454
{
34543455
struct batadv_tt_roam_node *tt_roam_node;
34553456
bool ret = false;
@@ -3462,6 +3463,9 @@ static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client)
34623463
if (!batadv_compare_eth(tt_roam_node->addr, client))
34633464
continue;
34643465

3466+
if (tt_roam_node->vid != vid)
3467+
continue;
3468+
34653469
if (batadv_has_timed_out(tt_roam_node->first_time,
34663470
BATADV_ROAMING_MAX_TIME))
34673471
continue;
@@ -3483,6 +3487,7 @@ static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client)
34833487
atomic_set(&tt_roam_node->counter,
34843488
BATADV_ROAMING_MAX_COUNT - 1);
34853489
ether_addr_copy(tt_roam_node->addr, client);
3490+
tt_roam_node->vid = vid;
34863491

34873492
list_add(&tt_roam_node->list, &bat_priv->tt.roam_list);
34883493
ret = true;
@@ -3519,7 +3524,7 @@ static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
35193524
/* before going on we have to check whether the client has
35203525
* already roamed to us too many times
35213526
*/
3522-
if (!batadv_tt_check_roam_count(bat_priv, client))
3527+
if (!batadv_tt_check_roam_count(bat_priv, client, vid))
35233528
goto out;
35243529

35253530
batadv_dbg(BATADV_DBG_TT, bat_priv,

net/batman-adv/types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,9 @@ struct batadv_tt_roam_node {
19121912
/** @addr: mac address of the client in the roaming phase */
19131913
u8 addr[ETH_ALEN];
19141914

1915+
/** @vid: VLAN identifier */
1916+
u16 vid;
1917+
19151918
/**
19161919
* @counter: number of allowed roaming events per client within a single
19171920
* OGM interval (changes are committed with each OGM)

0 commit comments

Comments
 (0)