Add runtime support for disabling netlink
Subsystems (2)
PATCH 1/2 Add runtime support for disabling netlink
Provide --disable-netlink option for disabling netlink during runtime, without the need to recompile the binary.
Signed-off-by Krzysztof Piotr Oledzki <[email protected]>
--- ethtool.8.in | 6 ++++++ ethtool.c | 6 ++++++ internal.h | 1 + netlink/netlink.c | 5 +++++ 4 files changed, 18 insertions(+)
ethtool.8.in +6 -0
@@ -137,6 +137,9 @@ ethtool \- query or control network driver and hardware settings .BN --debug .I args .HP +.B ethtool [--disable-netlink] +.I args +.HP .B ethtool [--json] .I args .HP
@@ -579,6 +582,9 @@ lB l. 0x10 Structure of netlink messages .TE .TP +.BI \-\-disable-netlink +Do not use netlink and fall back to the ioctl interface if possible. +.TP .BI \-\-json Output results in JavaScript Object Notation (JSON). Only a subset of options support this. Those which do not will continue to output
ethtool.c +6 -0
@@ -6537,6 +6537,12 @@ int main(int argc, char **argp) argc -=2 ;continue ; } +if (*argp && !strcmp (*argp,"--disable-netlink" )) { + ctx.nl_disable = true; + argp +=1 ; + argc -=1 ; +continue ; + }if (*argp && !strcmp (*argp,"--json" )) { ctx.json = true; argp +=1 ;
internal.h +1 -0
@@ -221,6 +221,7 @@ struct cmd_context {char **argp;/* arguments to the sub-command */ unsigned long debug;/* debugging mask */ bool json;/* Output JSON, if supported */ +bool nl_disable;/* Disable netlink even if available */ bool show_stats;/* include command-specific stats */ #ifdef ETHTOOL_ENABLE_NETLINK struct nl_context *nlctx;/* netlink context (opaque) */
netlink/netlink.c +5 -0
@@ -470,6 +470,11 @@ void netlink_run_handler(struct cmd_context *ctx, nl_chk_t nlchk,const char *reason;int ret; +if (ctx->nl_disable) { + reason ="netlink disabled" ; + goto no_support; + } +if (nlchk && !nlchk (ctx)) { reason ="ioctl-only request" ; goto no_support;
Signature · 1 line
2.46.0
This series was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:
Hello:
This series was applied to ethtool/ethtool.git (master) by Michal Kubecek <[email protected]>:
Quoted 10 lines · On Wed, 11 Sep 2024 23:56:45 -0700 you wrote:
Provide --disable-netlink option for disabling netlink during runtime, without the need to recompile the binary.
Signed-off-by Krzysztof Piotr Oledzki <[email protected]>--- ethtool.8.in | 6 ++++++ ethtool.c | 6 ++++++ internal.h | 1 + netlink/netlink.c | 5 +++++ 4 files changed, 18 insertions(+)
Here is the summary with links:
- [ethtool,1/2] Add runtime support for disabling netlink
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=6e3ac505bcc7 - [ethtool,2/2] qsf: Better handling of Page A2h netlink read failure https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=814980faaef1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html