[LEDE-DEV] RFC [PATCH] odhcpd: don't enable server mode on dhcp lan

Karl Palsson karlp at etactica.com
Thu Aug 31 10:17:38 PDT 2017


Instead of blindly enabling the odhcpd v6 server and RA server on the
lan port, only do that if the lan port isn't set to DHCP.

This prevents the unhelpful case of a device being a dhcpv4 client and
v6 server on the same ethernet port.

Signed-off-by: Karl Palsson <karlp at etactica.com>
-- 

Should other protocols be excluded?  The list on https://lede-project.org/docs/user-guide/network_configuration
is rather long.  Are there other modes worth considering?

---
 package/network/services/odhcpd/files/odhcpd.defaults | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/package/network/services/odhcpd/files/odhcpd.defaults b/package/network/services/odhcpd/files/odhcpd.defaults
index e184da90acbb..152e63dd18b6 100644
--- a/package/network/services/odhcpd/files/odhcpd.defaults
+++ b/package/network/services/odhcpd/files/odhcpd.defaults
@@ -2,13 +2,23 @@
 uci -q get dhcp.odhcpd && exit 0
 touch /etc/config/dhcp
 
+LANPROTO=$(uci -q get network.lan.proto)
+MODE=server
+
+case "$LANPROTO" in
+"dhcp")
+	echo "odhcpd: Not enabling server mode on a dhcp lan!" > /dev/kmsg
+	MODE=disabled
+	;;
+esac
+
 uci batch <<EOF
 set dhcp.odhcpd=odhcpd
 set dhcp.odhcpd.maindhcp=0
 set dhcp.odhcpd.leasefile=/tmp/hosts/odhcpd
 set dhcp.odhcpd.leasetrigger=/usr/sbin/odhcpd-update
 set dhcp.odhcpd.loglevel=4
-set dhcp.lan.dhcpv6=server
-set dhcp.lan.ra=server
+set dhcp.lan.dhcpv6=$MODE
+set dhcp.lan.ra=$MODE
 commit dhcp
 EOF
-- 
2.4.11




More information about the Lede-dev mailing list