forked from freifunk-franken/firmware
fff-babeld: Only select first list entry from router_ip
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 <fabian@blaese.de>
This commit is contained in:
parent
a6b90f1a83
commit
8ef6dba5a1
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user