Repository : ssh://git@open-mesh.org/openwrt-feed-devel
On branch : master
commit 9016955b0b0ddd4209680ec50b14b5c9a916ecb4 Author: Sven Eckelmann sven@narfation.org Date: Thu Aug 1 20:58:41 2019 +0200
alfred-devel: Support multiple listening interfaces
The alfred daemon allows to be started with multiple interfaces. The first interface is used for communication and to calculate the source mac address. The rest of the interfaces are only used for communication.
Signed-off-by: Sven Eckelmann sven@narfation.org
9016955b0b0ddd4209680ec50b14b5c9a916ecb4 alfred-devel/files/alfred.config | 2 +- alfred-devel/files/alfred.init | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/alfred-devel/files/alfred.config b/alfred-devel/files/alfred.config index 9d3fff6..704adf1 100644 --- a/alfred-devel/files/alfred.config +++ b/alfred-devel/files/alfred.config @@ -1,5 +1,5 @@ config 'alfred' 'alfred' - option interface 'br-lan' + list interface 'br-lan' option mode 'master' option batmanif 'bat0' option start_vis '1' diff --git a/alfred-devel/files/alfred.init b/alfred-devel/files/alfred.init index 89e33ab..e5d2006 100755 --- a/alfred-devel/files/alfred.init +++ b/alfred-devel/files/alfred.init @@ -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