summaryrefslogtreecommitdiff
path: root/babeld
diff options
context:
space:
mode:
authorBaptiste Jonglez <baptiste--git@jonglez.org>2014-08-29 08:43:17 +0200
committerBaptiste Jonglez <baptiste--git@jonglez.org>2014-08-29 10:19:42 +0200
commit539de92a4c672937b2bae5448c4b20357c3a600f (patch)
tree7ff6ce4b47827083231d58214bc43dc61097d664 /babeld
parenta4f5570e79665ce41558ddbd4175dfc84e198744 (diff)
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.
Diffstat (limited to 'babeld')
-rwxr-xr-xbabeld/files/babeld.init8
1 files changed, 7 insertions, 1 deletions
diff --git a/babeld/files/babeld.init b/babeld/files/babeld.init
index ea4b348..cb98e39 100755
--- a/babeld/files/babeld.init
+++ b/babeld/files/babeld.init
@@ -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.