From: Daniel Golle Date: Sun, 14 Feb 2021 22:39:24 +0000 (+0000) Subject: odhcpd: setup dhcpv4 server automagically X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d79eeba6887b69d6ee608480d267bd1bef768cb7;p=openwrt%2Fstaging%2Frmilecki.git odhcpd: setup dhcpv4 server automagically Automatically setup dhcpv4 server just like it's done for dhcpv6. To select whether odhcpd or dnsmasq are serving DHCPv4 requests there still is the 'maindhcp' option. To make things less confusing, make sure things really work out-of-the-box in case dnsmasq is not even installed at the time the uci-defaults script is being run. Signed-off-by: Daniel Golle --- diff --git a/package/network/services/odhcpd/Makefile b/package/network/services/odhcpd/Makefile index fe3e526ef16..799a63c23df 100644 --- a/package/network/services/odhcpd/Makefile +++ b/package/network/services/odhcpd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=odhcpd -PKG_RELEASE:=1 +PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcpd.git diff --git a/package/network/services/odhcpd/files/odhcpd.defaults b/package/network/services/odhcpd/files/odhcpd.defaults index 5a1706f7856..1350636ba43 100644 --- a/package/network/services/odhcpd/files/odhcpd.defaults +++ b/package/network/services/odhcpd/files/odhcpd.defaults @@ -11,20 +11,40 @@ json_get_vars protocol json_select .. json_select .. +ODHCPDONLY=0 +V4MODE=disabled +V6MODE=disabled + +[ -e /usr/sbin/dnsmasq ] || ODHCPDONLY=1 + case "$protocol" in # only enable server mode on statically addressed lan ports -"static") [ -e /proc/sys/net/ipv6 ] && MODE=server || MODE=disabled ;; -*) MODE=disabled ;; +"static") + V4MODE=server + [ -e /proc/sys/net/ipv6 ] && V6MODE=server + ;; esac +uci get dhcp.lan 1>/dev/null 2>/dev/null || { +uci batch <