1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix omr-6in4 init

This commit is contained in:
Ycarus 2018-05-30 11:32:56 +02:00
parent fe39ad4d90
commit e11e60bc5d

View file

@ -9,8 +9,10 @@ service_triggers() {
} }
reload_service() { reload_service() {
addr=$(ifstatus glorytun | jsonfilter -e '@["ipv4-address"][0].address') iface=$(uci -q get glorytun.vpn.dev)
peer=$(ifstatus glorytun | jsonfilter -e '@["route"][0].nexthop') [ -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 if [ "$addr" != "$(uci -q get network.omr6in4.ipaddr)" ] || [ "$peer" != "$(uci -q get network.omr6in4.peeraddr)" ]; then
uci -q batch <<-EOF uci -q batch <<-EOF
set network.omr6in4.ipaddr=$addr set network.omr6in4.ipaddr=$addr