All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] Configure wired network interface with dhcp for systemd
@ 2019-05-21  9:22 kai.kang
  2019-05-21  9:22 ` [PATCH v2 1/1] systemd-conf: configure wired network with dhcp kai.kang
  0 siblings, 1 reply; 6+ messages in thread
From: kai.kang @ 2019-05-21  9:22 UTC (permalink / raw)
  To: alex.kiernan, raj.khem; +Cc: paul.eggleton, openembedded-core

From: Kai Kang <kai.kang@windriver.com>

v2:
Refer to https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd

* add section 'DHCP' in dhcp.network which could solve got 2 ips when connman is installed
* not install the configure file for qemu

Kai Kang (1):
  systemd-conf: configure wired network with dhcp

 meta/recipes-core/systemd/systemd-conf/dhcp.network | 9 +++++++++
 meta/recipes-core/systemd/systemd-conf_242.bb       | 5 +++++
 2 files changed, 14 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd-conf/dhcp.network

-- 
2.20.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/1] systemd-conf: configure wired network with dhcp
  2019-05-21  9:22 [PATCH v2 0/1] Configure wired network interface with dhcp for systemd kai.kang
@ 2019-05-21  9:22 ` kai.kang
  2019-05-21 12:09   ` Richard Purdie
  2019-05-21 17:37   ` Khem Raj
  0 siblings, 2 replies; 6+ messages in thread
From: kai.kang @ 2019-05-21  9:22 UTC (permalink / raw)
  To: alex.kiernan, raj.khem; +Cc: paul.eggleton, openembedded-core

From: Kai Kang <kai.kang@windriver.com>

Add a configure file for systemd.networkd to configure wired network
interfaces with dhcp. It works with common network interfaces such eth0
and eno1.

Refer to
https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd

[YOCTO #13057]

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 meta/recipes-core/systemd/systemd-conf/dhcp.network | 9 +++++++++
 meta/recipes-core/systemd/systemd-conf_242.bb       | 5 +++++
 2 files changed, 14 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd-conf/dhcp.network

diff --git a/meta/recipes-core/systemd/systemd-conf/dhcp.network b/meta/recipes-core/systemd/systemd-conf/dhcp.network
new file mode 100644
index 0000000000..253aee9382
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf/dhcp.network
@@ -0,0 +1,9 @@
+[Match]
+Name=en* eth*
+
+[Network]
+DHCP=yes
+
+[DHCP]
+RouteMetric=10
+ClientIdentifier=mac
diff --git a/meta/recipes-core/systemd/systemd-conf_242.bb b/meta/recipes-core/systemd/systemd-conf_242.bb
index 96beea53a7..105ee3ceed 100644
--- a/meta/recipes-core/systemd/systemd-conf_242.bb
+++ b/meta/recipes-core/systemd/systemd-conf_242.bb
@@ -10,12 +10,16 @@ SRC_URI = "\
     file://logind.conf \
     file://system.conf \
     file://system.conf-qemuall \
+    file://dhcp.network \
 "
 
 do_install() {
 	install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf
 	install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
 	install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf
+	if ${@bb.utils.contains('OVERRIDES', 'qemuall', 'false', 'true', d)}; then
+		install -D -m0644 ${WORKDIR}/dhcp.network ${D}${systemd_unitdir}/network/80-dhcp.network
+	fi
 }
 
 # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
@@ -29,4 +33,5 @@ FILES_${PN} = "\
     ${systemd_unitdir}/journald.conf.d/ \
     ${systemd_unitdir}/logind.conf.d/ \
     ${systemd_unitdir}/system.conf.d/ \
+    ${systemd_unitdir}/network/ \
 "
-- 
2.20.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] systemd-conf: configure wired network with dhcp
  2019-05-21  9:22 ` [PATCH v2 1/1] systemd-conf: configure wired network with dhcp kai.kang
@ 2019-05-21 12:09   ` Richard Purdie
  2019-05-23  1:47     ` Kang Kai
  2019-05-21 17:37   ` Khem Raj
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2019-05-21 12:09 UTC (permalink / raw)
  To: kai.kang, alex.kiernan, raj.khem; +Cc: paul.eggleton, openembedded-core

On Tue, 2019-05-21 at 05:22 -0400, kai.kang@windriver.com wrote:
> From: Kai Kang <kai.kang@windriver.com>
> 
> Add a configure file for systemd.networkd to configure wired network
> interfaces with dhcp. It works with common network interfaces such
> eth0
> and eno1.
> 
> Refer to
> https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd
> 
> [YOCTO #13057]
> 
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
>  meta/recipes-core/systemd/systemd-conf/dhcp.network | 9 +++++++++
>  meta/recipes-core/systemd/systemd-conf_242.bb       | 5 +++++
>  2 files changed, 14 insertions(+)
>  create mode 100644 meta/recipes-core/systemd/systemd-
> conf/dhcp.network

This seems to result in the failures in:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/617

Cheers,

Richard



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] systemd-conf: configure wired network with dhcp
  2019-05-21  9:22 ` [PATCH v2 1/1] systemd-conf: configure wired network with dhcp kai.kang
  2019-05-21 12:09   ` Richard Purdie
