From patchwork Wed Jan 5 19:56:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12704653 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C84AC433EF for ; Wed, 5 Jan 2022 19:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243789AbiAET4i (ORCPT ); Wed, 5 Jan 2022 14:56:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46328 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243775AbiAET4a (ORCPT ); Wed, 5 Jan 2022 14:56:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641412588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kkxPE7csE0XuLRvys1rthi2yBRg1Kfy7/aNN8UlHJOA=; b=ZCIniE9DiQl/OdwaC84gEsQHgqjwxOBe3/4ahTH1QblJM2ZapbxGIX6Syq3RtoqOJayN/P nTPeqLdsp3y/cVwT/SqTKVAZTGdrvTfQ3BBs+m9tiuXPNzf0wHlxxY7C58GZSDltaN7yfh jGwW4lWcaUBCtABsIbZjByyGUpReXLE= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-298-IvfrTeC-P_e8jUGg1k3OzA-1; Wed, 05 Jan 2022 14:56:25 -0500 X-MC-Unique: IvfrTeC-P_e8jUGg1k3OzA-1 Received: by mail-wm1-f69.google.com with SMTP id c5-20020a1c3505000000b00345c92c27c6so2308169wma.2 for ; Wed, 05 Jan 2022 11:56:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kkxPE7csE0XuLRvys1rthi2yBRg1Kfy7/aNN8UlHJOA=; b=xNnYDz2ADnDAmgRlDJ4ZQp54uHawxHUZH+r5qtpWuU7rRvcmncY367+EZ3sG7vA02x 0h3TrlNZlhqb7aIew5XJB4OqpAogVNBQ4gkjnLiSOsw/Ol47sVwZxobMuqs3xj6Qgd8p UKVId/LslqbzC9w2uvmtftSrGe2Ab/EFzSST/CWRehNSTpPN8sMnsBxVokNfl9pEu5cK /X2boeKxxNQ8GrCoCgLExqtOgA7Rzj7QKzZwta/n5iEzl6yGRejmD2n85iqPj0yux6a/ PqX+X1cl7jzdguQoXyd9gZWyMVcbIaP0K1WObZlDn1RXYLfmCRjqpb/SsabCBg9iN8uX 5nVg== X-Gm-Message-State: AOAM531dEMnKYY58ILcO+zFSHrIfOJN7tIEUBdZaHLX/c/tQcEd5ssG4 e+Qml4OmA41f3SADhQrtqFFNMGlAVhSZPuN7U6kIyOJ30AdkkGmQIIfVLz6xuFdyUWW5Kv7u43m Gur5bEIBASE3UVeOl X-Received: by 2002:a5d:5184:: with SMTP id k4mr700007wrv.462.1641412583985; Wed, 05 Jan 2022 11:56:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpcJpp6Bbx8FPSjBQmpfnWr9P4r0NY9TW3jrje2RieiDpMqPhTCiZWyliA5tIa0638SiFIjQ== X-Received: by 2002:a5d:5184:: with SMTP id k4mr700000wrv.462.1641412583859; Wed, 05 Jan 2022 11:56:23 -0800 (PST) Received: from pc-1.home (2a01cb058d24940001d1c23ad2b4ba61.ipv6.abo.wanadoo.fr. [2a01:cb05:8d24:9400:1d1:c23a:d2b4:ba61]) by smtp.gmail.com with ESMTPSA id p23sm3381492wms.3.2022.01.05.11.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 11:56:22 -0800 (PST) Date: Wed, 5 Jan 2022 20:56:20 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Steffen Klassert , Herbert Xu Subject: [PATCH net 1/4] xfrm: Don't accidentally set RTO_ONLINK in decode_session4() Message-ID: <417b5d77540ced450db73d53aaf153a12bc50e88.1641407336.git.gnault@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Similar to commit 94e2238969e8 ("xfrm4: strip ECN bits from tos field"), clear the ECN bits from iph->tos when setting ->flowi4_tos. This ensures that the last bit of ->flowi4_tos is cleared, so ip_route_output_key_hash() isn't going to restrict the scope of the route lookup. Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason to clear the high order bits. Found by code inspection, compile tested only. Fixes: 4da3089f2b58 ("[IPSEC]: Use TOS when doing tunnel lookups") Signed-off-by: Guillaume Nault --- net/xfrm/xfrm_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 1a06585022ab..0bb82df0f569 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #if IS_ENABLED(CONFIG_IPV6_MIP6) @@ -3294,7 +3295,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse) fl4->flowi4_proto = iph->protocol; fl4->daddr = reverse ? iph->saddr : iph->daddr; fl4->saddr = reverse ? iph->daddr : iph->saddr; - fl4->flowi4_tos = iph->tos; + fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK; if (!ip_is_fragment(iph)) { switch (iph->protocol) { From patchwork Wed Jan 5 19:56:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12704652 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 042ADC433F5 for ; Wed, 5 Jan 2022 19:56:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243782AbiAET4c (ORCPT ); Wed, 5 Jan 2022 14:56:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27742 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243777AbiAET43 (ORCPT ); Wed, 5 Jan 2022 14:56:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641412588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KRMzzDKvCk0n9/fmg3Sw0HSY9kEMaWLYnTYPkINVTN0=; b=MH60ytBIv5Jxdnv+tvFbseDFh1k+9IMWt0UyWogHWQP003hT8rhlVHMegnquXZJ6aUHom1 ZdQwTXJm4lsLwbFESTQFaRhyrwulhd3CxgeWwZBsXHIN21NzEgaqvlWqUv5bShpRKoSUSr SXCR/1XSPNh2bIvOlCSfqOzhWFsN9fE= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-191-dRHm8bOuNIW3zZpbbisEwg-1; Wed, 05 Jan 2022 14:56:27 -0500 X-MC-Unique: dRHm8bOuNIW3zZpbbisEwg-1 Received: by mail-wm1-f69.google.com with SMTP id r2-20020a05600c35c200b00345c3b82b22so2326999wmq.0 for ; Wed, 05 Jan 2022 11:56:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KRMzzDKvCk0n9/fmg3Sw0HSY9kEMaWLYnTYPkINVTN0=; b=bsviS7b4UOC+qUhPjvZKdzlAWe2U1UPmaIZMccop+BT3CxthkNgEKqqIdkF0tzoXSh rfiR6gF85KXRbrAYxq/Ydf/P6D9immKakZkFTYfR8fRXAqbWXBKUnupPplQZU4QNuhRC TP9klIm/aljiX4UIpAyA8bbtHX1TcU1Bf0R4HR0+0HefN9LB/8vAmvcb3hOQLr60NeHj ke56jcIdI13krEzqBbNWDPe8Y4P+GTRUQlpZDHo6DJz2dlJ8DPe9aOkmlvVXRM9sQ3VO Qv4adkeCTiSm9xIgL3PXOLgKbz5dS+2XzuS7w0nFbEkSgrz8z1SpmcoVVWYH7HwcjqZl Mf8A== X-Gm-Message-State: AOAM532duYTqWxFSr0BQckV/3TLkPKetgrDCRoPXiPgthefVAI70pzAq 1QPcCRIGjI3wAa5xRkb5/Jx5lIuct8M1v1PeQ2FqcvCvRoTIV8Dp5ecjCyKHIMpNnscplhyR40k KFxEeG/xqi+gZBf7h X-Received: by 2002:a5d:5049:: with SMTP id h9mr49178591wrt.382.1641412585136; Wed, 05 Jan 2022 11:56:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzts8Ykxm9yBWPs7FJMhiWD414YF6mUIeoCDT0AIp1Qu9EXyn8qSyPMDKXV/u1Ayfa7VXKbcg== X-Received: by 2002:a5d:5049:: with SMTP id h9mr49178584wrt.382.1641412585007; Wed, 05 Jan 2022 11:56:25 -0800 (PST) Received: from pc-1.home (2a01cb058d24940001d1c23ad2b4ba61.ipv6.abo.wanadoo.fr. [2a01:cb05:8d24:9400:1d1:c23a:d2b4:ba61]) by smtp.gmail.com with ESMTPSA id m35sm7448302wms.1.2022.01.05.11.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 11:56:24 -0800 (PST) Date: Wed, 5 Jan 2022 20:56:22 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Hideaki YOSHIFUJI , David Ahern , wenxu Subject: [PATCH net 2/4] gre: Don't accidentally set RTO_ONLINK in gre_fill_metadata_dst() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Mask the ECN bits before initialising ->flowi4_tos. The tunnel key may have the last ECN bit set, which will interfere with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: 962924fa2b7a ("ip_gre: Refactor collect metatdata mode tunnel xmit to ip_md_tunnel_xmit") Signed-off-by: Guillaume Nault --- net/ipv4/ip_gre.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 2ac2b95c5694..99db2e41ed10 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -604,8 +604,9 @@ static int gre_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb) key = &info->key; ip_tunnel_init_flow(&fl4, IPPROTO_GRE, key->u.ipv4.dst, key->u.ipv4.src, - tunnel_id_to_key32(key->tun_id), key->tos, 0, - skb->mark, skb_get_hash(skb)); + tunnel_id_to_key32(key->tun_id), + key->tos & ~INET_ECN_MASK, 0, skb->mark, + skb_get_hash(skb)); rt = ip_route_output_key(dev_net(dev), &fl4); if (IS_ERR(rt)) return PTR_ERR(rt); From patchwork Wed Jan 5 19:56:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12704654 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BA17C433FE for ; Wed, 5 Jan 2022 19:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243781AbiAET4l (ORCPT ); Wed, 5 Jan 2022 14:56:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27662 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243778AbiAET4a (ORCPT ); Wed, 5 Jan 2022 14:56:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641412590; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=E8GuX7GeQ6zIo2mKCOrt8PiFbMCuvejd1nRVIiaIwWs=; b=V/rC5mPdoWI6/joi/BleHZon7BQN1hykeydrllsvQ79rM2GVn5twDKoV885qqHCrH1+g9A etKebJuyBQyMQL9OZm17gpQ2hIG9ix8zjeYs2jC2KYveRibff1u/DC9EbMb1zQbK64kguL CqQs2fBvFeHF/BoL33ebtm6d90f5+JA= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-WGE9tSJVNqqoK4D0KoS1rQ-1; Wed, 05 Jan 2022 14:56:29 -0500 X-MC-Unique: WGE9tSJVNqqoK4D0KoS1rQ-1 Received: by mail-wr1-f71.google.com with SMTP id c16-20020adfa310000000b001a2349890e1so118028wrb.0 for ; Wed, 05 Jan 2022 11:56:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=E8GuX7GeQ6zIo2mKCOrt8PiFbMCuvejd1nRVIiaIwWs=; b=ziLjYeidKNy5ON5CSIAnZ4Tp/wGU3qQ+W+rPTPzRijgf+R86b2V2WMqDAoYzpI9rJ4 ySeb9glrvNbIntkaOUjllIGE/9IggprWQt8RVrJY8ZNkOg2sFi0ENsKThjgWTmEOE1aW O8L2nA4G8xZdmN/r9RBL+l4f+iR74dlDSsnYB9HYUoFh8wJ47RRVU+FSXP48ATe5r4mj QjteRMlULmStRY7QJMSuG7GBURon4fDK1Yz0VrA6MeJQqnVsqMRUHDemt/USpG78e16C 83Wwefv6KcCcD2AKxS86ppzqU9GmnMLo6idP60gn7WHdGGKMDSA5v/Zjd1NeFScHk5h9 xjcA== X-Gm-Message-State: AOAM530j96ZjCYmnRU7c7TYz0ObX3rHoqc8iEuApYoLEXNK2S8w/ZSu+ Ye+zY/44xmuELgwtKD4gkxEH7Wd0OVyz/+QblC46iLg4Fn92w1brQu4NFEFeETkFmjeepAo+SaV pfUikCXjX/gO+T4A0 X-Received: by 2002:a1c:f718:: with SMTP id v24mr4275698wmh.186.1641412587834; Wed, 05 Jan 2022 11:56:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKLyMR7EWPMcMqUKLsv/SUK4yc9hw/dZwu0r1t3+PNTDFsALStrJ7HB9N+OaZG6WLmGMiQDQ== X-Received: by 2002:a1c:f718:: with SMTP id v24mr4275692wmh.186.1641412587688; Wed, 05 Jan 2022 11:56:27 -0800 (PST) Received: from pc-1.home (2a01cb058d24940001d1c23ad2b4ba61.ipv6.abo.wanadoo.fr. [2a01:cb05:8d24:9400:1d1:c23a:d2b4:ba61]) by smtp.gmail.com with ESMTPSA id r1sm47880316wrz.30.2022.01.05.11.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 11:56:27 -0800 (PST) Date: Wed, 5 Jan 2022 20:56:25 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Varun Prakash Subject: [PATCH net 3/4] libcxgb: Don't accidentally set RTO_ONLINK in cxgb_find_route() Message-ID: <166c82b4961f0901398e4c1dfde4b9383adfa476.1641407336.git.gnault@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Mask the ECN bits before calling ip_route_output_ports(). The tos variable might be passed directly from an IPv4 header, so it may have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: 804c2f3e36ef ("libcxgb,iw_cxgb4,cxgbit: add cxgb_find_route()") Signed-off-by: Guillaume Nault --- drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c index d04a6c163445..da8d10475a08 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *lldi, rt = ip_route_output_ports(&init_net, &fl4, NULL, peer_ip, local_ip, peer_port, local_port, IPPROTO_TCP, - tos, 0); + tos & ~INET_ECN_MASK, 0); if (IS_ERR(rt)) return NULL; n = dst_neigh_lookup(&rt->dst, &peer_ip); From patchwork Wed Jan 5 19:56:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12704655 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98BEEC433F5 for ; Wed, 5 Jan 2022 19:56:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243783AbiAET4m (ORCPT ); Wed, 5 Jan 2022 14:56:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33742 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243777AbiAET4e (ORCPT ); Wed, 5 Jan 2022 14:56:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641412593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZE/0PMrZWO2x1/w3+hWWU/7F65/qXMf+4hY3YrWAdwo=; b=YvbRid5UtmkOcXh5Axr72nidN9AzCA5motqXA0GtD510uXY7pc8n+mOVLJDT//HDbgGA09 GAP+IfokhMqeRNhkRtXnGR9aw4LCYOyBSofX/tWgzQWNFTVdT5OHHhE8dTILJ4URgY2Iwb NSogkQtw0Pvx23adHz55h5EUkoECXRU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-50-3NgIsbSwOBSETfPKdasbpQ-1; Wed, 05 Jan 2022 14:56:32 -0500 X-MC-Unique: 3NgIsbSwOBSETfPKdasbpQ-1 Received: by mail-wm1-f70.google.com with SMTP id n3-20020a05600c3b8300b00345c3fc40b0so2301253wms.3 for ; Wed, 05 Jan 2022 11:56:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZE/0PMrZWO2x1/w3+hWWU/7F65/qXMf+4hY3YrWAdwo=; b=xTRoaICtCBKbN9ZQQEKUmiK6509jlteoM6O1ghQVxK+jkDB3c0AdKzW4ecSBCjYs/4 3UeyRHG8QcmAeLN7azXTz4ivGU52oS8kR5JMPyUZ1FnAp3hQz6pmwjjDuiiZkdx/TP1X aiUyi6gRvg+mQ1N+tMV32ffzG58XKv14TFnCiWzT2O2uSp3t2ziEnkgPqhf3mz+pzgFQ xYf2N/wi6jjFjf8SJZWDSIbUu60hGNGheu+wM0kZnb63+NdtQntOzl8hyt32RiVo24EQ Y/fY/Cw1L/HpfePt25rppBSgIV873l/dIvhdRZGuegit8IWal0rSck6dZqeX1QipvKDQ DHow== X-Gm-Message-State: AOAM530mRipcs3nubeTadVKMjmfKHVPdnyZeOsUYhwenCYw7tiz6XC/7 H160MoH3FlBAg2S+I9pOyTMltDTk90rSFkN4mcMeg6YSaw7+Qpe4d3I4uVWZxI53EnY3S6birIQ 98JITANnDvfUNy9yZ X-Received: by 2002:a05:6000:1366:: with SMTP id q6mr1884188wrz.551.1641412590723; Wed, 05 Jan 2022 11:56:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4Gcm5HZyFcGx6Uo3mDJoaiWkckllmSvcL5zCVS3l1YkcLkxIs8yLB7NJleBzjW/x/XTIUzA== X-Received: by 2002:a05:6000:1366:: with SMTP id q6mr1884180wrz.551.1641412590590; Wed, 05 Jan 2022 11:56:30 -0800 (PST) Received: from pc-1.home (2a01cb058d24940001d1c23ad2b4ba61.ipv6.abo.wanadoo.fr. [2a01:cb05:8d24:9400:1d1:c23a:d2b4:ba61]) by smtp.gmail.com with ESMTPSA id i12sm42424859wrp.96.2022.01.05.11.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 11:56:29 -0800 (PST) Date: Wed, 5 Jan 2022 20:56:28 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Saeed Mahameed , Leon Romanovsky , Vlad Buslov , Or Gerlitz Subject: [PATCH net 4/4] mlx5: Don't accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Mask the ECN bits before calling mlx5e_route_lookup_ipv4_get(). The tunnel key might have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope). Found by code inspection, compile tested only. Fixes: c7b9038d8af6 ("net/mlx5e: TC preparation refactoring for routing update event") Fixes: 9a941117fb76 ("net/mlx5e: Maximize ip tunnel key usage on the TC offloading path") Signed-off-by: Guillaume Nault --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index a5e450973225..bc5f1dcb75e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* Copyright (c) 2018 Mellanox Technologies. */ +#include #include #include #include @@ -235,7 +236,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, int err; /* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos; + attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl; @@ -350,7 +351,7 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv, int err; /* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos; + attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl;