Use UCI config_get_bool enabled
instead of config_get enabled
#24187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Maintainer: @myszsoda @csonsino @1715173329 @dangowrt @ysc3839 @feckert @blocktrron
Run tested: VirtualBox, but tested only the one
Description:
When reading an
enabled
option from the UCI config we should use the config_get_bool function instead of justconfig_get
. The reason is because a user may not remember and put not just the1
buton
,yes
,true
orenabled
.To avoid potential problems and to make all the code looking similar I changed all places from the
config_get enabled
toconfig_get_bool enabled
. Other boolean options may also need for the change. The only place that I didn't changed in tor-hs package because this fixed in #21642Another potential problem is that some UCI configs use the option name
enable
instead of more widelly usedenabled
.A user may type
enabled
and be wondered why it doesn't have any effect.We have seven places which are using the
enable
:We may add an additonal call to
config_get_bool enabled
and deprecate the oldoption enable
but I believe this is minor thing. We just have to check for this error during a code review to not allow for a new code that uses theenable
.