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

Restart dnsmasq by omr-bypass only if needed

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-07-12 18:06:01 +02:00
parent 50462b9980
commit c6d6552d76

View file

@ -100,12 +100,14 @@ _bypass_domain() {
fi fi
if [ "$(uci -q get dhcp.@dnsmasq[0].ipset | grep /$domain/)" = "" ]; then if [ "$(uci -q get dhcp.@dnsmasq[0].ipset | grep /$domain/)" = "" ]; then
uci -q add_list dhcp.@dnsmasq[0].ipset="/$domain/omr_dst_bypass_$intf,omr6_dst_bypass_$intf" uci -q add_list dhcp.@dnsmasq[0].ipset="/$domain/omr_dst_bypass_$intf,omr6_dst_bypass_$intf"
add_domains="true"
else else
dnsmasqipset=$(uci -q get dhcp.@dnsmasq[0].ipset | sed 's/ /\n/g') dnsmasqipset=$(uci -q get dhcp.@dnsmasq[0].ipset | sed 's/ /\n/g')
for dnsipset in $dnsmasqipset; do for dnsipset in $dnsmasqipset; do
if [ "$(echo $dnsipset | cut -d/ -f2)" = "$domain" ]; then if [ "$(echo $dnsipset | cut -d/ -f2)" = "$domain" ]; then
uci -q del_list dhcp.@dnsmasq[0].ipset=$dnsipset uci -q del_list dhcp.@dnsmasq[0].ipset=$dnsipset
uci -q add_list dhcp.@dnsmasq[0].ipset="$dnsipset,omr_dst_bypass_$intf,omr6_dst_bypass_$intf" uci -q add_list dhcp.@dnsmasq[0].ipset="$dnsipset,omr_dst_bypass_$intf,omr6_dst_bypass_$intf"
add_domains="true"
fi fi
done done
fi fi
@ -680,6 +682,7 @@ boot() {
start_service() { start_service() {
#local count #local count
logger -t "omr-bypass" "Starting OMR-ByPass..." logger -t "omr-bypass" "Starting OMR-ByPass..."
add_domains="false"
config_load omr-bypass config_load omr-bypass
config_foreach _add_proto proto config_foreach _add_proto proto
disableipv6="$(uci -q get openmptcprouter.settings.disable_ipv6)" disableipv6="$(uci -q get openmptcprouter.settings.disable_ipv6)"
@ -797,11 +800,11 @@ start_service() {
config_foreach _bypass_proto dpis config_foreach _bypass_proto dpis
uci -q commit omr-bypass uci -q commit omr-bypass
[ -z "$RELOAD" ] && { [ -z "$RELOAD" ] && [ "$add_domains" = "true" ] && {
logger -t "omr-bypass" "Restart dnsmasq..." logger -t "omr-bypass" "Restart dnsmasq..."
/etc/init.d/dnsmasq restart /etc/init.d/dnsmasq restart
} }
[ -n "$RELOAD" ] && { [ -n "$RELOAD" ] && [ "$add_domains" = "true" ] && {
logger -t "omr-bypass" "Reload dnsmasq..." logger -t "omr-bypass" "Reload dnsmasq..."
/etc/init.d/dnsmasq reload /etc/init.d/dnsmasq reload
} }