From 8ef6dba5a1752e7babc8e8a4ecb13bf3f32e9640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= Date: Tue, 4 Jan 2022 12:02:41 +0100 Subject: [PATCH] fff-babeld: Only select first list entry from router_ip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The router_ip option can be a list of multiple ip addresses. It is also possible to specify a subnet using a CIDR mask. Only a single ip is required for peering interfaces, so select only the first list entry and remove the CIDR mask. Fixes: #197 Signed-off-by: Fabian Bläse --- .../fff/fff-babeld/files/lib/functions/fff/babel | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/packages/fff/fff-babeld/files/lib/functions/fff/babel b/src/packages/fff/fff-babeld/files/lib/functions/fff/babel index 09eda2b3..7a7620b6 100644 --- a/src/packages/fff/fff-babeld/files/lib/functions/fff/babel +++ b/src/packages/fff/fff-babeld/files/lib/functions/fff/babel @@ -38,7 +38,15 @@ babel_add_peeraddr() { uci add_list "$option"="$peer_ip" elif router_ip=$(uci -q get gateway.meta.router_ip); then # use router_ip if no peer_ip is set - uci add_list "$option"="$router_ip" + ip=$router_ip + + # use only first ip + ip=${ip%% *} + + # remove CIDR mask + ip=${ip%%/*} + + uci add_list "$option"="$ip" elif ipaddr=$(uci -q get gateway.@client[0].ipaddr); then # use client interface address (without subnet) if no router_ip is set uci add_list "$option"=$(echo $ipaddr | cut -d / -f1)