alfred: Support multiple listening interfaces
[feed/routing.git] / alfred / files / alfred.init
index 89e33ab55a0bd301fcd6ae490a5e93b7f92c2bd2..e5d200661e32a8037665b23c2f96bbcba8179804 100755 (executable)
@@ -54,10 +54,17 @@ wait_for_ll_address() {
        exit 1
 }
 
+append_interface()
+{
+       append "interfaces" "$1" ","
+       wait_for_ll_address "$1"
+}
+
 alfred_start() {
        local args=""
        local section="$1"
        local disabled interface mode
+       local interfaces
 
        # check if section is disabled
        config_get_bool disabled "$section" disabled 0
@@ -65,8 +72,12 @@ alfred_start() {
 
        args=""
 
-       config_get interface "$section" interface
-       append args "-i $interface"
+       config_list_foreach "$section" "interface" append_interface
+       if [ -z "$interfaces" ]; then
+               config_get interface "$section" interface
+               append_interface "$interface"
+       fi
+       append args "-i $interfaces"
 
        config_get mode "$section" mode
        [ "$mode" = "master" ] && append args "-m"
@@ -78,8 +89,6 @@ alfred_start() {
                wait_for_dir "$batmanif" "/sys/class/net/$batmanif/mesh"
        fi
 
-       wait_for_ll_address "$interface"
-
        append alfred_args "$args"
        enable=1