Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3520740pxb; Mon, 4 Apr 2022 19:43:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMxkXa3m953bLP/UzQ7u5agDd4uKsEyDk4N2+6rBGb0DTQ6Oa9Yja4z78/OsaVRs2E0iq3 X-Received: by 2002:a17:902:ced0:b0:153:f78e:c43f with SMTP id d16-20020a170902ced000b00153f78ec43fmr1302960plg.64.1649126621802; Mon, 04 Apr 2022 19:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649126621; cv=none; d=google.com; s=arc-20160816; b=Ae7ULRqpy7jjcgoDnOH8CfDUsaZCW2nZRwYTdTpcSIxADIyyQfIkPCn0dipgucatOk UjjuLHSf3YZkAfjD7gdJfr/sqYEuoP54lPsbEWU8F9X2ALUk1SF70mk6uCXgt5PBIfbO LiXIWFPfMNAQ0+atlm6OSESmxg+qrjDZ1bK5RnAzeKsLCi3yKIDrcJZpq6q3UeKrkgxU ERguJ0IyHb4JgmixIQa0uv2iVEW3+yLM6EHW+ib309lUNykTFoY739ZdwDAFparT/8yJ D2rI8ieec4DWb+lhRgF70Pb8YkugYx0dRs7a3EMc6sNoGJ5U99xlO+BqF1TPPB+usbQl M3zg== 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 :message-id:date:subject:cc:to:from; bh=VeNXJ53+4vFMiDGDQh12L1PXgkPn6awQIHuEnaratZc=; b=Gx71iYBSRXk+kDtv10AlWdLMhKLBf2dJ/1xFqtce74NGd0fYrgewcsLPhxJ5YKCeQV 74RosQxsgXpUv46Tdni3sJtV/sD/N9U8qcin7yoCnFBh0qZ5vWIzSHbzXCCLLarUN7Lh 7ynpHTDu6oVLAGCzD1hywOjUjZ9oQaGyRK3F88q51tXk4BgL7E70Ss3MeGzBWzOrmpQW rzmCqP+yy7NVw2+ACQP1vUmdQiFAGF678eU4L6RDmln8ceLdOVR8tZhrwAwXI3ZOXj6k jqkCNF8Ove/a+3rIhHygFTFfytCPzm+6wXPLPeS5dabPCnAcfQ6DquFfwbl2Y6KPTLWR +1UA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i20-20020aa78b54000000b004fae16c6a7fsi10719226pfd.167.2022.04.04.19.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:43:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4D67F147AE7; Mon, 4 Apr 2022 18:07:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357901AbiDDKn4 (ORCPT + 99 others); Mon, 4 Apr 2022 06:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245317AbiDDKnz (ORCPT ); Mon, 4 Apr 2022 06:43:55 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BBED3CA77; Mon, 4 Apr 2022 03:41:59 -0700 (PDT) Received: (Authenticated sender: i.maximets@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id E15841C000C; Mon, 4 Apr 2022 10:41:54 +0000 (UTC) From: Ilya Maximets To: netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , dev@openvswitch.org, linux-kernel@vger.kernel.org, Paolo Abeni , Pravin B Shelar , Andy Zhou , Yifeng Sun , Ilya Maximets Subject: [PATCH net] net: openvswitch: don't send internal clone attribute to the userspace. Date: Mon, 4 Apr 2022 12:41:50 +0200 Message-Id: <20220404104150.2865736-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'OVS_CLONE_ATTR_EXEC' is an internal attribute that is used for performance optimization inside the kernel. It's added by the kernel while parsing user-provided actions and should not be sent during the flow dump as it's not part of the uAPI. The issue doesn't cause any significant problems to the ovs-vswitchd process, because reported actions are not really used in the application lifecycle and only supposed to be shown to a human via ovs-dpctl flow dump. However, the action list is still incorrect and causes the following error if the user wants to look at the datapath flows: # ovs-dpctl add-dp system@ovs-system # ovs-dpctl add-flow "" "clone(ct(commit),0)" # ovs-dpctl dump-flows , packets:0, bytes:0, used:never, actions:clone(bad length 4, expected -1 for: action0(01 00 00 00), ct(commit),0) With the fix: # ovs-dpctl dump-flows , packets:0, bytes:0, used:never, actions:clone(ct(commit),0) Additionally fixed an incorrect attribute name in the comment. Fixes: b233504033db ("openvswitch: kernel datapath clone action") Signed-off-by: Ilya Maximets --- net/openvswitch/actions.c | 2 +- net/openvswitch/flow_netlink.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 7056cb1b8ba0..1b5d73079dc9 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -1051,7 +1051,7 @@ static int clone(struct datapath *dp, struct sk_buff *skb, int rem = nla_len(attr); bool dont_clone_flow_key; - /* The first action is always 'OVS_CLONE_ATTR_ARG'. */ + /* The first action is always 'OVS_CLONE_ATTR_EXEC'. */ clone_arg = nla_data(attr); dont_clone_flow_key = nla_get_u32(clone_arg); actions = nla_next(clone_arg, &rem); diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index cc282a58b75b..dbdcaaa27f5b 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c @@ -3458,7 +3458,9 @@ static int clone_action_to_attr(const struct nlattr *attr, if (!start) return -EMSGSIZE; - err = ovs_nla_put_actions(nla_data(attr), rem, skb); + /* Skipping the OVS_CLONE_ATTR_EXEC that is always the first attribute. */ + attr = nla_next(nla_data(attr), &rem); + err = ovs_nla_put_actions(attr, rem, skb); if (err) nla_nest_cancel(skb, start); -- 2.34.1