2006-10-04 20:05:48 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2012-07-01 11:32:46 +00:00
|
|
|
# Copyright (C) 2007-2012 OpenWrt.org
|
2006-10-04 20:05:48 +00:00
|
|
|
|
2006-11-13 21:16:03 +00:00
|
|
|
START=60
|
2011-11-07 22:58:45 +00:00
|
|
|
|
2013-09-17 21:45:30 +00:00
|
|
|
USE_PROCD=1
|
|
|
|
PROG=/usr/sbin/dnsmasq
|
2011-11-07 22:58:45 +00:00
|
|
|
|
2007-09-10 20:24:18 +00:00
|
|
|
DNS_SERVERS=""
|
2009-10-05 16:58:06 +00:00
|
|
|
DOMAIN=""
|
2007-03-17 13:31:13 +00:00
|
|
|
|
2012-07-01 11:32:46 +00:00
|
|
|
ADD_LOCAL_DOMAIN=1
|
|
|
|
ADD_LOCAL_HOSTNAME=1
|
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
CONFIGFILE="/var/etc/dnsmasq.conf"
|
2014-05-20 05:00:28 +00:00
|
|
|
HOSTFILE="/tmp/hosts/dhcp"
|
2014-06-18 10:04:29 +00:00
|
|
|
TRUSTANCHORSFILE="/usr/share/dnsmasq/trust-anchors.conf"
|
2015-04-13 07:49:29 +00:00
|
|
|
TIMESTAMPFILE="/etc/dnsmasq.time"
|
2012-04-02 22:31:21 +00:00
|
|
|
|
|
|
|
xappend() {
|
|
|
|
local value="$1"
|
|
|
|
|
|
|
|
echo "${value#--}" >> $CONFIGFILE
|
|
|
|
}
|
|
|
|
|
2007-03-17 13:31:13 +00:00
|
|
|
dhcp_calc() {
|
|
|
|
local ip="$1"
|
|
|
|
local res=0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-03-17 13:31:13 +00:00
|
|
|
while [ -n "$ip" ]; do
|
|
|
|
part="${ip%%.*}"
|
|
|
|
res="$(($res * 256))"
|
|
|
|
res="$(($res + $part))"
|
|
|
|
[ "${ip%.*}" != "$ip" ] && ip="${ip#*.}" || ip=
|
|
|
|
done
|
|
|
|
echo "$res"
|
|
|
|
}
|
|
|
|
|
2013-12-21 13:31:28 +00:00
|
|
|
dhcp_check() {
|
|
|
|
local ifname="$1"
|
|
|
|
local stamp="/var/run/dnsmasq.$ifname.dhcp"
|
|
|
|
local rv=0
|
|
|
|
|
|
|
|
[ -s "$stamp" ] && return $(cat "$stamp")
|
|
|
|
|
|
|
|
udhcpc -n -q -s /bin/true -t 1 -i "$ifname" >&- && rv=1 || rv=0
|
|
|
|
|
|
|
|
[ $rv -eq 1 ] && \
|
|
|
|
logger -t dnsmasq \
|
|
|
|
"found already running DHCP-server on interface '$ifname'" \
|
|
|
|
"refusing to start, use 'option force 1' to override"
|
|
|
|
|
|
|
|
echo $rv > "$stamp"
|
|
|
|
return $rv
|
|
|
|
}
|
|
|
|
|
|
|
|
log_once() {
|
|
|
|
pidof dnsmasq >/dev/null || \
|
|
|
|
logger -t dnsmasq "$@"
|
|
|
|
}
|
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
append_bool() {
|
|
|
|
local section="$1"
|
|
|
|
local option="$2"
|
|
|
|
local value="$3"
|
2007-09-25 23:16:31 +00:00
|
|
|
local _loctmp
|
2010-07-17 13:36:13 +00:00
|
|
|
config_get_bool _loctmp "$section" "$option" 0
|
2012-04-02 22:31:21 +00:00
|
|
|
[ $_loctmp -gt 0 ] && xappend "$value"
|
2007-09-25 23:16:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
append_parm() {
|
|
|
|
local section="$1"
|
|
|
|
local option="$2"
|
|
|
|
local switch="$3"
|
|
|
|
local _loctmp
|
|
|
|
config_get _loctmp "$section" "$option"
|
|
|
|
[ -z "$_loctmp" ] && return 0
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "$switch=$_loctmp"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
2009-01-27 22:58:11 +00:00
|
|
|
append_server() {
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--server=$1"
|
2009-01-27 22:58:11 +00:00
|
|
|
}
|
|
|
|
|
2012-07-05 17:54:14 +00:00
|
|
|
append_address() {
|
|
|
|
xappend "--address=$1"
|
|
|
|
}
|
|
|
|
|
2014-12-17 05:59:12 +00:00
|
|
|
append_ipset() {
|
|
|
|
xappend "--ipset=$1"
|
|
|
|
}
|
|
|
|
|
2009-05-05 09:33:56 +00:00
|
|
|
append_interface() {
|
2010-08-04 17:09:31 +00:00
|
|
|
local ifname=$(uci_get_state network "$1" ifname "$1")
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--interface=$ifname"
|
2009-05-05 09:33:56 +00:00
|
|
|
}
|
|
|
|
|
2009-09-16 18:15:31 +00:00
|
|
|
append_notinterface() {
|
2010-08-04 17:09:31 +00:00
|
|
|
local ifname=$(uci_get_state network "$1" ifname "$1")
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--except-interface=$ifname"
|
2009-09-16 18:15:31 +00:00
|
|
|
}
|
|
|
|
|
2009-11-22 11:52:08 +00:00
|
|
|
append_addnhosts() {
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--addn-hosts=$1"
|
2009-11-22 11:52:08 +00:00
|
|
|
}
|
|
|
|
|
2010-08-11 10:37:33 +00:00
|
|
|
append_bogusnxdomain() {
|
2013-09-23 21:58:36 +00:00
|
|
|
xappend "--bogus-nxdomain=$1"
|
2010-08-11 10:37:33 +00:00
|
|
|
}
|
|
|
|
|
2015-03-13 08:39:08 +00:00
|
|
|
append_pxe_service() {
|
|
|
|
xappend "--pxe-service=$1"
|
|
|
|
}
|
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
dnsmasq() {
|
|
|
|
local cfg="$1"
|
2012-04-02 22:31:21 +00:00
|
|
|
append_bool "$cfg" authoritative "--dhcp-authoritative"
|
|
|
|
append_bool "$cfg" nodaemon "--no-daemon"
|
|
|
|
append_bool "$cfg" domainneeded "--domain-needed"
|
|
|
|
append_bool "$cfg" filterwin2k "--filterwin2k"
|
|
|
|
append_bool "$cfg" nohosts "--no-hosts"
|
|
|
|
append_bool "$cfg" nonegcache "--no-negcache"
|
|
|
|
append_bool "$cfg" strictorder "--strict-order"
|
2015-07-07 08:13:16 +00:00
|
|
|
append_bool "$cfg" logqueries "--log-queries=extra"
|
2012-04-02 22:31:21 +00:00
|
|
|
append_bool "$cfg" noresolv "--no-resolv"
|
|
|
|
append_bool "$cfg" localise_queries "--localise-queries"
|
|
|
|
append_bool "$cfg" readethers "--read-ethers"
|
|
|
|
append_bool "$cfg" dbus "--enable-dbus"
|
|
|
|
append_bool "$cfg" boguspriv "--bogus-priv"
|
|
|
|
append_bool "$cfg" expandhosts "--expand-hosts"
|
2008-10-13 07:39:56 +00:00
|
|
|
append_bool "$cfg" enable_tftp "--enable-tftp"
|
2015-04-01 08:33:10 +00:00
|
|
|
append_bool "$cfg" tftp_no_fail "--tftp-no-fail"
|
2012-04-02 22:31:21 +00:00
|
|
|
append_bool "$cfg" nonwildcard "--bind-interfaces"
|
2012-07-01 11:32:45 +00:00
|
|
|
append_bool "$cfg" fqdn "--dhcp-fqdn"
|
2013-05-07 07:19:51 +00:00
|
|
|
append_bool "$cfg" proxydnssec "--proxy-dnssec"
|
2015-01-16 19:04:19 +00:00
|
|
|
append_bool "$cfg" localservice "--local-service"
|
2015-01-17 14:38:55 +00:00
|
|
|
append_bool "$cfg" quietdhcp "--quiet-dhcp"
|
2015-07-07 08:13:22 +00:00
|
|
|
append_bool "$cfg" sequential_ip "--dhcp-sequential-ip"
|
2015-12-11 15:06:59 +00:00
|
|
|
append_bool "$cfg" allservers "--all-servers"
|
2012-04-02 22:31:21 +00:00
|
|
|
|
|
|
|
append_parm "$cfg" dhcpscript "--dhcp-script"
|
|
|
|
append_parm "$cfg" cachesize "--cache-size"
|
|
|
|
append_parm "$cfg" dnsforwardmax "--dns-forward-max"
|
|
|
|
append_parm "$cfg" port "--port"
|
|
|
|
append_parm "$cfg" ednspacket_max "--edns-packet-max"
|
|
|
|
append_parm "$cfg" dhcpleasemax "--dhcp-lease-max"
|
|
|
|
append_parm "$cfg" "queryport" "--query-port"
|
|
|
|
append_parm "$cfg" "domain" "--domain"
|
|
|
|
append_parm "$cfg" "local" "--server"
|
2009-01-27 22:58:11 +00:00
|
|
|
config_list_foreach "$cfg" "server" append_server
|
2012-07-05 17:54:14 +00:00
|
|
|
config_list_foreach "$cfg" "address" append_address
|
2014-12-17 05:59:12 +00:00
|
|
|
config_list_foreach "$cfg" "ipset" append_ipset
|
2009-05-05 09:33:56 +00:00
|
|
|
config_list_foreach "$cfg" "interface" append_interface
|
2009-09-16 18:15:31 +00:00
|
|
|
config_list_foreach "$cfg" "notinterface" append_notinterface
|
2009-11-22 11:52:08 +00:00
|
|
|
config_list_foreach "$cfg" "addnhosts" append_addnhosts
|
2010-08-11 10:37:33 +00:00
|
|
|
config_list_foreach "$cfg" "bogusnxdomain" append_bogusnxdomain
|
2012-04-02 22:31:21 +00:00
|
|
|
append_parm "$cfg" "leasefile" "--dhcp-leasefile"
|
|
|
|
append_parm "$cfg" "resolvfile" "--resolv-file"
|
2015-04-09 10:32:46 +00:00
|
|
|
append_parm "$cfg" "serversfile" "--servers-file"
|
2008-10-13 07:39:56 +00:00
|
|
|
append_parm "$cfg" "tftp_root" "--tftp-root"
|
|
|
|
append_parm "$cfg" "dhcp_boot" "--dhcp-boot"
|
2012-07-05 17:46:32 +00:00
|
|
|
append_parm "$cfg" "local_ttl" "--local-ttl"
|
2015-03-13 08:39:08 +00:00
|
|
|
append_parm "$cfg" "pxe_prompt" "--pxe-prompt"
|
|
|
|
config_list_foreach "$cfg" "pxe_service" append_pxe_service
|
2009-10-05 16:58:06 +00:00
|
|
|
config_get DOMAIN "$cfg" domain
|
|
|
|
|
2012-07-01 11:32:46 +00:00
|
|
|
config_get_bool ADD_LOCAL_DOMAIN "$cfg" add_local_domain 1
|
|
|
|
config_get_bool ADD_LOCAL_HOSTNAME "$cfg" add_local_hostname 1
|
|
|
|
|
2010-03-14 21:33:02 +00:00
|
|
|
config_get_bool readethers "$cfg" readethers
|
2011-02-14 19:42:53 +00:00
|
|
|
[ "$readethers" = "1" -a \! -e "/etc/ethers" ] && touch /etc/ethers
|
2010-03-14 21:33:02 +00:00
|
|
|
|
2008-02-14 21:17:14 +00:00
|
|
|
config_get leasefile $cfg leasefile
|
2011-02-14 19:42:53 +00:00
|
|
|
[ -n "$leasefile" -a \! -e "$leasefile" ] && touch "$leasefile"
|
2008-09-02 01:37:06 +00:00
|
|
|
config_get_bool cachelocal "$cfg" cachelocal 1
|
2009-05-09 22:34:04 +00:00
|
|
|
|
|
|
|
config_get hostsfile "$cfg" dhcphostsfile
|
2012-04-02 22:31:21 +00:00
|
|
|
[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile"
|
2010-07-16 00:06:59 +00:00
|
|
|
|
|
|
|
local rebind
|
|
|
|
config_get_bool rebind "$cfg" rebind_protection 1
|
|
|
|
[ $rebind -gt 0 ] && {
|
2013-12-21 13:31:28 +00:00
|
|
|
log_once \
|
2010-07-16 00:06:59 +00:00
|
|
|
"DNS rebinding protection is active," \
|
|
|
|
"will discard upstream RFC1918 responses!"
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--stop-dns-rebind"
|
2010-07-16 00:06:59 +00:00
|
|
|
|
|
|
|
local rebind_localhost
|
|
|
|
config_get_bool rebind_localhost "$cfg" rebind_localhost 0
|
|
|
|
[ $rebind_localhost -gt 0 ] && {
|
2013-12-21 13:31:28 +00:00
|
|
|
log_once "Allowing 127.0.0.0/8 responses"
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--rebind-localhost-ok"
|
2010-07-16 00:06:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
append_rebind_domain() {
|
2013-12-21 13:31:28 +00:00
|
|
|
log_once "Allowing RFC1918 responses for domain $1"
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--rebind-domain-ok=$1"
|
2010-07-16 00:06:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config_list_foreach "$cfg" rebind_domain append_rebind_domain
|
|
|
|
}
|
2012-04-02 22:31:21 +00:00
|
|
|
|
2014-06-22 15:34:36 +00:00
|
|
|
config_get_bool dnssec "$cfg" dnssec 0
|
2014-06-18 10:04:29 +00:00
|
|
|
[ "$dnssec" -gt 0 ] && {
|
|
|
|
xappend "--conf-file=$TRUSTANCHORSFILE"
|
|
|
|
xappend "--dnssec"
|
2015-04-13 07:49:29 +00:00
|
|
|
xappend "--dnssec-timestamp=$TIMESTAMPFILE"
|
2014-06-18 10:04:29 +00:00
|
|
|
append_bool "$cfg" dnsseccheckunsigned "--dnssec-check-unsigned"
|
|
|
|
}
|
|
|
|
|
2012-07-01 11:32:29 +00:00
|
|
|
dhcp_option_add "$cfg" "" 0
|
|
|
|
|
2013-10-11 18:33:15 +00:00
|
|
|
xappend "--dhcp-broadcast=tag:needs-broadcast"
|
|
|
|
|
2015-09-02 11:49:00 +00:00
|
|
|
mkdir -p /tmp/hosts /tmp/dnsmasq.d
|
|
|
|
xappend "--addn-hosts=/tmp/hosts"
|
|
|
|
xappend "--conf-dir=/tmp/dnsmasq.d"
|
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
echo >> $CONFIGFILE
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_subscrid_add() {
|
|
|
|
local cfg="$1"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
|
|
|
[ -n "$networkid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
config_get subscriberid "$cfg" subscriberid
|
|
|
|
[ -n "$subscriberid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--dhcp-subscrid=$networkid,$subscriberid"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-05-19 20:17:56 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
|
|
|
|
dhcp_option_add "$cfg" "$networkid" "$force"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_remoteid_add() {
|
|
|
|
local cfg="$1"
|
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
|
|
|
[ -n "$networkid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
config_get remoteid "$cfg" remoteid
|
|
|
|
[ -n "$remoteid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--dhcp-remoteid=$networkid,$remoteid"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-05-19 20:17:56 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
|
|
|
|
dhcp_option_add "$cfg" "$networkid" "$force"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_circuitid_add() {
|
|
|
|
local cfg="$1"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
|
|
|
[ -n "$networkid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
config_get circuitid "$cfg" circuitid
|
|
|
|
[ -n "$circuitid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--dhcp-circuitid=$networkid,$circuitid"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-05-19 20:17:56 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
|
|
|
|
dhcp_option_add "$cfg" "$networkid" "$force"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_userclass_add() {
|
|
|
|
local cfg="$1"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
|
|
|
[ -n "$networkid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
config_get userclass "$cfg" userclass
|
|
|
|
[ -n "$userclass" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--dhcp-userclass=$networkid,$userclass"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-05-19 20:17:56 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
|
|
|
|
dhcp_option_add "$cfg" "$networkid" "$force"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_vendorclass_add() {
|
|
|
|
local cfg="$1"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
|
|
|
[ -n "$networkid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
config_get vendorclass "$cfg" vendorclass
|
|
|
|
[ -n "$vendorclass" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--dhcp-vendorclass=$networkid,$vendorclass"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-05-19 20:17:56 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
|
|
|
|
dhcp_option_add "$cfg" "$networkid" "$force"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_host_add() {
|
|
|
|
local cfg="$1"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-05-19 20:17:56 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
2012-05-19 20:17:56 +00:00
|
|
|
[ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid" "$force"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2011-05-24 09:12:50 +00:00
|
|
|
config_get name "$cfg" name
|
2007-11-05 14:14:06 +00:00
|
|
|
config_get ip "$cfg" ip
|
dnsmasq: add support for set: and tag: pairs
On my network, I have a variety of machines and appliances, some of which need different configuration issues than the default options.
For example:
config host
option name 'client'
option mac '00:01:02:03:04:05'
option ip '192.168.1.20'
option tag 'acme'
config tag acme
option force '1'
list dhcp_option 'option:router,192.168.1.253'
list dhcp_option 'option:domain-name,acme.com'
list dhcp_option 'option:domain-search,acme.com,redfish-solutions.com'
which allows me to override the default router for my client's host, as well as its domain-name, and its domain-search.
this causes the following config lines:
dhcp-host=00:01:02:03:04:05,set:acme,192.168.1.20,client
dhcp-option-force=tag:acme,option:router,192.168.1.253
dhcp-option-force=tag:acme,option:domain-name,acme.com
dhcp-option-force=tag:acme,option:domain-search:acme.com,redfish-solutions.com
This could be useful elsewhere, for instance, if you have an IP CCTV that you don't want to have a default-route, etc.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
SVN-Revision: 31815
2012-05-19 20:17:54 +00:00
|
|
|
[ -n "$ip" -o -n "$name" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2014-08-28 06:27:53 +00:00
|
|
|
config_get_bool dns "$cfg" dns 0
|
|
|
|
[ "$dns" = "1" -a -n "$ip" -a -n "$name" ] && {
|
|
|
|
echo "$ip $name${DOMAIN:+.$DOMAIN}" >> $HOSTFILE
|
|
|
|
}
|
|
|
|
|
2010-03-08 23:28:55 +00:00
|
|
|
config_get mac "$cfg" mac
|
2014-08-28 06:27:57 +00:00
|
|
|
if [ -n "$mac" ]; then
|
|
|
|
# --dhcp-host=00:20:e0:3b:13:af,192.168.0.199,lap
|
|
|
|
macs=""
|
|
|
|
for m in $mac; do append macs "$m" ","; done
|
|
|
|
else
|
|
|
|
# --dhcp-host=lap,192.168.0.199
|
2013-01-02 15:14:19 +00:00
|
|
|
[ -n "$name" ] || return 0
|
2014-08-28 06:27:57 +00:00
|
|
|
macs="$name"
|
2013-01-02 15:14:19 +00:00
|
|
|
name=""
|
2014-08-28 06:27:57 +00:00
|
|
|
fi
|
2010-03-08 23:28:55 +00:00
|
|
|
|
dnsmasq: add support for set: and tag: pairs
On my network, I have a variety of machines and appliances, some of which need different configuration issues than the default options.
For example:
config host
option name 'client'
option mac '00:01:02:03:04:05'
option ip '192.168.1.20'
option tag 'acme'
config tag acme
option force '1'
list dhcp_option 'option:router,192.168.1.253'
list dhcp_option 'option:domain-name,acme.com'
list dhcp_option 'option:domain-search,acme.com,redfish-solutions.com'
which allows me to override the default router for my client's host, as well as its domain-name, and its domain-search.
this causes the following config lines:
dhcp-host=00:01:02:03:04:05,set:acme,192.168.1.20,client
dhcp-option-force=tag:acme,option:router,192.168.1.253
dhcp-option-force=tag:acme,option:domain-name,acme.com
dhcp-option-force=tag:acme,option:domain-search:acme.com,redfish-solutions.com
This could be useful elsewhere, for instance, if you have an IP CCTV that you don't want to have a default-route, etc.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
SVN-Revision: 31815
2012-05-19 20:17:54 +00:00
|
|
|
config_get tag "$cfg" tag
|
|
|
|
|
2013-10-11 18:33:15 +00:00
|
|
|
config_get_bool broadcast "$cfg" broadcast 0
|
|
|
|
[ "$broadcast" = "0" ] && broadcast=
|
|
|
|
|
|
|
|
xappend "--dhcp-host=$macs${networkid:+,net:$networkid}${broadcast:+,set:needs-broadcast}${tag:+,set:$tag}${ip:+,$ip}${name:+,$name}"
|
dnsmasq: add support for set: and tag: pairs
On my network, I have a variety of machines and appliances, some of which need different configuration issues than the default options.
For example:
config host
option name 'client'
option mac '00:01:02:03:04:05'
option ip '192.168.1.20'
option tag 'acme'
config tag acme
option force '1'
list dhcp_option 'option:router,192.168.1.253'
list dhcp_option 'option:domain-name,acme.com'
list dhcp_option 'option:domain-search,acme.com,redfish-solutions.com'
which allows me to override the default router for my client's host, as well as its domain-name, and its domain-search.
this causes the following config lines:
dhcp-host=00:01:02:03:04:05,set:acme,192.168.1.20,client
dhcp-option-force=tag:acme,option:router,192.168.1.253
dhcp-option-force=tag:acme,option:domain-name,acme.com
dhcp-option-force=tag:acme,option:domain-search:acme.com,redfish-solutions.com
This could be useful elsewhere, for instance, if you have an IP CCTV that you don't want to have a default-route, etc.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
SVN-Revision: 31815
2012-05-19 20:17:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_tag_add() {
|
|
|
|
local cfg="$1"
|
|
|
|
|
|
|
|
tag="$cfg"
|
|
|
|
|
|
|
|
[ -n "$tag" ] || return 0
|
|
|
|
|
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
[ "$force" = "0" ] && force=
|
|
|
|
|
|
|
|
config_get option "$cfg" dhcp_option
|
|
|
|
for o in $option; do
|
|
|
|
xappend "--dhcp-option${force:+-force}=tag:$tag,$o"
|
|
|
|
done
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_mac_add() {
|
2007-03-17 13:31:13 +00:00
|
|
|
local cfg="$1"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
|
|
|
[ -n "$networkid" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
config_get mac "$cfg" mac
|
|
|
|
[ -n "$mac" ] || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--dhcp-mac=$networkid,$mac"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
dhcp_option_add "$cfg" "$networkid"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
2007-03-17 13:31:13 +00:00
|
|
|
|
2008-07-05 13:43:55 +00:00
|
|
|
dhcp_boot_add() {
|
|
|
|
local cfg="$1"
|
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
2008-07-05 13:43:55 +00:00
|
|
|
|
|
|
|
config_get filename "$cfg" filename
|
|
|
|
[ -n "$filename" ] || return 0
|
|
|
|
|
|
|
|
config_get servername "$cfg" servername
|
|
|
|
config_get serveraddress "$cfg" serveraddress
|
|
|
|
|
2015-03-13 08:38:35 +00:00
|
|
|
[ -n "$serveraddress" -a ! -n "$servername" ] && return 0
|
|
|
|
|
|
|
|
xappend "--dhcp-boot=${networkid:+net:$networkid,}${filename}${servername:+,$servername}${serveraddress:+,$serveraddress}"
|
2008-07-05 13:43:55 +00:00
|
|
|
|
2012-05-19 20:17:56 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
|
|
|
|
|
|
|
dhcp_option_add "$cfg" "$networkid" "$force"
|
2008-07-05 13:43:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
dhcp_add() {
|
|
|
|
local cfg="$1"
|
2007-03-17 13:31:13 +00:00
|
|
|
config_get net "$cfg" interface
|
|
|
|
[ -n "$net" ] || return 0
|
2007-08-29 18:40:52 +00:00
|
|
|
|
2014-08-19 05:58:44 +00:00
|
|
|
config_get dhcpv4 "$cfg" dhcpv4
|
|
|
|
[ "$dhcpv4" != "disabled" ] || return 0
|
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
config_get networkid "$cfg" networkid
|
|
|
|
[ -n "$networkid" ] || networkid="$net"
|
2007-08-29 18:40:52 +00:00
|
|
|
|
2013-12-16 16:47:41 +00:00
|
|
|
network_get_subnet subnet "$net" || return 0
|
|
|
|
network_get_device ifname "$net" || return 0
|
|
|
|
network_get_protocol proto "$net" || return 0
|
2007-08-29 18:40:52 +00:00
|
|
|
|
2013-12-16 16:47:41 +00:00
|
|
|
[ "$cachelocal" = "0" ] && network_get_dnsserver dnsserver "$net" && {
|
2007-09-10 20:24:18 +00:00
|
|
|
DNS_SERVERS="$DNS_SERVERS $dnsserver"
|
|
|
|
}
|
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
append_bool "$cfg" ignore "--no-dhcp-interface=$ifname" && return 0
|
2007-08-29 18:40:52 +00:00
|
|
|
|
2013-12-16 16:47:41 +00:00
|
|
|
# Do not support non-static interfaces for now
|
2007-03-17 13:31:13 +00:00
|
|
|
[ static = "$proto" ] || return 0
|
2007-08-29 18:40:52 +00:00
|
|
|
|
2013-12-16 16:47:41 +00:00
|
|
|
# Override interface netmask with dhcp config if applicable
|
|
|
|
config_get netmask "$cfg" netmask "${subnet##*/}"
|
2007-03-17 13:31:13 +00:00
|
|
|
|
2007-08-29 18:40:52 +00:00
|
|
|
#check for an already active dhcp server on the interface, unless 'force' is set
|
2007-03-17 13:31:13 +00:00
|
|
|
config_get_bool force "$cfg" force 0
|
2013-12-21 13:31:28 +00:00
|
|
|
[ $force -gt 0 ] || dhcp_check "$ifname" || return 0
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2007-03-17 13:31:13 +00:00
|
|
|
config_get start "$cfg" start
|
2007-08-19 20:50:52 +00:00
|
|
|
config_get limit "$cfg" limit
|
2007-03-17 13:31:13 +00:00
|
|
|
config_get leasetime "$cfg" leasetime
|
2007-03-31 00:39:55 +00:00
|
|
|
config_get options "$cfg" options
|
2007-11-28 03:02:20 +00:00
|
|
|
config_get_bool dynamicdhcp "$cfg" dynamicdhcp 1
|
2007-03-17 13:31:13 +00:00
|
|
|
|
|
|
|
leasetime="${leasetime:-12h}"
|
|
|
|
start="$(dhcp_calc "${start:-100}")"
|
2010-03-18 15:50:05 +00:00
|
|
|
limit="${limit:-150}"
|
2011-01-26 11:33:33 +00:00
|
|
|
[ "$limit" -gt 0 ] && limit=$((limit-1))
|
2013-12-16 16:47:41 +00:00
|
|
|
eval "$(ipcalc.sh "${subnet%%/*}" $netmask $start $limit)"
|
2007-11-28 03:02:20 +00:00
|
|
|
if [ "$dynamicdhcp" = "0" ]; then END="static"; fi
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--dhcp-range=$networkid,$START,$END,$NETMASK,$leasetime${options:+ $options}"
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2010-01-08 00:03:08 +00:00
|
|
|
dhcp_option_add "$cfg" "$networkid"
|
2007-08-29 18:40:52 +00:00
|
|
|
}
|
|
|
|
|
2007-09-25 23:16:31 +00:00
|
|
|
dhcp_option_add() {
|
2007-08-29 18:40:52 +00:00
|
|
|
local cfg="$1"
|
2010-01-08 00:03:08 +00:00
|
|
|
local networkid="$2"
|
2012-05-19 20:17:56 +00:00
|
|
|
local force="$3"
|
|
|
|
|
|
|
|
[ "$force" = "0" ] && force=
|
2007-09-25 23:16:31 +00:00
|
|
|
|
2008-09-07 20:07:55 +00:00
|
|
|
config_get dhcp_option "$cfg" dhcp_option
|
|
|
|
for o in $dhcp_option; do
|
2012-07-01 11:32:29 +00:00
|
|
|
xappend "--dhcp-option${force:+-force}=${networkid:+$networkid,}$o"
|
2007-08-29 18:40:52 +00:00
|
|
|
done
|
|
|
|
|
2007-03-17 13:31:13 +00:00
|
|
|
}
|
|
|
|
|
2009-10-05 16:58:06 +00:00
|
|
|
dhcp_domain_add() {
|
|
|
|
local cfg="$1"
|
2013-06-17 11:55:30 +00:00
|
|
|
local ip name names record
|
2009-10-05 16:58:06 +00:00
|
|
|
|
2011-12-01 21:34:45 +00:00
|
|
|
config_get names "$cfg" name "$2"
|
2010-04-02 22:56:22 +00:00
|
|
|
[ -n "$names" ] || return 0
|
2009-10-05 16:58:06 +00:00
|
|
|
|
2011-12-01 21:34:45 +00:00
|
|
|
config_get ip "$cfg" ip "$3"
|
2009-10-05 16:58:06 +00:00
|
|
|
[ -n "$ip" ] || return 0
|
|
|
|
|
2010-04-02 22:56:22 +00:00
|
|
|
for name in $names; do
|
2014-08-28 06:27:49 +00:00
|
|
|
record="${record:+$record }$name"
|
2010-04-02 22:56:22 +00:00
|
|
|
done
|
2013-06-17 11:55:30 +00:00
|
|
|
|
2014-08-28 06:27:49 +00:00
|
|
|
echo "$ip $record" >> $HOSTFILE
|
2009-10-05 16:58:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-08 12:35:29 +00:00
|
|
|
dhcp_srv_add() {
|
|
|
|
local cfg="$1"
|
|
|
|
|
|
|
|
config_get srv "$cfg" srv
|
|
|
|
[ -n "$srv" ] || return 0
|
|
|
|
|
|
|
|
config_get target "$cfg" target
|
|
|
|
[ -n "$target" ] || return 0
|
|
|
|
|
|
|
|
config_get port "$cfg" port
|
2012-03-23 11:19:56 +00:00
|
|
|
[ -n "$port" ] || return 0
|
2010-05-08 12:35:29 +00:00
|
|
|
|
2012-03-23 11:19:56 +00:00
|
|
|
config_get class "$cfg" class
|
|
|
|
config_get weight "$cfg" weight
|
|
|
|
|
|
|
|
local service="$srv,$target,$port${class:+,$class${weight:+,$weight}}"
|
2010-05-08 12:35:29 +00:00
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--srv-host=$service"
|
2010-05-08 12:35:29 +00:00
|
|
|
}
|
|
|
|
|
2012-03-23 11:19:58 +00:00
|
|
|
dhcp_mx_add() {
|
|
|
|
local cfg="$1"
|
2012-03-23 11:26:47 +00:00
|
|
|
local domain relay pref
|
2012-03-23 11:19:58 +00:00
|
|
|
|
2012-03-23 11:26:47 +00:00
|
|
|
config_get domain "$cfg" domain
|
2012-03-23 11:19:58 +00:00
|
|
|
[ -n "$domain" ] || return 0
|
|
|
|
|
|
|
|
config_get relay "$cfg" relay
|
|
|
|
[ -n "$relay" ] || return 0
|
|
|
|
|
|
|
|
config_get pref "$cfg" pref 0
|
|
|
|
|
|
|
|
local service="$domain,$relay,$pref"
|
|
|
|
|
2012-05-19 20:17:19 +00:00
|
|
|
xappend "--mx-host=$service"
|
2012-03-23 11:19:58 +00:00
|
|
|
}
|
|
|
|
|
2011-10-20 12:12:26 +00:00
|
|
|
dhcp_cname_add() {
|
|
|
|
local cfg="$1"
|
|
|
|
local cname target
|
|
|
|
|
|
|
|
config_get cname "$cfg" cname
|
|
|
|
[ -n "$cname" ] || return 0
|
|
|
|
|
|
|
|
config_get target "$cfg" target
|
|
|
|
[ -n "$target" ] || return 0
|
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
xappend "--cname=${cname},${target}"
|
2011-10-20 12:12:26 +00:00
|
|
|
}
|
|
|
|
|
2013-06-17 11:55:30 +00:00
|
|
|
dhcp_hostrecord_add() {
|
|
|
|
local cfg="$1"
|
|
|
|
local names addresses record val
|
|
|
|
|
|
|
|
config_get names "$cfg" name "$2"
|
|
|
|
if [ -z "$names" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
config_get addresses "$cfg" ip "$3"
|
|
|
|
if [ -z "$addresses" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for val in $names $addresses; do
|
|
|
|
record="${record:+$record,}$val"
|
|
|
|
done
|
|
|
|
|
|
|
|
xappend "--host-record=$record"
|
|
|
|
}
|
|
|
|
|
2013-09-17 21:45:30 +00:00
|
|
|
service_triggers()
|
|
|
|
{
|
|
|
|
procd_add_reload_trigger "dhcp"
|
|
|
|
}
|
|
|
|
|
2013-12-21 13:31:28 +00:00
|
|
|
boot() {
|
|
|
|
# Will be launched through hotplug
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2013-09-17 21:45:30 +00:00
|
|
|
start_service() {
|
2013-12-16 16:47:41 +00:00
|
|
|
include /lib/functions
|
2011-12-01 21:34:45 +00:00
|
|
|
|
2007-03-17 13:31:13 +00:00
|
|
|
config_load dhcp
|
|
|
|
|
2013-09-17 21:45:30 +00:00
|
|
|
procd_open_instance
|
2015-03-27 09:11:56 +00:00
|
|
|
procd_set_param command $PROG -C $CONFIGFILE -k -x /var/run/dnsmasq/dnsmasq.pid
|
2013-12-21 13:31:28 +00:00
|
|
|
procd_set_param file $CONFIGFILE
|
2014-06-22 09:08:14 +00:00
|
|
|
procd_set_param respawn
|
2015-03-26 10:58:30 +00:00
|
|
|
|
|
|
|
procd_add_jail dnsmasq ubus log
|
2015-07-24 09:11:06 +00:00
|
|
|
procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom /etc/dnsmasq.conf /tmp/dnsmasq.d /tmp/resolv.conf.auto /etc/hosts /etc/ethers
|
2015-04-13 07:49:29 +00:00
|
|
|
procd_add_jail_mount_rw /var/run/dnsmasq/ /tmp/dhcp.leases $TIMESTAMPFILE
|
2015-03-26 10:58:30 +00:00
|
|
|
|
2013-09-17 21:45:30 +00:00
|
|
|
procd_close_instance
|
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
# before we can call xappend
|
2015-03-26 10:58:30 +00:00
|
|
|
mkdir -p /var/run/dnsmasq/
|
2012-04-02 22:31:21 +00:00
|
|
|
mkdir -p $(dirname $CONFIGFILE)
|
2015-03-26 10:58:30 +00:00
|
|
|
mkdir -p /var/lib/misc
|
|
|
|
touch /tmp/dhcp.leases
|
|
|
|
|
2015-04-13 07:49:29 +00:00
|
|
|
if [ ! -f "$TIMESTAMPFILE" ]; then
|
|
|
|
touch "$TIMESTAMPFILE"
|
|
|
|
chown nobody.nogroup "$TIMESTAMPFILE"
|
2015-04-10 10:19:17 +00:00
|
|
|
fi
|
2012-04-02 22:31:21 +00:00
|
|
|
|
|
|
|
echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE
|
2014-05-20 05:00:28 +00:00
|
|
|
echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE
|
2012-04-02 22:31:21 +00:00
|
|
|
|
|
|
|
# if we did this last, we could override auto-generated config
|
|
|
|
[ -f /etc/dnsmasq.conf ] && {
|
|
|
|
xappend "--conf-file=/etc/dnsmasq.conf"
|
|
|
|
}
|
|
|
|
|
2007-03-17 13:31:13 +00:00
|
|
|
args=""
|
2007-08-29 18:40:52 +00:00
|
|
|
config_foreach dnsmasq dnsmasq
|
|
|
|
config_foreach dhcp_host_add host
|
2012-04-02 22:31:21 +00:00
|
|
|
echo >> $CONFIGFILE
|
2008-07-05 13:43:55 +00:00
|
|
|
config_foreach dhcp_boot_add boot
|
2007-08-29 18:40:52 +00:00
|
|
|
config_foreach dhcp_mac_add mac
|
dnsmasq: add support for set: and tag: pairs
On my network, I have a variety of machines and appliances, some of which need different configuration issues than the default options.
For example:
config host
option name 'client'
option mac '00:01:02:03:04:05'
option ip '192.168.1.20'
option tag 'acme'
config tag acme
option force '1'
list dhcp_option 'option:router,192.168.1.253'
list dhcp_option 'option:domain-name,acme.com'
list dhcp_option 'option:domain-search,acme.com,redfish-solutions.com'
which allows me to override the default router for my client's host, as well as its domain-name, and its domain-search.
this causes the following config lines:
dhcp-host=00:01:02:03:04:05,set:acme,192.168.1.20,client
dhcp-option-force=tag:acme,option:router,192.168.1.253
dhcp-option-force=tag:acme,option:domain-name,acme.com
dhcp-option-force=tag:acme,option:domain-search:acme.com,redfish-solutions.com
This could be useful elsewhere, for instance, if you have an IP CCTV that you don't want to have a default-route, etc.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
SVN-Revision: 31815
2012-05-19 20:17:54 +00:00
|
|
|
config_foreach dhcp_tag_add tag
|
2007-08-29 18:40:52 +00:00
|
|
|
config_foreach dhcp_vendorclass_add vendorclass
|
|
|
|
config_foreach dhcp_userclass_add userclass
|
|
|
|
config_foreach dhcp_circuitid_add circuitid
|
|
|
|
config_foreach dhcp_remoteid_add remoteid
|
|
|
|
config_foreach dhcp_subscrid_add subscrid
|
2009-10-05 16:58:06 +00:00
|
|
|
config_foreach dhcp_domain_add domain
|
2013-06-17 11:55:30 +00:00
|
|
|
config_foreach dhcp_hostrecord_add hostrecord
|
|
|
|
|
|
|
|
# add own hostname
|
2013-12-16 16:47:41 +00:00
|
|
|
local lanaddr
|
|
|
|
[ $ADD_LOCAL_HOSTNAME -eq 1 ] && network_get_ipaddr lanaddr "lan" && {
|
2013-06-17 11:55:30 +00:00
|
|
|
local hostname="$(uci_get system @system[0] hostname OpenWrt)"
|
2014-08-28 06:27:49 +00:00
|
|
|
dhcp_domain_add "" "$hostname" "$lanaddr"
|
2013-06-17 11:55:30 +00:00
|
|
|
}
|
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
echo >> $CONFIGFILE
|
2010-05-08 12:35:29 +00:00
|
|
|
config_foreach dhcp_srv_add srvhost
|
2012-03-23 11:19:58 +00:00
|
|
|
config_foreach dhcp_mx_add mxhost
|
2012-04-02 22:31:21 +00:00
|
|
|
echo >> $CONFIGFILE
|
2014-01-17 14:00:09 +00:00
|
|
|
|
|
|
|
config_get odhcpd_is_active odhcpd maindhcp
|
|
|
|
if [ "$odhcpd_is_active" != "1" ]; then
|
|
|
|
config_foreach dhcp_add dhcp
|
|
|
|
fi
|
|
|
|
|
2012-04-02 22:31:21 +00:00
|
|
|
echo >> $CONFIGFILE
|
2011-10-20 12:12:26 +00:00
|
|
|
config_foreach dhcp_cname_add cname
|
2012-04-02 22:31:21 +00:00
|
|
|
echo >> $CONFIGFILE
|
2007-08-29 18:40:52 +00:00
|
|
|
|
2013-09-17 21:45:30 +00:00
|
|
|
rm -f /tmp/resolv.conf
|
|
|
|
[ $ADD_LOCAL_DOMAIN -eq 1 ] && [ -n "$DOMAIN" ] && {
|
|
|
|
echo "search $DOMAIN" >> /tmp/resolv.conf
|
2007-01-08 21:33:53 +00:00
|
|
|
}
|
2013-09-17 21:45:30 +00:00
|
|
|
DNS_SERVERS="$DNS_SERVERS 127.0.0.1"
|
|
|
|
for DNS_SERVER in $DNS_SERVERS ; do
|
|
|
|
echo "nameserver $DNS_SERVER" >> /tmp/resolv.conf
|
|
|
|
done
|
2006-10-04 20:05:48 +00:00
|
|
|
}
|
|
|
|
|
2013-12-21 13:31:28 +00:00
|
|
|
reload_service() {
|
|
|
|
rc_procd start_service "$@"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2013-09-17 21:45:30 +00:00
|
|
|
stop_service() {
|
|
|
|
[ -f /tmp/resolv.conf ] && {
|
|
|
|
rm -f /tmp/resolv.conf
|
|
|
|
ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
|
2008-09-07 15:22:25 +00:00
|
|
|
}
|
2013-12-21 13:31:28 +00:00
|
|
|
rm -f /var/run/dnsmasq.*.dhcp
|
2006-10-04 20:05:48 +00:00
|
|
|
}
|