@ 2019-05-21 17:37   ` Khem Raj
  2019-05-22  2:11     ` Kang Kai
  1 sibling, 1 reply; 6+ messages in thread
From: Khem Raj @ 2019-05-21 17:37 UTC (permalink / raw)
  To: Kang Kai; +Cc: Paul Eggleton, Patches and discussions about the oe-core layer

just copy paste from meta-yoe, that has been long working.

On Tue, May 21, 2019 at 2:23 AM <kai.kang@windriver.com> wrote:
>
> From: Kai Kang <kai.kang@windriver.com>
>
> Add a configure file for systemd.networkd to configure wired network
> interfaces with dhcp. It works with common network interfaces such eth0
> and eno1.
>
> Refer to
> https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd
>
> [YOCTO #13057]
>
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
>  meta/recipes-core/systemd/systemd-conf/dhcp.network | 9 +++++++++
>  meta/recipes-core/systemd/systemd-conf_242.bb       | 5 +++++
>  2 files changed, 14 insertions(+)
>  create mode 100644 meta/recipes-core/systemd/systemd-conf/dhcp.network
>
> diff --git a/meta/recipes-core/systemd/systemd-conf/dhcp.network b/meta/recipes-core/systemd/systemd-conf/dhcp.network
> new file mode 100644
> index 0000000000..253aee9382
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd-conf/dhcp.network
> @@ -0,0 +1,9 @@
> +[Match]
> +Name=en* eth*

I think this is better put
Name=en*
Name=eth*

> +
> +[Network]
> +DHCP=yes
> +
> +[DHCP]
> +RouteMetric=10
> +ClientIdentifier=mac
> diff --git a/meta/recipes-core/systemd/systemd-conf_242.bb b/meta/recipes-core/systemd/systemd-conf_242.bb
> index 96beea53a7..105ee3ceed 100644
> --- a/meta/recipes-core/systemd/systemd-conf_242.bb
> +++ b/meta/recipes-core/systemd/systemd-conf_242.bb
> @@ -10,12 +10,16 @@ SRC_URI = "\
>      file://logind.conf \
>      file://system.conf \
>      file://system.conf-qemuall \
> +    file://dhcp.network \

better to call it wired or something

>  "
>
>  do_install() {
>         install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf
>         install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
>         install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf
> +       if ${@bb.utils.contains('OVERRIDES', 'qemuall', 'false', 'true', d)}; then
> +               install -D -m0644 ${WORKDIR}/dhcp.network ${D}${systemd_unitdir}/network/80-dhcp.network
> +       fi
>  }
>
>  # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
> @@ -29,4 +33,5 @@ FILES_${PN} = "\
>      ${systemd_unitdir}/journald.conf.d/ \
>      ${systemd_unitdir}/logind.conf.d/ \
>      ${systemd_unitdir}/system.conf.d/ \
> +    ${systemd_unitdir}/network/ \
>  "
> --
> 2.20.0
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] systemd-conf: configure wired network with dhcp
  2019-05-21 17:37   ` Khem Raj
@ 2019-05-22  2:11     ` Kang Kai
  0 siblings, 0 replies; 6+ messages in thread
From: Kang Kai @ 2019-05-22  2:11 UTC (permalink / raw)
  To: Khem Raj; +Cc: Paul Eggleton, Patches and discussions about the oe-core layer

