Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
34de39ff41 | |||
815acc6600 |
|
@ -38,10 +38,18 @@ babel_add_peeraddr() {
|
||||||
uci add_list "$option"="$peer_ip"
|
uci add_list "$option"="$peer_ip"
|
||||||
elif router_ip=$(uci -q get gateway.meta.router_ip); then
|
elif router_ip=$(uci -q get gateway.meta.router_ip); then
|
||||||
# use router_ip if no peer_ip is set
|
# 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
|
elif ipaddr=$(uci -q get gateway.@client[0].ipaddr); then
|
||||||
# use client interface address (without subnet) if no router_ip is set
|
# 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
|
else
|
||||||
echo "WARNING: No peer_ip, router_ip or client interface ipaddr set! IPv4 routing is not possible."
|
echo "WARNING: No peer_ip, router_ip or client interface ipaddr set! IPv4 routing is not possible."
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user