diff mbox series

[ethtool] rxclass: Fix return code in rxclass_rule_ins

Message ID 20230503165106.9584-1-dsahern@kernel.org (mailing list archive)
State Accepted
Commit 67c9ebf907d4c65fcb250450cd6cf16ff6e1ed23
Delegated to: Michal Kubecek
Headers show
Series [ethtool] rxclass: Fix return code in rxclass_rule_ins | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

David Ahern May 3, 2023, 4:51 p.m. UTC
ethtool is not exiting non-0 when -N fails. e.g.,

$ sudo ethtool -N eth0 flow-type tcp4 src-ip 1.2.3.4 action 3 loc 1023
rmgr: Cannot insert RX class rule: No such device
$ echo $?
0

Update rxclass_rule_ins to return err.

Fixes: 8d63f72ccdcb ("Add RX packet classification interface")
Cc: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
---
 rxclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Duyck May 3, 2023, 6:27 p.m. UTC | #1
> -----Original Message-----
> From: David Ahern <dsahern@kernel.org>
> Sent: Wednesday, May 3, 2023 9:51 AM
> To: mkubecek@suse.cz
> Cc: netdev@vger.kernel.org; David Ahern <dsahern@kernel.org>; Alexander
> Duyck <alexanderduyck@meta.com>
> Subject: [PATCH ethtool] rxclass: Fix return code in rxclass_rule_ins
> 
> > 
> ethtool is not exiting non-0 when -N fails. e.g.,
> 
> $ sudo ethtool -N eth0 flow-type tcp4 src-ip 1.2.3.4 action 3 loc 1023
> rmgr: Cannot insert RX class rule: No such device $ echo $?
> 0
> 
> Update rxclass_rule_ins to return err.
> 
> Fixes: 8d63f72ccdcb ("Add RX packet classification interface")
> Cc: Alexander Duyck <alexanderduyck@fb.com>
> Signed-off-by: David Ahern <dsahern@kernel.org>
> ---
>  rxclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rxclass.c b/rxclass.c
> index 6cf81fdafc85..66cf00ba7728 100644
> --- a/rxclass.c
> +++ b/rxclass.c
> @@ -598,7 +598,7 @@ int rxclass_rule_ins(struct cmd_context *ctx,
>  	else if (loc & RX_CLS_LOC_SPECIAL)
>  		printf("Added rule with ID %d\n", nfccmd.fs.location);
> 
> -	return 0;
> +	return err;
>  }
> 
>  int rxclass_rule_del(struct cmd_context *ctx, __u32 loc)
> --
> 2.25.1

Yeah, looks like it was a brain-o on my part that I just went straight to return 0.

Acked-by: Alexander Duyck <alexanderduyck@fb.com>
patchwork-bot+netdevbpf@kernel.org May 7, 2023, 10:40 p.m. UTC | #2
Hello:

This patch was applied to ethtool/ethtool.git (master)
by Michal Kubecek <mkubecek@suse.cz>:

On Wed,  3 May 2023 10:51:06 -0600 you wrote:
> ethtool is not exiting non-0 when -N fails. e.g.,
> 
> $ sudo ethtool -N eth0 flow-type tcp4 src-ip 1.2.3.4 action 3 loc 1023
> rmgr: Cannot insert RX class rule: No such device
> $ echo $?
> 0
> 
> [...]

Here is the summary with links:
  - [ethtool] rxclass: Fix return code in rxclass_rule_ins
    https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=67c9ebf907d4

You are awesome, thank you!
diff mbox series

Patch

diff --git a/rxclass.c b/rxclass.c
index 6cf81fdafc85..66cf00ba7728 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -598,7 +598,7 @@  int rxclass_rule_ins(struct cmd_context *ctx,
 	else if (loc & RX_CLS_LOC_SPECIAL)
 		printf("Added rule with ID %d\n", nfccmd.fs.location);
 
-	return 0;
+	return err;
 }
 
 int rxclass_rule_del(struct cmd_context *ctx, __u32 loc)