From patchwork Mon Jan 10 13:43:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12708772 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 895D8C433F5 for ; Mon, 10 Jan 2022 13:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233122AbiAJNnP (ORCPT ); Mon, 10 Jan 2022 08:43:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36208 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233090AbiAJNnN (ORCPT ); Mon, 10 Jan 2022 08:43:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641822193; 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=HqnBSXTfxIJCjsZx3Wk7+tVQNXlVcU6X/OIDj2oO8No=; b=L07iI1tjQhEeGV59yi64dnJKJwirvCXllPq6+KPVERccgmtVnpFzJG4M4ZGNhVmzcOYDXA ihq8s4Koq9OtinuJdscZ3Cp+MRwG+jvuoFc9BKnwZJON1pv2CGoMSxFZVAu4xppyPXJs02 Dvw4BRLz1wAaKcXHuo2r+SBdyD+FfzI= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-3c4GV46jP4SXWbmaF9WqyQ-1; Mon, 10 Jan 2022 08:43:10 -0500 X-MC-Unique: 3c4GV46jP4SXWbmaF9WqyQ-1 Received: by mail-wm1-f72.google.com with SMTP id i81-20020a1c3b54000000b003467c58cbddso8561596wma.5 for ; Mon, 10 Jan 2022 05:43:09 -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=HqnBSXTfxIJCjsZx3Wk7+tVQNXlVcU6X/OIDj2oO8No=; b=WrFt/1ulhXi2x5uMPQISfp7g1V6Op5bwzBkEetDRMqljqRnAelrI6XiVeFO6jsjlRz MF/mVG6ibP+uzXquGP4LeD3HxaNWpe6SCy5Wy/tGGuv3irMGgVJYHkPbMZP2BBV7hcXO pI48WvwgKxVDS6l5ubyPqDR5Q+KtluukfN/OpfrR5If8j8s1Rb6aSYeO1O2+t65P2mmc usevKCUcK+XhRdhOLUQb9pHYPU3ygn+uI0jqb5mVn68HVKJQVDARQ9u6aDf6PDy0NXZO Ol8oq05AUX8Cjey2Epr8xMheP+AEBjn+bfYVY1+eY2ACaeodCYscGAaQnQHZtESpMpGS 2BEA== X-Gm-Message-State: AOAM531vTJ9BsYD6QirowOSQ7GYdOTqILumIx2uJvBIF/BXk6VkChCAg EPh1CatbfQUZLy5wPubmZ8intjcp+tnclxuDmGwX50LhAU9WRhIYtQHJNQ6j+gwDcuQujV+IBgv m/BZuIxndivQRlSjc X-Received: by 2002:a5d:6f07:: with SMTP id ay7mr2537914wrb.333.1641822188863; Mon, 10 Jan 2022 05:43:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQg/NvIkDXufpDm7jGrEI2nK7HyQF2YrCuC4T1IiwqZmrmdFQZh9+xFAJGYrshXXrn5L9n5Q== X-Received: by 2002:a5d:6f07:: with SMTP id ay7mr2537903wrb.333.1641822188721; Mon, 10 Jan 2022 05:43:08 -0800 (PST) Received: from pc-4.home (2a01cb058918ce00dd1a5a4f9908f2d5.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:dd1a:5a4f:9908:f2d5]) by smtp.gmail.com with ESMTPSA id l6sm9180738wry.18.2022.01.10.05.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 05:43:08 -0800 (PST) Date: Mon, 10 Jan 2022 14:43:06 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Steffen Klassert , Herbert Xu Subject: [PATCH v2 net 1/4] xfrm: Don't accidentally set RTO_ONLINK in decode_session4() 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 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 84d2361da015..4924b9135c6e 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -3295,7 +3296,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 Mon Jan 10 13:43:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12708773 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 48771C433EF for ; Mon, 10 Jan 2022 13:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233113AbiAJNnQ (ORCPT ); Mon, 10 Jan 2022 08:43:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20947 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233105AbiAJNnO (ORCPT ); Mon, 10 Jan 2022 08:43:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641822193; 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=EnYThBZPxrUDmqaIkuoPjp7ZPZy9lscegV0rhSlNi3O0vcZyB542xwhPxVYlH+6U3I5DXv sqwzi7ZFY4viNq5Ef+LjMWwsXujCY9f5L0pHicmZxqF9u5au44oFzVXc368Svzu3PvvLkz axD+UNMv77AT3np/P6LOPfRMa83CZDk= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-lv8_HBidN6uAzcZ7Z2p3LQ-1; Mon, 10 Jan 2022 08:43:12 -0500 X-MC-Unique: lv8_HBidN6uAzcZ7Z2p3LQ-1 Received: by mail-wr1-f69.google.com with SMTP id w25-20020adf8bd9000000b001a255212b7cso4138040wra.18 for ; Mon, 10 Jan 2022 05:43:12 -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=aO+OqG2ak3zO9CqFc3BHDngULbQjQhJQg6KeaezlweMgMErQOcgRDHZHpydXAkLGvV 7joZrQtMot/A5aiEy4oDuexJt0U2PHgylikOH03+2+yp+mQMFEqOddOUhBwvbd4Q7ovn Dfy3m6b7/dQGS1HKtRgnBkXSJZOsVBikKbO707920Tu+2J/j/kanKBJd224W2kCEwfbz vElRuTHaZUSnBMDhu0yoAXzc4GPfhhTQwzhOYeYnWmKKyWZunWe67e+uxHkQKpZ4qh08 +BsiWsrOzI6N0BXF3PPObf30CKt6CLXgB9T5S+D9WYmFrXWG3YQrs7rBiLG7w1dV7d+i huiw== X-Gm-Message-State: AOAM531GAZTStt5ubaDyoGXkRCWZ5fjoY+ej5CzD7+jmkS/tSpJD5YIk jKFMCV4syxGEvoA/HbINzGZg+IekKxDSud6VUp+RqSmUjFGlEjAe/hZ/X3E7YqY4hJwRxEJCp1l XOz1aW1A1UL4r53CF X-Received: by 2002:a05:600c:4e46:: with SMTP id e6mr22357214wmq.132.1641822191361; Mon, 10 Jan 2022 05:43:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwgPvhtwzMJfslSftacaZiyWZ7tedj9VaxEyhfO0qhSFGkm5wJjTckLirAB6oASbyPWWpr6A== X-Received: by 2002:a05:600c:4e46:: with SMTP id e6mr22357201wmq.132.1641822191236; Mon, 10 Jan 2022 05:43:11 -0800 (PST) Received: from pc-4.home (2a01cb058918ce00dd1a5a4f9908f2d5.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:dd1a:5a4f:9908:f2d5]) by smtp.gmail.com with ESMTPSA id d16sm2548307wrq.27.2022.01.10.05.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 05:43:10 -0800 (PST) Date: Mon, 10 Jan 2022 14:43:09 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Hideaki YOSHIFUJI , David Ahern , wenxu Subject: [PATCH v2 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 Mon Jan 10 13:43:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12708774 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 B634AC433EF for ; Mon, 10 Jan 2022 13:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233095AbiAJNnU (ORCPT ); Mon, 10 Jan 2022 08:43:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51283 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233088AbiAJNnQ (ORCPT ); Mon, 10 Jan 2022 08:43:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641822195; 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=ivV/Gz3phwR+5mZ443uf3cr4LvT0jnHh0S6m9dOeRXRdy6LL+qZP63jHDCu1PTc+++0f9n I1MaTjwIW+gg1Lt5SdYK2QeDgK4+sH/fjoRywT08zuPOdFjySTHPDfaUAdd1WR97e6BrtL vwtXfBK0v3n8rAlsi8N1D86ctXiexYw= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-142-tsnfRgtjNUabYjL6_6K2XA-1; Mon, 10 Jan 2022 08:43:14 -0500 X-MC-Unique: tsnfRgtjNUabYjL6_6K2XA-1 Received: by mail-wr1-f69.google.com with SMTP id e21-20020adf9bd5000000b001a472da8091so4186291wrc.17 for ; Mon, 10 Jan 2022 05:43:14 -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=cZxBpDeA7hYW03EDFjEXxh+CmtZyIwLfRVyk/+PmJUuHb17Ahizk2N2nhrOMO0ixG4 GAaH9zJnzANVmsnLVWuylCS1k6ygs4+csh/1QOu6p33D+vsOIfRel4kwGyDVnybqUhxb 0M+4Ts6sUmAebCUh+Bhc5hFAOGf43apIZiVYFjaxBSuNTc1A3+0yMs2oWlO8P75juKLa ae/iw9g8Z5nznuJFbgfUpUnAppOED0cNLEjCFTfO71y9THWtISbQzL6tItxnZR4E9bvT hvLsaDPUJbc9jOLDrRlOG/agKTq3c91RIa5YLxUt1qJpdhzVjN3qHLswAFihHvEfvCnV jfLw== X-Gm-Message-State: AOAM533/MkaACwxVH4lgRvD86WdSzOHI2pjYjnY2kA3YecwpiMWDDVVm KrgbBThp6HUFstWQD7UK5j06SZn7m4kS/mLIFi7P4lMW6CqIkhukhhjG41ZtBvLDSy73pJ6WuMw 71V7zmxfA/OsUEv7f X-Received: by 2002:a05:600c:4111:: with SMTP id j17mr1319217wmi.7.1641822193446; Mon, 10 Jan 2022 05:43:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsXJct+7omDJzgv180JxuNQ74NA77CLLTorQxsAOeeVtFldqYIx6cW8pFeRhyQ9chBiUZ2fQ== X-Received: by 2002:a05:600c:4111:: with SMTP id j17mr1319208wmi.7.1641822193315; Mon, 10 Jan 2022 05:43:13 -0800 (PST) Received: from pc-4.home (2a01cb058918ce00dd1a5a4f9908f2d5.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:dd1a:5a4f:9908:f2d5]) by smtp.gmail.com with ESMTPSA id r19sm5820461wmh.42.2022.01.10.05.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 05:43:12 -0800 (PST) Date: Mon, 10 Jan 2022 14:43:11 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Varun Prakash Subject: [PATCH v2 net 3/4] libcxgb: Don't accidentally set RTO_ONLINK in cxgb_find_route() 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 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 Mon Jan 10 13:43:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 12708775 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 85A18C433FE for ; Mon, 10 Jan 2022 13:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233088AbiAJNnV (ORCPT ); Mon, 10 Jan 2022 08:43:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31783 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233136AbiAJNnT (ORCPT ); Mon, 10 Jan 2022 08:43:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641822199; 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=gedU7/lCEV5KRacQZvFXcblNAo/UXBPDR+naPHwvLWSpP9xAPHHj8k93PxKDR4ZFzHcd/r ARhymAL6H3WiqO0EOb/sQQoXMVYKR94wpMmmIewH9ixcqk4QeSIzkmyHktrJYMLO8WFIST L+u7gGNQ7XT8SQlRjyqA1NdhsD1n3H4= 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-436-3EHD-tYCMGaDWlHkVyT-Hg-1; Mon, 10 Jan 2022 08:43:18 -0500 X-MC-Unique: 3EHD-tYCMGaDWlHkVyT-Hg-1 Received: by mail-wm1-f69.google.com with SMTP id az9-20020a05600c600900b0034692565ca8so7903813wmb.9 for ; Mon, 10 Jan 2022 05:43:17 -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=7FYjOvkWmaj53+HtcjPw9p7xu6Aag7BaFS+/neklK4YWtWUIeckH3GOmFpriXHenCP AtPGxMaCZKJZfzS83vIAUaOUaUvQmGepUBED9nlzxCWuU98kxo/UjE/X99cYwwhkzZad taZOg6ZfYXFQGKFgqUDgq/ak1OR+siDe87s+csj/xMohzW2oNdutj1bhYeW46ZEAIaW7 XHrhMGRxVqiOPVCPiW0iXAGKTqlpOl+LSMPHlzWK07lGNjTIk19oQ8uUG4w6O15cmcSR WfgbxgLMrhwecJ/0JxpQJLOqbHW3UJ4k2KX35qxiajeM7kgRZouoEpIzfz1KjECbarO4 7IEA== X-Gm-Message-State: AOAM531FBpX1ZGsB25QaklaU1Z/OJCShhok5aI9XQIVVc2JFxUWrzXRE D7GKuu3XP0kr4hqAbb4YVEbQkNeyedoLyQjc8RO24Ghr21/jFXeqD+UQIm/XpEB4psKKjj0ELmV 1y8+cHi/rg5HjgifH X-Received: by 2002:a05:600c:1d95:: with SMTP id p21mr9565494wms.9.1641822196640; Mon, 10 Jan 2022 05:43:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgHin43f7vvFbvDBL3j7iDsg0f0CMJ5VDZDD69+y7eb6JgK4s7rE4/RSKkrSdGwUpu2PSM4A== X-Received: by 2002:a05:600c:1d95:: with SMTP id p21mr9565487wms.9.1641822196500; Mon, 10 Jan 2022 05:43:16 -0800 (PST) Received: from pc-4.home (2a01cb058918ce00dd1a5a4f9908f2d5.ipv6.abo.wanadoo.fr. [2a01:cb05:8918:ce00:dd1a:5a4f:9908:f2d5]) by smtp.gmail.com with ESMTPSA id m39sm6720316wms.33.2022.01.10.05.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 05:43:16 -0800 (PST) Date: Mon, 10 Jan 2022 14:43:14 +0100 From: Guillaume Nault To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, Saeed Mahameed , Leon Romanovsky , Vlad Buslov , Or Gerlitz Subject: [PATCH v2 net 4/4] mlx5: Don't accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get() Message-ID: <71c755ca1949c8b6963fb8391737d787e1e83aa4.1641821242.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 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;