From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795059334; b=VfXRHpXUiuYjMOJ1jk/9HUOi7HY8zIkPwtrw3y2KbqwCw6zBafbUPjREv0Aj9c53Eefl vLFHRNuKSE0SimDGKTdUf9/nj/wQDFPJ0OEFd8V5RqzSEcF9+6oo+aO72p+XDvXTXlXiX QgaD/OVm+YJXoBeGCtisXt45vDKjafz8ARy+dUiiGU5AQt2nwZJBaesw735KDV5yM0oBi LG4ZbivLnh1M5uTxh5ELI+DB/P129KpZ3dpNeP9gZKZaCI0FEo1PmlIUUo7/PhSNXfbWj AyCxdo1fLm/1MrVOncONyYUSrgOJUeObW9mlJChnMP+gTEp0AB9g42Dn6g/nuIh97FQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795059334; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=YNjt9k3oIiHSg0Fyjc6vf63UiRihFaS/l6NMJycs+ic=; b=ypbwATnRqkZcz3b+iE/NpvobI+9ikEqEcGVk30g6vfI+InLI75ZeYBFv5Q3pjCkwKEfg qmSubZl+AEJK7j7lBXhlXjCD6g2PboNPBOf10W0ZBbeBLoxCMUkLN2OTrp7PY8F9TeO88 JZVj0A3+/LeqfsP/NZELQuOj4RoxGvfD/U7PYEl6IYyfxhgttJoZXKdhuGvmhLHVHiHne Rc/gXDrkSG09m2OTOL9Vmk8gWdINqCvN/n0aZvKj72mHtzGgKBtrZeeZoj9UstSsO6Qh2 PTrHvJR6tdFoeS6ALNa+o6v2E+0+amVyGetYqWEWcKzmxpFDWHe6ZP1lSzVWsm8wISQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="P/SamiwM"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FAAE606A33F; Thu, 19 Nov 2026 03:35:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=P/SamiwM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 888F71F000C9; Thu, 19 Nov 2026 03:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795059334; bh=YNjt9k3oIiHSg0Fyjc6vf63UiRihFaS/l6NMJycs+ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=P/SamiwMDrX1ZSfb882Ra6MjHlFWib4BBE3UnwSzxckAPDBaOKmgK0EM+wAXIrGt6 nCFpLtl85aRKLpL8u7zIXMsI97B57bR1P633/htnhMlf4xq4RrwBFFdltHG6gtpfGV 2KEVFF4JJMmCIvC2B4T8ECsohE9V+X/CmP7TjFeE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sven Eckelmann , Sasha Levin Subject: [PATCH 5.10 0797/1848] batman-adv: tt: only transmit local ROAM flag together with DEL Date: Wed, 18 Nov 2026 15:47:15 +0100 Message-ID: <20261118145949.760808027@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118145911.150052362@linuxfoundation.org> References: <20261118145911.150052362@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann commit 10f24f058417024a2c19cb8d88a6a0678a58a21b upstream. BATADV_TT_CLIENT_ROAM is part of BATADV_TT_REMOTE_MASK but on the wire it only has a defined meaning together with BATADV_TT_CLIENT_DEL: the originator no longer serves the client because it roamed to another node. Such a DEL is only relevant for events (non-full table requests). An ADD carrying ROAM is processed (by accident) by the receiver like a ROAMING_ADV: a newly created global entry is marked as roaming and is excluded from the global CRC. But the sender includes it in its local CRC. But such a behavior doesn't make sense for non-ROAM_ADV because a new TTVN is meant as announced commit of the local TT table of a node and should therefore not be used to create a temporary (roam) global entry in a node. At the moment, such an ADD with the BATADV_TT_CLIENT_ROAM flag set can happen due to two mechanisms: batadv_tt_local_valid() copies all flags of the local entry into a full table response. It is not synchronized with batadv_tt_local_mark_removed(). An entry which was marked as ROAM|PENDING by a ROAMING_ADV is still part of the current TTVN and is sent with the ROAM flag set. The receivers then create a roaming global entry for it and detect a CRC mismatch, which causes them to request the full table again. The same can happen for an ADD change which is queued for an entry which (still) has the ROAM flag set. For example when only the dynamic WIFI or ISOLA flags were updated. It is not triggered by batadv_send_other_tt_response() because batadv_tt_global_valid() is already taking care of filtering out BATADV_TT_CLIENT_ROAM entries. For the two problematic announcement mechanism, only send the ROAM flag of local entries together with a DEL. This only fixes the ROAM marking of the global entry and the resulting CRC mismatch. When the requester of the full table is the node which sent the ROAMING_ADV, the still announced entry will (independent of the ROAM flag) cause batadv_tt_global_purge_local() to remove the requester's own (new) local entry for the client. This is not addressed here. Cc: stable@vger.kernel.org Fixes: 27b37ebfa2d2 ("batman-adv: correctly pass the client flag on tt_response") Fixes: 068ee6e204e1 ("batman-adv: roaming handling mechanism redesign") [ Context, use direct tt_common_entry->flags access ] Signed-off-by: Sven Eckelmann Signed-off-by: Sasha Levin --- net/batman-adv/translation-table.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 8ebbc9cf1195f..96a2078d9c387 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -471,7 +471,6 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, if (!tt_change_node) return; - tt_change_node->change.flags = flags; memset(tt_change_node->change.reserved, 0, sizeof(tt_change_node->change.reserved)); ether_addr_copy(tt_change_node->change.addr, common->addr); @@ -479,6 +478,15 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, del_op_requested = flags & BATADV_TT_CLIENT_DEL; + /* the ROAM flag is only meaningful for the receiver in combination + * with a DEL. An ADD with ROAM would be interpreted as a roaming + * advertisement + */ + if (!del_op_requested) + flags &= ~BATADV_TT_CLIENT_ROAM; + + tt_change_node->change.flags = flags; + /* check for ADD+DEL or DEL+ADD events */ spin_lock_bh(&bat_priv->tt.changes_list_lock); list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, @@ -2984,8 +2992,12 @@ static bool batadv_tt_local_valid(const void *entry_ptr, if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) return false; + /* the entry is (still) announced. A ROAM flag of an entry which is + * pending to be removed must not be transmitted. Otherwise, the + * receiver would handle it like a roaming advertisement + */ if (flags) - *flags = tt_common_entry->flags; + *flags = tt_common_entry->flags & ~BATADV_TT_CLIENT_ROAM; return true; } -- 2.53.0