Different types of validation of variable types in /etc/init.d/foo

I see there are different types of checks for validating user config files when a daemon in /etc/init.d/ is called. For example, from /etc/init.d/network:

validate_route_section()
{
  uci_validate_section network route "${1}" \
    'interface:string' \
    'target:cidr4' \
    'netmask:netmask4' \
    'gateway:ip4addr' \
    'metric:uinteger' \
    'mtu:uinteger' \
    'table:or(range(0,65535),string)'
}

What type would I use to allow for extra arguments to be defined by the user?

For example:

extra='-Q -l /var/log/'

Recognized types:
https://git.openwrt.org/?p=project/ubox.git;a=blob;f=validate/validate.c;h=e72b8117ecd8b680778b0f5c7637ed6546a7736b;hb=4c7b720b9c63b826fb9404e454ae54f2ef5649d5#l893

For your extra option you likely want string as it essentially is arbitrary input.

2 Likes

Thanks @jow.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.