diff options
author | Felix Fietkau <nbd@openwrt.org> | 2006-10-13 22:51:49 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2016-03-20 17:29:15 +0100 |
commit | 60c1f0f64d23003a19a07d6b9638542130f6641d (patch) | |
tree | 8fb2787f4c49baded97cd55e0c371fe1cffce2b6 /package/dnsmasq | |
parent | d58a09110ccfa95f06c983fe796806f2e035c9d2 (diff) | |
parent | b3ce218b51746d3a576221ea542facf3a1703ab2 (diff) | |
download | upstream-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.gz upstream-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.bz2 upstream-60c1f0f64d23003a19a07d6b9638542130f6641d.zip |
finally move buildroot-ng to trunk
Diffstat (limited to 'package/dnsmasq')
-rw-r--r-- | package/dnsmasq/Makefile | 55 | ||||
-rw-r--r-- | package/dnsmasq/files/dnsmasq.conf | 28 | ||||
-rw-r--r-- | package/dnsmasq/files/dnsmasq.init | 57 | ||||
-rw-r--r-- | package/dnsmasq/patches/101-ipv6.patch | 13 |
4 files changed, 153 insertions, 0 deletions
diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile new file mode 100644 index 0000000000..6283fdc898 --- /dev/null +++ b/package/dnsmasq/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dnsmasq +PKG_VERSION:=2.33 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq +PKG_MD5SUM:=45696461b6e6bc929273b1191ca50447 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/dnsmasq + SECTION:=net + CATEGORY:=Base system + DEFAULT:=y + TITLE:=A lightweight DNS and DHCP server + DESCRIPTION:=\ + It is intended to provide coupled DNS and DHCP service to a LAN. + URL:=http://www.thekelleys.org.uk/dnsmasq/ +endef + +define Package/dnsmasq/conffiles +/etc/dnsmasq.conf +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -DHAVE_ISC_READER=1" \ + BINDIR="/usr/sbin" MANDIR="/usr/man" \ + all +endef + +define Package/dnsmasq/install + install -m0755 -d $(1)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/src/dnsmasq $(1)/usr/sbin/ + install -m0755 -d $(1)/etc + install -m0644 ./files/dnsmasq.conf $(1)/etc/dnsmasq.conf + install -m0755 -d $(1)/etc/init.d + install -m0755 ./files/dnsmasq.init $(1)/etc/init.d/S50dnsmasq +endef + +$(eval $(call BuildPackage,dnsmasq)) 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 +} diff --git a/package/dnsmasq/patches/101-ipv6.patch b/package/dnsmasq/patches/101-ipv6.patch new file mode 100644 index 0000000000..5cbf781744 --- /dev/null +++ b/package/dnsmasq/patches/101-ipv6.patch @@ -0,0 +1,13 @@ +--- dnsmasq-2.15.orig/src/config.h 2004-09-20 15:47:57.000000000 +0200 ++++ dnsmasq-2.15/src/config.h 2004-09-20 23:21:10.000000000 +0200 +@@ -78,8 +78,9 @@ + /* We assume that systems which don't have IPv6 + headers don't have ntop and pton either */ + +-#if defined(INET6_ADDRSTRLEN) && defined(IPV6_V6ONLY) && !defined(NO_IPV6) ++#if defined(INET6_ADDRSTRLEN) && !defined(NO_IPV6) + # define HAVE_IPV6 ++# define IPV6_V6ONLY 26 + # define ADDRSTRLEN INET6_ADDRSTRLEN + # if defined(SOL_IPV6) + # define IPV6_LEVEL SOL_IPV6 |