diff --git a/dhcpmngr/Makefile b/dhcpmngr/Makefile index eea20c24f..0e05ffaee 100644 --- a/dhcpmngr/Makefile +++ b/dhcpmngr/Makefile @@ -28,7 +28,9 @@ define Package/dhcpmngr SECTION:=net CATEGORY:=Network TITLE:=Package to add Device.DHCPv4 and v6 data model support. - DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +dnsmasq + DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +odhcpd + DEPENDS+=+DNSMNGR_DNS_SD:umdns + DEPENDS+=+DNSMNGR_BACKEND_DNSMASQ:dnsmasq endef define Package/dhcpmngr/description @@ -44,6 +46,10 @@ endif define Package/dhcpmngr/install $(INSTALL_DIR) $(1)/etc/udhcpc.user.d $(INSTALL_BIN) ./files/etc/udhcpc.user.d/udhcpc_lease_start_time.user $(1)/etc/udhcpc.user.d/udhcpc_lease_start_time.user +ifeq ($(CONFIG_DNSMNGR_BACKEND_UNBOUND),y) + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DATA) ./files/etc/uci-defaults/unbound.odhcpd.uci_default $(1)/etc/uci-defaults/16-set-unbound-as-odhcpd-leasetrigger +endif $(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libdhcpmngr.so $(1) $(PKG_NAME) endef diff --git a/dhcpmngr/files/etc/uci-defaults/unbound.odhcpd.uci_default b/dhcpmngr/files/etc/uci-defaults/unbound.odhcpd.uci_default new file mode 100644 index 000000000..600b1efd8 --- /dev/null +++ b/dhcpmngr/files/etc/uci-defaults/unbound.odhcpd.uci_default @@ -0,0 +1,18 @@ +#!/bin/sh + +# update odhcpd uci to use unbound's script as leasetrigger +uci -q get dhcp.odhcpd >/dev/null 2>&1 && { + maindhcp="$(uci -q get dhcp.odhcpd.maindhcp)" + + # if odhcpd is the main dhcp + [ "$maindhcp" = "1" ] || [ "$maindhcp" = "true" ] || [ "$maindhcp" = "on" ] && { + # if unbound daemon and unbound script file is present + [ -e /usr/lib/unbound/odhcpd.sh ] && [ -e /usr/sbin/unbound ] && { + # then set unbound script as leasetrigger in dhcp UCI + uci -q set dhcp.odhcpd.leasetrigger='/usr/lib/unbound/odhcpd.sh' + uci commit dhcp + } + } +} + +exit 0 diff --git a/dnsmngr/Config.in b/dnsmngr/Config.in index 5c68807b2..a4e6aaada 100644 --- a/dnsmngr/Config.in +++ b/dnsmngr/Config.in @@ -8,5 +8,23 @@ config DNSMNGR_DNS_SD help Set this option to include support for TR-181 DNS.SD. object. +choice + prompt "Select backend for DNS management" + default DNSMNGR_BACKEND_DNSMASQ + depends on PACKAGE_dnsmngr + help + Select which backend daemon to use for DNS + +config DNSMNGR_BACKEND_DNSMASQ + bool "Use dnsmasq for dns and dhcp" + help + Enable this option to use dnsmasq + odhcpd for dns and dhcp. + +config DNSMNGR_BACKEND_UNBOUND + bool "Use unbound with odhcpd-full for dns and dhcp" + help + Enable this option to use unbound + odhcpd for dns and dhcp. + +endchoice endmenu endif diff --git a/dnsmngr/Makefile b/dnsmngr/Makefile index 0128738ca..2bb8e1a4e 100644 --- a/dnsmngr/Makefile +++ b/dnsmngr/Makefile @@ -27,13 +27,15 @@ MAKE_PATH:=src define Package/dnsmngr SECTION:=net CATEGORY:=Network - DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +dnsmasq + DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +odhcpd DEPENDS+=+DNSMNGR_DNS_SD:umdns - TITLE:=Package to add Device.DNS. datamodel support + DEPENDS+=+DNSMNGR_BACKEND_DNSMASQ:dnsmasq + DEPENDS+=+DNSMNGR_BACKEND_UNBOUND:unbound-daemon +DNSMNGR_BACKEND_UNBOUND:unbound-control + TITLE:=Package to configure DNS backend and TR-181 support endef define Package/dnsmngr/description - Package to add Device.DNS. datamodel support. + Package to configure DNS backend and TR-181 support. endef define Package/$(PKG_NAME)/config @@ -56,6 +58,10 @@ define Build/Prepare endef endif +ifeq ($(CONFIG_DNSMNGR_BACKEND_DNSMASQ),y) + TARGET_CFLAGS += -DDNSMASQ_BACKEND +endif + define Package/dnsmngr/install $(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libdnsmngr.so $(1) $(PKG_NAME) $(BBFDM_INSTALL_SCRIPT) -d $(PKG_BUILD_DIR)/scripts/nslookup $(1)