[backfire] dnsmasq: backport r29375
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 13 Dec 2011 15:46:21 +0000 (15:46 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 13 Dec 2011 15:46:21 +0000 (15:46 +0000)
SVN-Revision: 29520

package/dnsmasq/Makefile
package/dnsmasq/files/dnsmasq.init

index 14d3cc4dd622308d9c165e08d1584cd14a029d46..19eb663340143af8cee3594d8c8d7451777de655 100644 (file)
@@ -1,5 +1,5 @@
 # 
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.55
-PKG_RELEASE:=6
+PKG_RELEASE:=6.1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
index 0c2229d88b2ee40e3d69312f43dab908054bdf8a..c79b67ea7c704a3f20a7fc2cd047917cad78ce14 100644 (file)
@@ -322,10 +322,10 @@ dhcp_domain_add() {
        local cfg="$1"
        local ip name names
 
-       config_get names "$cfg" name
+       config_get names "$cfg" name "$2"
        [ -n "$names" ] || return 0
 
-       config_get ip "$cfg" ip
+       config_get ip "$cfg" ip "$3"
        [ -n "$ip" ] || return 0
 
        local oIFS="$IFS"; IFS="."; set -- $ip; IFS="$oIFS"
@@ -349,6 +349,10 @@ dhcp_domain_add() {
 start() {
        include /lib/network
        scan_interfaces
+
+       local lanaddr
+       config_get lanaddr "lan" ipaddr
+
        config_load dhcp
 
        args=""
@@ -364,6 +368,12 @@ start() {
        config_foreach dhcp_domain_add domain
        config_foreach dhcp_add dhcp
 
+       # add own hostname
+       [ -z "$lanaddr" ] || {
+               local hostname="$(uci_get system.@system[0].hostname)"
+               dhcp_domain_add "" "${hostname:-OpenWrt}" "$lanaddr"
+       }
+
        /usr/sbin/dnsmasq $args && {
                rm -f /tmp/resolv.conf
                [ -n "$DOMAIN" ] && echo "search $DOMAIN" >> /tmp/resolv.conf