babeld: Take interface name from "option ifname"
Previously, we were using the name of the section as the interface name, but this has several drawbacks: - no "-" or other special characters are allowed in a section name, preventing some physical interface names to be specified this way (e.g. "tun-topeka" would not work) - it is harder to support default interface options (no interface name) This change is not backward compatible, but a later commit will fix that.
This commit is contained in:
parent
a7a090d12e
commit
06158b911e
1 changed files with 7 additions and 1 deletions
|
@ -102,11 +102,17 @@ babel_config_cb() {
|
|||
}
|
||||
;;
|
||||
"interface")
|
||||
local _ifname
|
||||
config_get _ifname "$section" 'ifname'
|
||||
# Try to resolve the logical interface name
|
||||
unset interface
|
||||
network_get_device interface "$section" || interface="$section"
|
||||
network_get_device interface "$_ifname" || interface="$_ifname"
|
||||
option_cb() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
# "option ifname" is a special option, don't actually
|
||||
# generate configuration for it.
|
||||
[ "$option" = "ifname" ] && return
|
||||
cfg_append "interface $interface ${option//_/-} $value"
|
||||
}
|
||||
# Handle ignore options.
|
||||
|
|
Loading…
Reference in a new issue