ALT Linux Distributions development
 help / color / mirror / Atom feed
From: Konstantin Lepikhov <lakostis@unsafe.ru>
To: devel-distro@lists.altlinux.org
Subject: [devel-distro] dhcp4 only for use/net-eth
Date: Sat, 4 Dec 2021 22:14:34 +0100
Message-ID: <YavaOl2jsdUFYfPR@lks.home> (raw)

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

Привет!

Иногда бывает полезно запретить networkd проявлять сообразительность и
пытаться конфигурировать сеть для всех протоколов. Для таких случаев
сделал dhcp4 вариант, который настраивает только ipv4 dhcp и запрещает
ipv6.

-- 
WBR et al.

[-- Attachment #2: 0093-use-net-eth-add-dhcp-ipv4-only-support-for-networkd.patch --]
[-- Type: text/x-patch, Size: 1950 bytes --]

>From 5a1ca2562f630821f768c8cdf1072388a3ab55da Mon Sep 17 00:00:00 2001
From: "Konstantin A. Lepikhov" <lakostis@altlinux.ru>
Date: Sat, 4 Dec 2021 14:52:57 +0100
Subject: [PATCH 93/94] use/net-eth: add dhcp ipv4 only support for networkd

---
 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


             reply	other threads:[~2021-12-04 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 21:14 Konstantin Lepikhov [this message]
2021-12-06  6:50 ` Антон Мидюков

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YavaOl2jsdUFYfPR@lks.home \
    --to=lakostis@unsafe.ru \
    --cc=devel-distro@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Distributions development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-distro/0 devel-distro/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-distro devel-distro/ http://lore.altlinux.org/devel-distro \
		devel-distro@lists.altlinux.org devel-distro@lists.altlinux.ru devel-distro@lists.altlinux.com
	public-inbox-index devel-distro

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-distro


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git