On 2019/5/22 上午1:37, Khem Raj wrote:
> just copy paste from meta-yoe, that has been long working.
>
> On Tue, May 21, 2019 at 2:23 AM <kai.kang@windriver.com> wrote:
>> From: Kai Kang <kai.kang@windriver.com>
>>
>> Add a configure file for systemd.networkd to configure wired network
>> interfaces with dhcp. It works with common network interfaces such eth0
>> and eno1.
>>
>> Refer to
>> https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd
>>
>> [YOCTO #13057]
>>
>> Signed-off-by: Kai Kang <kai.kang@windriver.com>
>> ---
>>   meta/recipes-core/systemd/systemd-conf/dhcp.network | 9 +++++++++
>>   meta/recipes-core/systemd/systemd-conf_242.bb       | 5 +++++
>>   2 files changed, 14 insertions(+)
>>   create mode 100644 meta/recipes-core/systemd/systemd-conf/dhcp.network
>>
>> diff --git a/meta/recipes-core/systemd/systemd-conf/dhcp.network b/meta/recipes-core/systemd/systemd-conf/dhcp.network
>> new file mode 100644
>> index 0000000000..253aee9382
>> --- /dev/null
>> +++ b/meta/recipes-core/systemd/systemd-conf/dhcp.network
>> @@ -0,0 +1,9 @@
>> +[Match]
>> +Name=en* eth*
> I think this is better put
> Name=en*
> Name=eth*

Accodring to systemd.network(5),

        Name=
            A whitespace-separated list of shell-style globs matching 
the device name, as exposed by the udev property "INTERFACE".

It also says:

        A network file is said to match a device if each of the entries 
in the "[Match]" section matches, or if the section is empty.

So I perfer to use put them in one line "Name=en* eth*".

Also check systemd source code,

neil@pek-kkang-d1:/mnt/sda4/git/systemd
$ find . -name *.network -exec grep -H -c ^Name= {} \; | grep -v 1$
neil@pek-kkang-d1:/mnt/sda4/git/systemd
$ find . -name *.network -exec grep -H 'Name=\S\+\s\S' {} \;
./test/test-network/conf/25-tunnel-remote-any.network:Name=*tun97 ip6tnl97
./test/test-network/conf/bond-slave.network:Name=dummy98 test1
./test/test-network/conf/25-tunnel.network:Name=*tun99 *tap99 ip6tnl99 
erspan99
./test/test-network/conf/25-tunnel-local-any.network:Name=*tun98 *tap98 
ip6tnl98 erspan98


>> +
>> +[Network]
>> +DHCP=yes
>> +
>> +[DHCP]
>> +RouteMetric=10
>> +ClientIdentifier=mac
>> diff --git a/meta/recipes-core/systemd/systemd-conf_242.bb b/meta/recipes-core/systemd/systemd-conf_242.bb
>> index 96beea53a7..105ee3ceed 100644
>> --- a/meta/recipes-core/systemd/systemd-conf_242.bb
>> +++ b/meta/recipes-core/systemd/systemd-conf_242.bb
>> @@ -10,12 +10,16 @@ SRC_URI = "\
>>       file://logind.conf \
>>       file://system.conf \
>>       file://system.conf-qemuall \
>> +    file://dhcp.network \
> better to call it wired or something

OK. Will install as 80-wired.network.

Regards,
Kai


>
>>   "
>>
>>   do_install() {
>>          install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf
>>          install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
>>          install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf
>> +       if ${@bb.utils.contains('OVERRIDES', 'qemuall', 'false', 'true', d)}; then
>> +               install -D -m0644 ${WORKDIR}/dhcp.network ${D}${systemd_unitdir}/network/80-dhcp.network
>> +       fi
>>   }
>>
>>   # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
>> @@ -29,4 +33,5 @@ FILES_${PN} = "\
>>       ${systemd_unitdir}/journald.conf.d/ \
>>       ${systemd_unitdir}/logind.conf.d/ \
>>       ${systemd_unitdir}/system.conf.d/ \
>> +    ${systemd_unitdir}/network/ \
>>   "
>> --
>> 2.20.0
>>

-- 
Kai Kang



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/1] systemd-conf: configure wired network with dhcp
  2019-05-21 12:09   ` Richard Purdie
@ 2019-05-23  1:47     ` Kang Kai
  0 siblings, 0 replies; 6+ messages in thread
From: Kang Kai @ 2019-05-23  1:47 UTC (permalink / raw)
  To: Richard Purdie, alex.kiernan, raj.khem; +Cc: paul.eggleton, openembedded-core

On 2019/5/21 下午8:09, Richard Purdie wrote:
> On Tue, 2019-05-21 at 05:22 -0400, kai.kang@windriver.com wrote:
>> From: Kai Kang <kai.kang@windriver.com>
>>
>> Add a configure file for systemd.networkd to configure wired network
>> interfaces with dhcp. It works with common network interfaces such
>> eth0
>> and eno1.
>>
>> Refer to
>> https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd
>>
>> [YOCTO #13057]
>>
>> Signed-off-by: Kai Kang <kai.kang@windriver.com>
>> ---
>>   meta/recipes-core/systemd/systemd-conf/dhcp.network | 9 +++++++++
>>   meta/recipes-core/systemd/systemd-conf_242.bb       | 5 +++++
>>   2 files changed, 14 insertions(+)
>>   create mode 100644 meta/recipes-core/systemd/systemd-
>> conf/dhcp.network
> This seems to result in the failures in:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/617

Sorry, there was something wrong during my verify build and test. v3 
will be sent.

Regards,
Kai


>
> Cheers,
>
> Richard
>
>

-- 
Kai Kang



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-23  1:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21  9:22 [PATCH v2 0/1] Configure wired network interface with dhcp for systemd kai.kang
2019-05-21  9:22 ` [PATCH v2 1/1] systemd-conf: configure wired network with dhcp kai.kang
2019-05-21 12:09   ` Richard Purdie
2019-05-23  1:47     ` Kang Kai
2019-05-21 17:37   ` Khem Raj
2019-05-22  2:11     ` Kang Kai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.