aboutsummaryrefslogtreecommitdiffstats
path: root/package/dnsmasq/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-10-13 22:51:49 +0200
committerFelix Fietkau <nbd@openwrt.org>2016-03-20 17:29:15 +0100
commit60c1f0f64d23003a19a07d6b9638542130f6641d (patch)
tree8fb2787f4c49baded97cd55e0c371fe1cffce2b6 /package/dnsmasq/files
parentd58a09110ccfa95f06c983fe796806f2e035c9d2 (diff)
parentb3ce218b51746d3a576221ea542facf3a1703ab2 (diff)
downloadupstream-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.gz
upstream-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.bz2
upstream-60c1f0f64d23003a19a07d6b9638542130f6641d.zip
finally move buildroot-ng to trunk
Diffstat (limited to 'package/dnsmasq/files')
-rw-r--r--package/dnsmasq/files/dnsmasq.conf28
-rw-r--r--package/dnsmasq/files/dnsmasq.init57
2 files changed, 85 insertions, 0 deletions
diff --git a/package/dnsmasq/files/dnsmasq.conf b/package/dnsmasq/files/dnsmasq.conf
new file mode 100644
index 0000000000..8a51f8445d
--- /dev/null
+++ b/package/dnsmasq/files/dnsmasq.conf
@@ -0,0 +1,28 @@
+# filter what we send upstream
+domain-needed
+bogus-priv
+filterwin2k
+localise-queries
+
+# allow /etc/hosts and dhcp lookups via *.lan
+local=/lan/
+domain=lan
+expand-hosts
+resolv-file=/tmp/resolv.conf
+
+@ifdef dhcp_enable
+dhcp-range=@@start@@,@@end@@,@@netmask@@,@@lease@@
+dhcp-authoritative
+dhcp-leasefile=/tmp/dhcp.leases
+@endif
+@ifdef wan_ifname
+except-interface=@@wan_ifname@@
+@endif
+
+# use /etc/ethers for static hosts; same format as --dhcp-host
+# <hwaddr> <ipaddr>
+read-ethers
+
+# other useful options:
+# default route(s): dhcp-option=3,192.168.1.1,192.168.1.2
+# dns server(s): dhcp-option=6,192.168.1.1,192.168.1.2
diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init
new file mode 100644
index 0000000000..8ac0ab638d
--- /dev/null
+++ b/package/dnsmasq/files/dnsmasq.init
@@ -0,0 +1,57 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+start() {
+ include /lib/network
+ scan_interfaces
+
+ # The following is to automatically configure the DHCP settings
+ # based on config settings. Feel free to replace all this crap
+ # with a simple "dnsmasq" and manage everything via the
+ # /etc/dnsmasq.conf config file
+
+ [ -f /etc/dnsmasq.conf ] || exit
+
+ args=""
+ iface=lan
+ config_get ifname "$iface" ifname
+ config_get proto "$iface" proto
+
+ [ "$proto" = static ] && dhcp_enable="${dhcp_enable:-1}"
+ dhcp_start="${dhcp_start:-100}"
+ dhcp_num="${dhcp_num:-50}"
+ dhcp_lease="${dhcp_lease:-12h}"
+
+ # if dhcp_enable is unset and there is a dhcp server on the network already, default to dhcp_enable=0
+ [ -z "$dhcp_enable" ] && udhcpc -n -q -R -s /bin/true -i $ifname >&- && dhcp_enable="${dhcp_enable:-0}"
+
+ # dhcp_enable=0 disables the dhcp server
+ (
+ [ -z "$dhcp_enable" -o "$dhcp_enable" -eq 1 ] && {
+ # no existing DHCP server?
+
+ # calculate settings
+ config_get ipaddr "$iface" ipaddr
+ config_get netmask "$iface" netmask
+ eval $(ipcalc $ipaddr $netmask ${dhcp_start:-100} ${dhcp_num:-150})
+
+ # and pass the args via config parser defines
+ echo "${dhcp_enable:+@define dhcp_enable 1}"
+ echo "@define netmask $NETMASK"
+ echo "@define start $START"
+ echo "@define end $END"
+ echo "@define lease ${dhcp_lease:-12h}"
+ }
+
+ # ignore requests from wan interface
+ config_get wan_proto wan proto
+ config_get wan_ifname wan ifname
+ [ -z "$wan_proto" -o "$wan_proto" = "none" ] || echo "@define wan_ifname $wan_ifname"
+
+ cat /etc/dnsmasq.conf
+ ) | awk -f /usr/lib/parse-config.awk | dnsmasq -C /proc/self/fd/0
+}
+
+stop() {
+ killall dnsmasq
+}