dnsmasq: misc fixes
authorGustavo Zacarias <gustavo@zacarias.com.ar>
Tue, 1 Sep 2009 21:02:06 +0000 (23:02 +0200)
committerPeter Korsgaard <jacmet@sunsite.dk>
Tue, 1 Sep 2009 21:05:30 +0000 (23:05 +0200)
Closes #527

* convert to Makefile.autotools.in format
* Bump to version 2.50 fixes security issues CVE 2009-2957 and 2009-2958.
* fix dbus paths and dependencies
* Install manpage conditionally
* Introduce new DHCP server option

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Daniele Salvatore Albano <d.albano@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
CHANGES
package/dnsmasq/Config.in
package/dnsmasq/dnsmasq.mk

diff --git a/CHANGES b/CHANGES
index d6dd84e84486c9418bd7336d287dfd11526aae4a..414aa16ed9e8a9bed5409351a4c2388eba293617 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+2009.11, Not yet released:
+
+       Issues resolved (http://bugs.uclibc.org):
+
+       #527: misc fixes for dnsmasq package
+
 2009.08, Released August 31th, 2009:
 
        Additional fixes and cleanups.
index a6c75023de057e94ac209727728aa183e31ed47d..073f57b3c7cbb988669659e0893c2fce65c64bdd 100644 (file)
@@ -13,3 +13,10 @@ config BR2_PACKAGE_DNSMASQ_TFTP
        help
          Enable TFTP support in dnsmasq.
 
+config BR2_PACKAGE_DNSMASQ_DHCP
+       bool "dhcp support"
+       default y
+       depends on BR2_PACKAGE_DNSMASQ
+       help
+         Enable DHCP server support in dnsmasq.
+
index 59ca4d438dc125538ab46de9784d9a902aa7e086..d37c65f15d29aad02d0260b88dac6bc54c7f135f 100644 (file)
@@ -4,81 +4,59 @@
 #
 #############################################################
 
-DNSMASQ_SITE:=http://thekelleys.org.uk/dnsmasq
-DNSMASQ_UPVER:=2.47
-DNSMASQ_SOURCE:=dnsmasq-$(DNSMASQ_UPVER).tar.gz
-DNSMASQ_DIR:=$(BUILD_DIR)/dnsmasq-$(DNSMASQ_UPVER)
-DNSMASQ_BINARY:=dnsmasq
-DNSMASQ_TARGET_BINARY:=usr/sbin/dnsmasq
+DNSMASQ_VERSION = 2.50
+DNSMASQ_SOURCE = dnsmasq-$(DNSMASQ_VERSION).tar.gz
+DNSMASQ_SITE = http://thekelleys.org.uk/dnsmasq
+DNSMASQ_AUTORECONF = NO
+DNSMASQ_MAKE_ENV = CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" LDFLAGS="$(TARGET_LDFLAGS)"
+DNSMASQ_MAKE_OPT = COPTS="$(DNSMASQ_COPTS)" PREFIX=/usr
+DNSMASQ_INSTALL_TARGET_OPT = DESTDIR=$(TARGET_DIR) PREFIX=/usr install
 
-DNSMASQ_COPTS:=
+DNSMASQ_DEPENDENCIES = uclibc
 
 ifneq ($(BR2_INET_IPV6),y)
-DNSMASQ_COPTS+=-DNO_IPV6
+DNSMASQ_COPTS += -DNO_IPV6
+endif
+
+ifneq ($(BR2_PACKAGE_DNSMASQ_DHCP),y)
+DNSMASQ_COPTS += -DNO_DHCP
 endif
 
 ifneq ($(BR2_PACKAGE_DNSMASQ_TFTP),y)
-DNSMASQ_COPTS+=-DNO_TFTP
+DNSMASQ_COPTS += -DNO_TFTP
 endif
 
 ifneq ($(BR2_LARGEFILE),y)
-DNSMASQ_COPTS+=-DNO_LARGEFILE
+DNSMASQ_COPTS += -DNO_LARGEFILE
 endif
 
 ifeq ($(BR2_PACKAGE_DBUS),y)
-DNSMASQ_DBUS:=dbus
-else
-DNSMASQ_DBUS:=
+DNSMASQ_DEPENDENCIES += host-pkgconfig dbus
 endif
 
-$(DL_DIR)/$(DNSMASQ_SOURCE):
-       $(call DOWNLOAD,$(DNSMASQ_SITE),$(DNSMASQ_SOURCE))
+$(eval $(call AUTOTARGETS,package,dnsmasq))
 
-$(DNSMASQ_DIR)/.source: $(DL_DIR)/$(DNSMASQ_SOURCE)
-       $(ZCAT) $(DL_DIR)/$(DNSMASQ_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
-       toolchain/patch-kernel.sh $(DNSMASQ_DIR) package/dnsmasq/ \*.patch
-       touch $@
-
-$(DNSMASQ_DIR)/src/$(DNSMASQ_BINARY): $(DNSMASQ_DIR)/.source $(DNSMASQ_DBUS)
+$(DNSMASQ_TARGET_CONFIGURE):
 ifeq ($(BR2_PACKAGE_DBUS),y)
        $(SED) 's^.*#define HAVE_DBUS.*^#define HAVE_DBUS^' \
                $(DNSMASQ_DIR)/src/config.h
+       $(SED) 's^PKG_CONFIG = pkg-config^PKG_CONFIG = $(PKG_CONFIG_HOST_BINARY)^' \
+               $(DNSMASQ_DIR)/Makefile
+       $(SED) 's^--cflags dbus-1^--cflags dbus-1 \| sed s\\\#-I/\\\#-I$(STAGING_DIR)/\\\#g^' \
+               $(DNSMASQ_DIR)/Makefile
 else
        $(SED) 's^.*#define HAVE_DBUS.*^/* #define HAVE_DBUS */^' \
                $(DNSMASQ_DIR)/src/config.h
 endif
-       $(MAKE) CC=$(TARGET_CC) CFLAGS="$(TARGET_CFLAGS)" AWK=awk \
-               COPTS='$(DNSMASQ_COPTS)' PREFIX=/usr -C $(DNSMASQ_DIR)
-       touch -c $@
+       touch $@
 
-$(TARGET_DIR)/$(DNSMASQ_TARGET_BINARY): $(DNSMASQ_DIR)/src/$(DNSMASQ_BINARY)
-       $(MAKE) DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(DNSMASQ_DIR) install
-       $(STRIPCMD) $(TARGET_DIR)/$(DNSMASQ_TARGET_BINARY)
-       mkdir -p $(TARGET_DIR)/var/lib/misc
-       # Isn't this vulnerable to symlink attacks?
-       ln -sf /tmp/dnsmasq.leases $(TARGET_DIR)/var/lib/misc/dnsmasq.leases
+$(DNSMASQ_HOOK_POST_INSTALL):
 ifneq ($(BR2_HAVE_MANPAGES),y)
-       rm -rf $(TARGET_DIR)/usr/share/man
+       rm -f $(TARGET_DIR)/usr/share/man/man8/dnsmasq.8
 endif
-       touch -c $@
-
-dnsmasq: uclibc $(TARGET_DIR)/$(DNSMASQ_TARGET_BINARY)
 
-dnsmasq-source: $(DL_DIR)/$(DNSMASQ_SOURCE)
-
-dnsmasq-clean:
-       rm -f $(addprefix $(TARGET_DIR)/,var/lib/misc/dnsmasq.leases \
-                                        usr/share/man/man?/dnsmasq.* \
-                                        $(DNSMASQ_TARGET_BINARY))
-       -$(MAKE) -C $(DNSMASQ_DIR) clean
-
-dnsmasq-dirclean:
-       rm -rf $(DNSMASQ_DIR)
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_DNSMASQ),y)
-TARGETS+=dnsmasq
-endif
+$(DNSMASQ_TARGET_UNINSTALL):
+       $(call MESSAGE,"Uninstalling")
+       rm -f $(TARGET_DIR)/usr/sbin/dnsmasq
+       rm -f $(TARGET_DIR)/usr/share/man/man8/dnsmasq.8
+       rm -f $(DNSMASQ_TARGET_INSTALL_TARGET) $(DNSMASQ_HOOK_POST_INSTALL)