Re: [PATCH net] tun: fix ethtool_ops get_msglvl and set_msglvl handlers
From: David Miller
Date: Tue Mar 03 2020 - 17:59:19 EST
From: Michal Kubecek <mkubecek@xxxxxxx>
Date: Tue, 3 Mar 2020 09:22:52 +0100 (CET)
> The get_msglvl and setmsglvl handlers only work as expected if TUN_DEBUG
> is defined (which required editing the source). Otherwise tun_get_msglvl()
> returns -EOPNOTSUPP but as this handler is not supposed to return error
> code, it is not recognized as one and passed to userspace as is, resulting
> in bogus output of ethtool command. The set_msglvl handler ignores its
> argument and does nothing if TUN_DEBUG is left undefined.
>
> The way to return EOPNOTSUPP to userspace for both requests is not to
> provide these ethtool_ops callbacks at all if TUN_DEBUG is left undefined.
>
> Signed-off-by: Michal Kubecek <mkubecek@xxxxxxx>
I agree with your analysis.
But this TUN_DEBUG thing stands outside of what we let drivers do. Either
this tracing is not so useful and can be deleted, or the tracing should
be available unconditionally so that it can be turned on by the vast
majority of users who do not edit the source.
I suspect making the TUN_DEBUG code unconditional is that way to go here.