From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2949384; Thu, 13 Jun 2024 12:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718282769; cv=none; b=IRN4oEzLEjo101yBUcO2Oe4+mN6IsvgVCMZOoIDI1AjWwmnUivrpMyzrcMbXWkZZmGXxNQO8HjPdw3IokYyhHpk9DgEqVz3zTmIccvMjcuq/5cvr9TQNRPpU9cxI2tvVaVuaCMj4nl9uGj/IP71bkyPTTM+C5wNj+ZU8K71cP1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718282769; c=relaxed/simple; bh=r9afCRfBLtcZwbwImoN3EEYTOYlFKAL96TynG1SlpEE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q6/C1OhLQ90V1FRP9JSb2VLwTsTsG+Dbvc7Sek7n089YBZV/MTw8H0SLvafeJcxC+L5Cm9DnWVbhewqZOV4PdrYsXqmrg/ZhOlnYprn70dSQ2fze+46iSY4rCMr86me5azulskfqjY7hwICKntwH6gWXiRa8snFzmtoOBhfzx6M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=A1LAA5rb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="A1LAA5rb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 591EAC2BBFC; Thu, 13 Jun 2024 12:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718282769; bh=r9afCRfBLtcZwbwImoN3EEYTOYlFKAL96TynG1SlpEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A1LAA5rby6braQFOpe6wosY+0fU1SJcDQWNI0V70qjjkg7jBtp5V2aqOIfKSE+KkB k+FIQeFxAqTlUtB807+ap/rKxXKQBq2oXaVo6t6/YqB0mT5ld4NcagjvkMkzGY913S hij0tCrbEUd/bSt03G7ORem6d7BLR6/mQEdkLukg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniel Borkmann , David Bauer , Ido Schimmel , Nikolay Aleksandrov , Martin KaFai Lau , "David S. Miller" Subject: [PATCH 5.15 348/402] vxlan: Fix regression when dropping packets due to invalid src addresses Date: Thu, 13 Jun 2024 13:35:05 +0200 Message-ID: <20240613113315.709989926@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113302.116811394@linuxfoundation.org> References: <20240613113302.116811394@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Borkmann commit 1cd4bc987abb2823836cbb8f887026011ccddc8a upstream. Commit f58f45c1e5b9 ("vxlan: drop packets from invalid src-address") has recently been added to vxlan mainly in the context of source address snooping/learning so that when it is enabled, an entry in the FDB is not being created for an invalid address for the corresponding tunnel endpoint. Before commit f58f45c1e5b9 vxlan was similarly behaving as geneve in that it passed through whichever macs were set in the L2 header. It turns out that this change in behavior breaks setups, for example, Cilium with netkit in L3 mode for Pods as well as tunnel mode has been passing before the change in f58f45c1e5b9 for both vxlan and geneve. After mentioned change it is only passing for geneve as in case of vxlan packets are dropped due to vxlan_set_mac() returning false as source and destination macs are zero which for E/W traffic via tunnel is totally fine. Fix it by only opting into the is_valid_ether_addr() check in vxlan_set_mac() when in fact source address snooping/learning is actually enabled in vxlan. This is done by moving the check into vxlan_snoop(). With this change, the Cilium connectivity test suite passes again for both tunnel flavors. Fixes: f58f45c1e5b9 ("vxlan: drop packets from invalid src-address") Signed-off-by: Daniel Borkmann Cc: David Bauer Cc: Ido Schimmel Cc: Nikolay Aleksandrov Cc: Martin KaFai Lau Reviewed-by: Ido Schimmel Reviewed-by: Nikolay Aleksandrov Reviewed-by: David Bauer Signed-off-by: David S. Miller [ Backport note: vxlan snooping/learning not supported in 6.8 or older, so commit is simply a revert. ] Signed-off-by: Daniel Borkmann Signed-off-by: Greg Kroah-Hartman --- drivers/net/vxlan/vxlan_core.c | 4 ---- 1 file changed, 4 deletions(-) --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -1779,10 +1779,6 @@ static bool vxlan_set_mac(struct vxlan_d if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) return false; - /* Ignore packets from invalid src-address */ - if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) - return false; - /* Get address from the outer IP header */ if (vxlan_get_sk_family(vs) == AF_INET) { saddr.sin.sin_addr.s_addr = ip_hdr(skb)->saddr;