Skip to contentSkip to conversation

rxclass: Fix return code in rxclass_rule_ins

PATCH Applied David Ahern 3 participants 3 messages May 3, 2023 – May 7, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
---
 rxclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rxclass.c +1 -1
index 6cf81fdafc85..66cf00ba7728 100644
@@ -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)
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: David Ahern <[email protected]>
Sent: Wednesday, May 3, 2023 9:51 AM
To: [email protected]
Cc: [email protected]; David Ahern <[email protected]>; Alexander Duyck <[email protected]>
Subject: [PATCH ethtool] rxclass: Fix return code in rxclass_rule_ins

Quoted 1 line

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 <[email protected]>
---
 rxclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rxclass.c +1 -2
index 6cf81fdafc85..66cf00ba7728 100644
@@ -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)
--
Quoted 1 line

2.25.1

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

#2 lore raw
In reply to David Ahern
This patch was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:

Hello:

This patch was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:

Quoted 8 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html