[OpenWrt-Devel] Using "-" in section names

Baptiste Jonglez bjonglez at illyse.org
Wed Aug 27 12:45:15 EDT 2014


Hi,

I am currently writing an init script using the callback method [1], on
BB-rc3.  However, it does not seem possible to use "-" in a section name,
for instance:

config interface 'tun-test'
       option 'rxcost' '42'


The "config_cb" function never gets called for this section (but
"option_cb" gets called for its options).  I am aware that shell variables
can't have "-" in their name, but it should not matter here, as the
section name is not used as a variable name, only as a variable value.

Is there a reason for disallowing "-" in the section names, or is it a
bug?


Also note that very strange things happen in this case.  Some options from
*other* sections are not parsed when using such a section name.  The full
example is this one:

config interface tinc
        option rtt_max 500
        option 'max_rtt_penalty' '25'
        option split_horizon false
                                        
config interface 'gre-mejis'
        option 'wired' 'true'
        option 'max_rtt_penalty' '60'
        option 'enable_timestamps' 'true'
        option 'rxcost' '45'

The sequence of calls to config_cb() and option_cb() is the following:

config_cb interface tinc
option_cb rtt_max 500
option_cb split_horizon false
option_cb wired true
option_cb max_rtt_penalty 60
option_cb enable_timestamps true
option_cb rxcost 45
config_cb

"config interface gre-mejis" is not parsed, but "option max_rtt_penalty 25"
is not either, while it is in the middle of another section...  This
option is correctly parsed when no "-" is used in the section name.


Thanks,
Baptiste

[1] http://wiki.openwrt.org/doc/devel/config-scripting#callbacks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20140827/f4ba68e7/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list