Skip to contentSkip to conversation

netlink: Allow nl_sset return -EOPNOTSUPP to fallback to do_sset

PATCH RESEND Applied Gang Li 2 participants 2 messages Aug 21, 2023 – Aug 27, 2023

Subsystems (2)
lore
Share & tools
lore

Gang Li

author
#0 lore raw

PATCH RESEND 1/1 netlink: Allow nl_sset return -EOPNOTSUPP to fallback to do_sset

Currently, nl_sset treats any negative value returned by nl_parser (including -EOPNOTSUPP) as 1. Consequently, netlink_run_handler directly calls exit without returning to main and invoking do_sset through ioctl_init.

To fallback to do_sset, this commit allows nl_sset return -EOPNOTSUPP.

Fixes 392b12e ("netlink: add netlink handler for sset (-s)")
---
 netlink/settings.c | 3 +++
 1 file changed, 3 insertions(+)
netlink/settings.c +3 -0
index dda4ac9..2af933d 100644
@@ -1244,6 +1244,9 @@ int nl_sset(struct cmd_context *ctx)
 	nlctx->devname = ctx->devname;
 
 	ret = nl_parser(nlctx, sset_params, NULL, PARSER_GROUP_MSG, msgbuffs);
+	if (ret == -EOPNOTSUPP)
+		return ret;
+
 	if (ret < 0) {
 		ret = 1;
 		goto out_free;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 9 lines · Gang Li

Currently, nl_sset treats any negative value returned by nl_parser (including -EOPNOTSUPP) as 1. Consequently, netlink_run_handler directly calls exit without returning to main and invoking do_sset through ioctl_init.

To fallback to do_sset, this commit allows nl_sset return -EOPNOTSUPP.

Fixes 392b12e ("netlink: add netlink handler for sset (-s)")

Applied, thank you.

I only changed the Fixes tag to commit 6c19c0d559c8 ("netlink: use genetlink ops information to decide about fallback") as that's where the need for special handling of -EOPNOTSUPP started.

Michal