[PATCH] netifd: add debug options to uci
Enrico Mioso
mrkiko.rs at gmail.com
Tue Jan 10 02:46:41 PST 2023
Why not be little bit more explicit?
Why not call the options netifd_debug_mask and so on?
Any name would be ok, but I would like two things to be clear at first glance:
- these options influence netifd behaviour
- these are debug-related options
the first being in my opinion more important than the second.
Thanks,
Enrico
Thanks!
Enrico
On Tue, 10 Jan 2023, Florian Eckert wrote:
> Date: Tue, 10 Jan 2023 09:13:15
> From: Florian Eckert <fe at dev.tdt.de>
> To: nbd at nbd.name, hauke at hauke-m.de
> Cc: Eckert.Florian at googlemail.com, openwrt-devel at lists.openwrt.org
> Subject: [PATCH] netifd: add debug options to uci
>
> To simplify netifd development, the logging and debugging options should
> be configured via uci, so we could set this also during boot.
>
> New uci config options in '/etc/config/network':
>
> config globals 'globals'
> option mask '1'
> option level '3'
>
> The following options are available for the individual uci options and are
> given when the service is started.
>
> Option 'mask':
> This option specifies which messages are output on the stderr.
> * SYSTEM = 0
> * DEVICE = 1
> * INTERFACE = 2
> * WIRELESS = 3
>
> In order for the log messages to also appear in the syslog, the output
> of the stderr must be redirected by the netifd.
>
> Option 'level':
> * L_CRIT = 0
> * L_WARNING = 1
> * L_NOTICE = 2
> * L_INFO = 3
> * L_DEBUG = 4
>
> With this option the loglevel of the netifd can be changed. If nothing
> is specified, the level is set to 'notice'.
>
> Signed-off-by: Florian Eckert <fe at dev.tdt.de>
> ---
> .../network/config/netifd/files/etc/init.d/network | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network
> index dc208c4ce0..ffdf470e10 100755
> --- a/package/network/config/netifd/files/etc/init.d/network
> +++ b/package/network/config/netifd/files/etc/init.d/network
> @@ -15,8 +15,19 @@ init_switch() {
> start_service() {
> init_switch
>
> + local mask level debug
> +
> + config_load network
> + config_get level "globals" level
> + config_get mask "globals" mask
> +
> procd_open_instance
> procd_set_param command /sbin/netifd
> + [ -z "${level}" ] || procd_append_param command -l "$level"
> + [ -z "${mask}" ] || {
> + procd_append_param command -d "$mask"
> + procd_set_param stderr 1
> + }
> procd_set_param respawn
> procd_set_param watch network.interface
> [ -e /proc/sys/kernel/core_pattern ] && {
> --
> 2.30.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
More information about the openwrt-devel
mailing list