All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: openvswitch: don't send internal clone attribute to the userspace.
@ 2022-04-04 10:41 Ilya Maximets
  2022-04-05 12:58 ` [ovs-dev] " Aaron Conole
  2022-04-06  1:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Ilya Maximets @ 2022-04-04 10:41 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S. Miller, dev, linux-kernel, Paolo Abeni,
	Pravin B Shelar, Andy Zhou, Yifeng Sun, Ilya Maximets

'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 "<flow match>" "clone(ct(commit),0)"
  # ovs-dpctl dump-flows
  <flow match>, 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
  <flow match>, 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 <i.maximets@ovn.org>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [ovs-dev] [PATCH net] net: openvswitch: don't send internal clone attribute to the userspace.
  2022-04-04 10:41 [PATCH net] net: openvswitch: don't send internal clone attribute to the userspace Ilya Maximets
@ 2022-04-05 12:58 ` Aaron Conole
  2022-04-06  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Aaron Conole @ 2022-04-05 12:58 UTC (permalink / raw)
  To: Ilya Maximets
  Cc: netdev, dev, linux-kernel, Jakub Kicinski, Paolo Abeni, David S. Miller

Ilya Maximets <i.maximets@ovn.org> writes:

> '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 "<flow match>" "clone(ct(commit),0)"
>   # ovs-dpctl dump-flows
>   <flow match>, 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
>   <flow match>, 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 <i.maximets@ovn.org>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: openvswitch: don't send internal clone attribute to the userspace.
  2022-04-04 10:41 [PATCH net] net: openvswitch: don't send internal clone attribute to the userspace Ilya Maximets
  2022-04-05 12:58 ` [ovs-dev] " Aaron Conole
@ 2022-04-06  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-06  1:20 UTC (permalink / raw)
  To: Ilya Maximets
  Cc: netdev, kuba, davem, dev, linux-kernel, pabeni, pshelar, azhou,
	pkusunyifeng

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  4 Apr 2022 12:41:50 +0200 you wrote:
> '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:
> 
> [...]

Here is the summary with links:
  - [net] net: openvswitch: don't send internal clone attribute to the userspace.
    https://git.kernel.org/netdev/net/c/3f2a3050b4a3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-06  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 10:41 [PATCH net] net: openvswitch: don't send internal clone attribute to the userspace Ilya Maximets
2022-04-05 12:58 ` [ovs-dev] " Aaron Conole
2022-04-06  1:20 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.