mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix omr-6in4 when using static glorytun IP
This commit is contained in:
parent
c44de403b5
commit
d37bdd9c85
1 changed files with 4 additions and 2 deletions
|
@ -4,15 +4,17 @@
|
|||
while true; do
|
||||
if [ "$(uci -q get glorytun.vpn.enable)" = "1" ]; then
|
||||
iface=$(uci -q get glorytun.vpn.dev)
|
||||
addr=$(uci -q get glorytun.vpn.localip)
|
||||
peer=$(uci -q get glorytun.vpn.remoteip)
|
||||
elif [ "$(uci -q get mlvpn.general.enable)" = "1" ]; then
|
||||
iface=$(uci -q get mlvpn.general.interface_name)
|
||||
elif [ "$(uci -q get openvpn.omr.enabled)" = "1" ]; then
|
||||
iface=$(uci -q get openvpn.omr.dev)
|
||||
fi
|
||||
addr=$(ubus call network.interface.omrvpn status | jsonfilter -q -e '@["ipv4-address"][0].address' | tr -d "\n")
|
||||
[ -z "$addr" ] && addr=$(ubus call network.interface.omrvpn status | jsonfilter -q -e '@["ipv4-address"][0].address' | tr -d "\n")
|
||||
if [ -d "/sys/class/net/$iface" ]; then
|
||||
[ -z "$addr" ] && [ -n "$iface" ] && addr=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f1 | tr -d "\n")
|
||||
peer=$(ubus call network.interface.omrvpn status | jsonfilter -q -e '@.route[0].nexthop' | tr -d "\n")
|
||||
[ -z "$peer" ] && peer=$(ubus call network.interface.omrvpn status | jsonfilter -q -e '@.route[0].nexthop' | tr -d "\n")
|
||||
[ -z "$peer" ] && [ -n "$iface" ] && peer=$(ip -4 r list dev $iface | grep kernel | awk '/proto kernel/ {print $1}' | grep -v / | tr -d "\n")
|
||||
[ -n "$addr" ] && [ -n "$peer" ] && {
|
||||
if [ "$addr" != "$(uci -q get network.omr6in4.ipaddr)" ] || [ "$peer" != "$(uci -q get network.omr6in4.peeraddr)" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue