[PATCH 93/94] use/net-eth: add dhcp ipv4 only support for networkd

Konstantin A. Lepikhov lakostis at altlinux.ru
Sat Dec 4 16:52:57 MSK 2021


---
 features.in/net-eth/config.mk                 |  3 +++
 .../net-eth/rootfs/image-scripts.d/50-net-eth | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/features.in/net-eth/config.mk b/features.in/net-eth/config.mk
index dafd3a7f..6fa0b4df 100644
--- a/features.in/net-eth/config.mk
+++ b/features.in/net-eth/config.mk
@@ -25,4 +25,7 @@ use/net-eth/dhcp/timeout/%: use/net-eth/dhcp
 use/net-eth/networkd-dhcp: use/net-eth/networkd
 	@$(call add,NET_ETH,eth0:dhcp)
 
+use/net-eth/networkd-dhcp4: use/net-eth/networkd
+	@$(call add,NET_ETH,eth0:dhcp4)
+
 # use e.g. eth0:static:10.0.0.2/24:10.0.0.1 for predefined static configuration
diff --git a/features.in/net-eth/rootfs/image-scripts.d/50-net-eth b/features.in/net-eth/rootfs/image-scripts.d/50-net-eth
index 92bde492..51c12b29 100755
--- a/features.in/net-eth/rootfs/image-scripts.d/50-net-eth
+++ b/features.in/net-eth/rootfs/image-scripts.d/50-net-eth
@@ -22,7 +22,7 @@ SYSTEMD_IFDIR="/etc/systemd/network"
 
 write_iface() {
 	case "$proto" in
-	dhcp)
+	dhcp*)
 		;;
 	static)
 		[ -n "$ipv4addr" ] || fatal "ipv4addr missing"
@@ -41,7 +41,7 @@ write_etcnet_iface() {
 	mkdir -p "$dir"
 	append=
 	case "$proto" in
-	dhcp)
+	dhcp*)
 		append="DHCP_TIMEOUT=$GLOBAL_NET_ETH_TIMEOUT"
 		;;
 	static)
@@ -62,6 +62,21 @@ write_etcnet_iface() {
 
 write_systemd_iface() {
 	case "$proto" in
+	dhcp4)
+		echo "[Match]"
+		echo "Name=$iface"
+		echo
+		echo "[Network]"
+		echo "DHCP=ipv4"
+		echo "IPv6AcceptRA=no"
+		echo "LinkLocalAddressing=ipv4"
+		echo
+		echo "[DHCP]"
+		echo "UseMTU=yes"
+		echo "UseDomains=yes"
+		echo "UseNTP=yes"
+		echo
+		;;
 	dhcp)
 		echo "[Match]"
 		echo "Name=$iface"
-- 
2.33.0


--yTiz+3OLQ/SQwZTB--


More information about the devel-distro mailing list