diff --git a/omr-6in4/files/etc/init.d/omr-6in4 b/omr-6in4/files/etc/init.d/omr-6in4 index 8153bfb84..5c8c1822a 100755 --- a/omr-6in4/files/etc/init.d/omr-6in4 +++ b/omr-6in4/files/etc/init.d/omr-6in4 @@ -9,8 +9,10 @@ service_triggers() { } reload_service() { - addr=$(ifstatus glorytun | jsonfilter -e '@["ipv4-address"][0].address') - peer=$(ifstatus glorytun | jsonfilter -e '@["route"][0].nexthop') + iface=$(uci -q get glorytun.vpn.dev) + [ -z "$iface" ] && exit 0 + addr=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f1 | tr -d "\n") + peer=$(ip -4 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n") if [ "$addr" != "$(uci -q get network.omr6in4.ipaddr)" ] || [ "$peer" != "$(uci -q get network.omr6in4.peeraddr)" ]; then uci -q batch <<-EOF set network.omr6in4.ipaddr=$addr