Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3664019pxb; Mon, 24 Jan 2022 14:48:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXqdjYlAXh1g48UBlzUiDewIvq06aOlfgI+nfV0uf5YZryisz3GFj/qkM8/vH9mrhj3cML X-Received: by 2002:a63:d59:: with SMTP id 25mr1272195pgn.404.1643064512618; Mon, 24 Jan 2022 14:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064512; cv=none; d=google.com; s=arc-20160816; b=vHROGjVwSuDrCoztEOh4muMY0hgYLisV6RkeFnVBmvuj9lgadduZOdUam2udU+QnAT g9sW0uEuNhwFqj3pyupAxBXFoFGdhI66NDDwLcA5StAWyakMbMcILO2waC6BScyquiU3 QAX2nKFWjXN9/OObTugAy8qxZ5dMo4Fg8G4bDfURYzcC+nDxw587veYeL+akWmZl35pc Fdp+zeSAOQSDXWIB4pG2kfC95LCJaV1+kC4InE24QDMVKSPdwwx9+XbmBWv3jqqro8DQ qk5/cZE3NOxn4CK/WRfSOuw1TYZmn67eBtXnG6Z5GsNE0IisV4BSpgqwlsgN1ZugHiPp rl/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JnXB6dLPAiFwOf+nNDuBuInQ/+jZ7ZezV0a1/tCoLC4=; b=dfO+fP5QwHOPWtQLRFUYIg63nXwBrJdeQgWQfIXOG61NVdJGlYWHBbaKLsruthyRjZ m+ppuFz21YX2xWStbzJQWKkqDE3VT5tu7Z3kuQasAGXwUa0jfZBqSbboMo/OX12hMArJ u7D7gkm0GRAmyVoQasWqw3qIguZlpvAIM0MC4t9AgmI+Lb3FeMGaZJlLR6lLzWIHpoUo VhgzL++pUnxzfatRGixgLKn+DjhjWVP+eJAumvj/mRM5OwAtESwiYKr6lYhekvUT7T3Y JeeLVaVdEDjQq3HpufxBRQbUdnCmVoJF9+oqEx6+hsiYCMOTyzOQYoRExun5B7lpfxH7 G7Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kRiKaOKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ip1si584215pjb.14.2022.01.24.14.48.20; Mon, 24 Jan 2022 14:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kRiKaOKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838329AbiAXWqX (ORCPT + 99 others); Mon, 24 Jan 2022 17:46:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457579AbiAXVly (ORCPT ); Mon, 24 Jan 2022 16:41:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1635EC07E336; Mon, 24 Jan 2022 12:29:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFE5BB8122A; Mon, 24 Jan 2022 20:29:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BBADC340E5; Mon, 24 Jan 2022 20:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056179; bh=lq3hf89fjyCLhDkpQ9WdaE1sdfeZJVi7g3LIOu5gNf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRiKaOKe7iNwfZe5gMAiXnblL4J0Hlz27WoZVg489kN21IZLH1ISxWf1V8qVanW1n YHGtTpArQSUpjDUhTqX0UFCD2hFwWDnnF6whvwVcsv70qSaRofpIxMQeR1b8dNMVTW 6opLLijQjuuEciLWwaCmri3p3gIbc17MJahWn2Ho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Blakey , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 365/846] net: openvswitch: Fix matching zone id for invalid conns arriving from tc Date: Mon, 24 Jan 2022 19:38:02 +0100 Message-Id: <20220124184113.531656257@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Blakey [ Upstream commit 635d448a1cce4b4ebee52b351052c70434fa90ea ] Zone id is not restored if we passed ct and ct rejected the connection, as there is no ct info on the skb. Save the zone from tc skb cb to tc skb extension and pass it on to ovs, use that info to restore the zone id for invalid connections. Fixes: d29334c15d33 ("net/sched: act_api: fix miss set post_ct for ovs after do conntrack in act_ct") Signed-off-by: Paul Blakey Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- include/linux/skbuff.h | 1 + net/openvswitch/flow.c | 8 +++++++- net/sched/cls_api.c | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 4f31ca71a82a7..f92839b726dc2 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -286,6 +286,7 @@ struct nf_bridge_info { struct tc_skb_ext { __u32 chain; __u16 mru; + __u16 zone; bool post_ct; }; #endif diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 9713035b89e3a..6d262d9aa10ea 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "conntrack.h" #include "datapath.h" @@ -860,6 +861,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, #endif bool post_ct = false; int res, err; + u16 zone = 0; /* Extract metadata from packet. */ if (tun_info) { @@ -898,6 +900,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, key->recirc_id = tc_ext ? tc_ext->chain : 0; OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; post_ct = tc_ext ? tc_ext->post_ct : false; + zone = post_ct ? tc_ext->zone : 0; } else { key->recirc_id = 0; } @@ -906,8 +909,11 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, #endif err = key_extract(skb, key); - if (!err) + if (!err) { ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ + if (post_ct && !skb_get_nfct(skb)) + key->ct_zone = zone; + } return err; } diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index ff8a9383bf1c4..35c74bdde848e 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1625,6 +1625,7 @@ int tcf_classify(struct sk_buff *skb, ext->chain = last_executed_chain; ext->mru = cb->mru; ext->post_ct = cb->post_ct; + ext->zone = cb->zone; } return ret; -- 2.34.1