fff-babeld: Simplify CIDR mask removal

The removal of CIDR masks from ip addresses is changed to utilize
variable substitutions, which simplifies the expression.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
Reviewed-by: Johannes Kimmel <fff@bareminimum.eu>
This commit is contained in:
Fabian Bläse 2022-01-04 12:04:47 +01:00
parent 8ef6dba5a1
commit 51ec3648cf
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ babel_add_peeraddr() {
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)
uci add_list "$option"=${ipaddr%%/*}
else
echo "WARNING: No peer_ip, router_ip or client interface ipaddr set! IPv4 routing is not possible."
return 1