1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

Fix disabling pihole when VPN is down

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-09-19 10:28:58 +02:00
parent ef0040e56f
commit 6ac3d8c200
2 changed files with 15 additions and 15 deletions

View file

@ -10,6 +10,21 @@
interface_up=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["up"]')
disable_pihole() {
local server=$1
if [ -n "$(uci -q get dhcp.@dnsmasq[0].server | grep '#53' | grep '10.255.25')" ]; then
_log "Disable Pi-Hole..."
uci -q del_list dhcp.@dnsmasq[0].server="$(uci -q get dhcp.@dnsmasq[0].server | tr ' ' '\n' | grep '#53' | grep '10.255.25')"
if [ -z "$(uci -q get dhcp.@dnsmasq[0].server | grep '127.0.0.1#5353')" ]; then
uci -q batch <<-EOF >/dev/null
add_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
commit dhcp
EOF
fi
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi
}
# An interface in error will never be used in MPTCP
if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || { [ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$interface_up" != "true" ]; }; then
#interface_autostart=$(ifstatus "$OMR_TRACKER_INTERFACE" 2>/dev/null | jsonfilter -q -e '@["autostart"]')

View file

@ -696,21 +696,6 @@ del_server_route6() {
fi
}
disable_pihole() {
local server=$1
if [ -n "$(uci -q get dhcp.@dnsmasq[0].server | grep '#53' | grep '10.255.25')" ]; then
_log "Disable Pi-Hole..."
uci -q del_list dhcp.@dnsmasq[0].server="$(uci -q get dhcp.@dnsmasq[0].server | tr ' ' '\n' | grep '#53' | grep '10.255.25')"
if [ -z "$(uci -q get dhcp.@dnsmasq[0].server | grep '127.0.0.1#5353')" ]; then
uci -q batch <<-EOF >/dev/null
add_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
commit dhcp
EOF
fi
/etc/init.d/dnsmasq restart >/dev/null 2>&1
fi
}
enable_pihole() {
local server=$1
nbserver=$((nbserver+1))