Skip to contentSkip to conversation

systemd: add network config while networkd supported

PATCH In review Hongxu Jia 4 participants 6 messages Nov 3, 2014

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover systemd: add network config while networkd supported

The following changes since commit f19b4e995ea47f9243f152b39337330307453c9f:

bitbake: bitbake: clarify startup message (2014-10-30 13:39:52 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-systemd-network
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-systemd-network

Hongxu Jia (1):
systemd: add network config while networkd supported

 meta/recipes-core/systemd/systemd/oe-core.network | 8 ++++++++
 meta/recipes-core/systemd/systemd_216.bb          | 6 ++++++
 2 files changed, 14 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/oe-core.network
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 systemd: add network config while networkd supported

While networkd supported, we add network config which starts dhcp by default.

And the customers could edit it according their own requirements. (dhcp or static ip...)

It refers:
https://wiki.archlinux.org/index.php/systemd-networkd

---
 meta/recipes-core/systemd/systemd/oe-core.network | 8 ++++++++
 meta/recipes-core/systemd/systemd_216.bb          | 6 ++++++
 2 files changed, 14 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/oe-core.network
meta/recipes-core/systemd/systemd/oe-core.network new file +8 -0
new file mode 100644
index 0000000..fcaefc2
@@ -0,0 +1,8 @@
+[Match]
+Name=eth*
+
+[Network]
+DHCP=v4
+
+[DHCPv4]
+UseHostname=false
meta/recipes-core/systemd/systemd_216.bb +6 -0
index 6d3e47f..dae1cb8 100644
@@ -37,6 +37,7 @@ SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=
            file://00-create-volatile.conf \
            file://init \
            file://run-ptest \
+           file://oe-core.network \
            ${@bb.utils.contains('PACKAGECONFIG', 'resolved', '', 'file://0001-tmpfiles.d-etc.conf-disable-resolv.conf-symlink.patch', d)} \
           "
 
@@ -137,6 +138,11 @@ do_install() {
         # Delete journal README, as log can be symlinked inside volatile.
         rm -f ${D}/${localstatedir}/log/README
 
+	# While networkd enabled, it start dhcp by default
+	if ${@bb.utils.contains('PACKAGECONFIG','networkd','true','false',d)}; then
+		install -m 0755 ${WORKDIR}/oe-core.network ${D}${sysconfdir}/systemd/network
+	fi
+
 	# Create symlinks for systemd-update-utmp-runlevel.service
 	install -d ${D}${systemd_unitdir}/system/graphical.target.wants
 	install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
Signature · 1 line
1.9.1
#2 lore raw

meta/recipes-core/systemd/systemd/oe-core.network

Quoted 24 lines

Op 3 nov. 2014, om 08:37 heeft Hongxu Jia <[email protected]> het volgende geschreven:

While networkd supported, we add network config which starts dhcp by default.

And the customers could edit it according their own requirements. (dhcp or static ip...)

It refers:
https://wiki.archlinux.org/index.php/systemd-networkd

---
meta/recipes-core/systemd/systemd/oe-core.network | 8 ++++++++
meta/recipes-core/systemd/systemd_216.bb | 6 ++++++

2 files changed, 14 insertions(+)

create mode 100644 meta/recipes-core/systemd/systemd/oe-core.network

meta/recipes-core/systemd/systemd/oe-core.network new file +0 -0
new file mode 100644
index 0000000..fcaefc2

First: config files on the target shouldn't be named after the buildsystem, a better name would be 'ethernet.network' or something similar

meta/recipes-core/systemd/systemd/oe-core.network line 2

Quoted 3 lines
meta/recipes-core/systemd/systemd/oe-core.network new file +2 -0
@@ -0,0 +1,8 @@
+[Match]
+Name=eth*

Add 'en*' as well for pci devices that get renamed by udev

meta/recipes-core/systemd/systemd/oe-core.network line 5

Quoted 2 lines
meta/recipes-core/systemd/systemd/oe-core.network new file +2 -0
+[Network]
+DHCP=v4

DHCP=both or DHCP=yes would be better since that would include dhcpv6 as well

meta/recipes-core/systemd/systemd/oe-core.network line 8

Quoted 2 lines
meta/recipes-core/systemd/systemd/oe-core.network new file +2 -0
+[DHCPv4]
+UseHostname=false

Why? Using the hostname makes DHCP logs a lot easier to debug.

#3 lore raw
In reply to Hongxu Jia
Quoted 8 lines

Op 3 nov. 2014, om 08:37 heeft Hongxu Jia <[email protected]> het volgende geschreven:

While networkd supported, we add network config which starts dhcp by default.

And the customers could edit it according their own requirements. (dhcp or static ip...)

Another thing: don't put this in the main systemd recipe, forcing layers to bbappend systemd_git.bb for only a networking config file is hazardous and too invasive due to sstate invalidation. I don't want to be forced to rebuild Xorg and flood people with updated packages in the feeds because I, or worse, some random layer wants to change the default network settings.

#4 lore raw
In reply to Hongxu Jia

meta/recipes-core/systemd/systemd/oe-core.network line 8

Quoted 13 lines · Hongxu Jia

While networkd supported, we add network config which starts dhcp by default.
...
+++ b/meta/recipes-core/systemd/systemd/oe-core.network

meta/recipes-core/systemd/systemd/oe-core.network new file +8 -0
@@ -0,0 +1,8 @@
+[Match]
+Name=eth*
+
+[Network]
+DHCP=v4
+
+[DHCPv4]
+UseHostname=false

IMO, this is too much a target specific customization. DHCP is not used everywhere; it might conflict with NFS rootfs, there are different preferences for the DHCP options (UseDomains, VendorClassIdentifier, CriticalConnection, ...).

It would be better to place this confguration into a separate recipe.

meta/recipes-core/systemd/systemd_216.bb do_install() { · line 143

Quoted 1 line
meta/recipes-core/systemd/systemd_216.bb +1 -0
+		install -m 0755 ${WORKDIR}/oe-core.network ${D}${sysconfdir}/systemd/network

You should name this file like '50-oe-core.network' to make it easier to override it.

Enrico

#5 lore raw
In reply to Hongxu Jia

Hi,

In my opinion, in the actual form, this patch cannot be taken in.
Reasons/questions:
1. How exactly this has been tested? I don't see any details. Testing network configs and doing modifications of this kind are sensible matters.
2. Different images have different ways of setting up network; for example, core-image-sato will manage network setup using conmman; has this configuration been tested?
3. How exactly is decided if networkd is active or not in a systemd-based Linux image?
4. Please go into details why exactly this patch has been submitted (what it tries to solve in the first place).

Regards,
Cristian

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Hongxu Jia
Sent: Monday, November 3, 2014 9:38 AM
To: [email protected]; Burton, Ross; Chen, Qi (Wind River)
Subject: [OE-core] [PATCH 0/1] systemd: add network config while networkd supported

The following changes since commit f19b4e995ea47f9243f152b39337330307453c9f:

bitbake: bitbake: clarify startup message (2014-10-30 13:39:52 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-systemd-network
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-systemd-network

Hongxu Jia (1):
systemd: add network config while networkd supported

 meta/recipes-core/systemd/systemd/oe-core.network | 8 ++++++++
 meta/recipes-core/systemd/systemd_216.bb          | 6 ++++++
 2 files changed, 14 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/oe-core.network
Signature · 7 lines
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core