[OpenWrt-Devel] [PATCH v3] base-files: make wifi report unknown command

Jonas Gorski jonas.gorski at gmail.com
Thu Aug 9 13:58:42 EDT 2018


On 9 August 2018 at 18:49, Thibaut VARÈNE <hacks at slashdirt.org> wrote:
> Avoid having /sbin/wifi silently ignore unknown keywords and execute
> "enable"; instead display the help message and exit with an error.
>
> Spell out the 'enable' keyword and preserve the implicit assumption
> that runing /sbin/wifi without argument performs "enable".
>
> Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
> ---

Please keep a changelog here to know what's changed between submissions.

>  package/base-files/files/sbin/wifi | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi
> index 83befc0d6f..68536ed25f 100755
> --- a/package/base-files/files/sbin/wifi
> +++ b/package/base-files/files/sbin/wifi
> @@ -241,5 +241,6 @@ case "$1" in
>         reload) wifi_reload "$2";;
>         reload_legacy) wifi_reload_legacy "$2";;
>         --help|help) usage;;
> -       *) ubus call network reload; wifi_updown "enable" "$2";;
> +       ''|enable) ubus call network reload; wifi_updown "enable" "$2";;

Not that I particularily want to bikeshed here, but the disable
command is "down", so the enable command should be "up", not "enable".

There are actually existing users of "up": see

https://github.com/openwrt/openwrt/blob/master/package/network/config/netifd/files/sbin/ifup#L43

and

https://github.com/openwrt/openwrt/blob/master/package/network/config/netifd/files/sbin/ifup#L75

or

https://github.com/openwrt/openwrt/blob/master/package/base-files/files/etc/rc.button/rfkill#L30

so it isn't just a should, it's a must. Or the existing users must be
changed before.

> +       *) usage; exit 1;;
>  esac


Regards
Jonas

_______________________________________________
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