#!/bin/sh #---------------------------------------------------------------------------- # /etc/ppp/ip-down800.dhcp __FLI4LVER__ # # called whenever an IPv4 PPP connection over default circuit has been shut # down and dnsmasq is installed # # Creation: 2007-11-29 lanspezi # Last Update: $Id$ #---------------------------------------------------------------------------- # restore etc/resolv.dnsmasq from etc/resolv.dnsmasq.bak #---------------------------------------------------------------------------- . /etc/rc.d/helper-dns_dnsmasq.sh resolv_file=/etc/resolv.dnsmasq delegation_file=/etc/dnsmasq.d/dns_delegation.conf bogus_priv_file=$dns_private_subnets # is a default-route-interface going down? if [ "$is_default_route" = "yes" ] then if lock_resource $(basename $resolv_file) ip-down800.dns then restart=no # does /etc/resolv.dnsmasq.bak exist? if [ -f $resolv_file.bak ] then # yes, restore etc/resolv.dnsmasq mv $resolv_file.bak $resolv_file echo "$resolv_file restored." fi if [ -f $delegation_file~ ] then mv $delegation_file~ $delegation_file chown dns:dns $delegation_file echo "$delegation_file restored." restart=yes fi if [ -f $bogus_priv_file~ ] then mv $bogus_priv_file~ $bogus_priv_file dns_update_private_subnets echo "$bogus_priv_file restored." restart=yes fi if [ "$restart" = yes ] then killall dnsmasq sleep 1 dnsmasq else killall -HUP dnsmasq fi unlock_resource $(basename $resolv_file) ip-down800.dns fi fi