connman: implement network interface management techniques

Message ID 20220621140045.3318362-1-muhammad_hamza@mentor.com
State New
Headers show
Series connman: implement network interface management techniques | expand

Commit Message

Hamza, Muhammad June 21, 2022, 2 p.m. UTC
This is required to obtain a managed network interface before connman
tries to call cleanup_devices function, this will let connman
create new routing table without bringing down the ethernet interface.

Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com>
---
 ...t-network-interface-management-techn.patch | 31 +++++++++++++++++++
 .../connman/connman_1.41.bb                   |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch

Comments

Alexander Kanavin June 21, 2022, 2:01 p.m. UTC | #1
This looks like it should be going to connman upstream, not to
openembedded-core?

Alex

On Tue, 21 Jun 2022 at 16:01, Muhammad Hamza <Muhammad_Hamza@mentor.com> wrote:
>
> This is required to obtain a managed network interface before connman
> tries to call cleanup_devices function, this will let connman
> create new routing table without bringing down the ethernet interface.
>
> Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
> Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com>
> ---
>  ...t-network-interface-management-techn.patch | 31 +++++++++++++++++++
>  .../connman/connman_1.41.bb                   |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644 meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
>
> diff --git a/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch b/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
> new file mode 100644
> index 0000000000..06695ea566
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
> @@ -0,0 +1,31 @@
> +From e6dedb531096f29825bddaf428ca8d3c4ad1df26 Mon Sep 17 00:00:00 2001
> +From: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
> +Date: Tue, 1 Jul 2014 23:47:15 +0530
> +Subject: [PATCH] connman: implement network interface management techniques
> +
> +This is required to obtain a managed network interface before connman
> +tries to call cleanup_devices function, this will let connman
> +create new routing table without bringing down the ethernet interface.
> +
> +Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
> +
> +---
> + src/connman.service.in | 5 ++++-
> + 1 file changed, 4 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/connman.service.in b/src/connman.service.in
> +index 79e75d6..0e7275a 100644
> +--- a/src/connman.service.in
> ++++ b/src/connman.service.in
> +@@ -12,7 +12,10 @@ Conflicts=systemd-resolved.service
> + Type=dbus
> + BusName=net.connman
> + Restart=on-failure
> +-ExecStart=@sbindir@/connmand -n
> ++EnvironmentFile=-/tmp/connman.env
> ++ExecStartPre=/bin/sh -c "if grep 'nfsroot\|ip=' /proc/cmdline; then ETH_IFACE=$(ip addr | grep 'eth[0-9]:' | grep 'UP' | sed -e 's,\(eth[0-9]\)\(.*\),\1,' -e 's,^.*: ,,' ); NET_ADDR=$(cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'); echo -e 'OPT=-I '$ETH_IFACE'\nOPT2='$ETH_IFACE'\nNET_ADDR='$NET_ADDR' ' > /tmp/connman.env; fi "
> ++ExecStart=/bin/sh -c "if [ \"$NET_ADDR\" = \"off\" ] || [ \"$NET_ADDR\" = \"none\" ]; then /usr/sbin/connmand -n; else /usr/sbin/connmand -n $OPT; fi"
> ++ExecStartPost=/bin/sh -c "if [ ! -z \"$OPT\" ] && [ \"$NET_ADDR\" = \"dhcp\" ]; then /sbin/udhcpc -i $OPT2; fi"
> + StandardOutput=null
> + CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_ADMIN
> + ProtectHome=true
> diff --git a/meta/recipes-connectivity/connman/connman_1.41.bb b/meta/recipes-connectivity/connman/connman_1.41.bb
> index 736b78eaeb..9c09a71f46 100644
> --- a/meta/recipes-connectivity/connman/connman_1.41.bb
> +++ b/meta/recipes-connectivity/connman/connman_1.41.bb
> @@ -5,6 +5,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
>             file://0001-connman.service-stop-systemd-resolved-when-we-use-co.patch \
>             file://connman \
>             file://no-version-scripts.patch \
> +           file://0001-connman-implement-network-interface-management-techn.patch \
>             "
>
>  SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#167151): https://lists.openembedded.org/g/openembedded-core/message/167151
> Mute This Topic: https://lists.openembedded.org/mt/91900036/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie June 21, 2022, 4:43 p.m. UTC | #2
On Tue, 2022-06-21 at 19:00 +0500, Muhammad Hamza wrote:
> This is required to obtain a managed network interface before connman
> tries to call cleanup_devices function, this will let connman
> create new routing table without bringing down the ethernet interface.
> 
> Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
> Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com>
> ---
>  ...t-network-interface-management-techn.patch | 31 +++++++++++++++++++
>  .../connman/connman_1.41.bb                   |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644 meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
> 
> diff --git a/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch b/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
> new file mode 100644
> index 0000000000..06695ea566
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
> @@ -0,0 +1,31 @@
> +From e6dedb531096f29825bddaf428ca8d3c4ad1df26 Mon Sep 17 00:00:00 2001
> +From: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
> +Date: Tue, 1 Jul 2014 23:47:15 +0530
> +Subject: [PATCH] connman: implement network interface management techniques
> +
> +This is required to obtain a managed network interface before connman
> +tries to call cleanup_devices function, this will let connman
> +create new routing table without bringing down the ethernet interface.
> +
> +Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
> +
> +---
> + src/connman.service.in | 5 ++++-
> + 1 file changed, 4 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/connman.service.in b/src/connman.service.in
> +index 79e75d6..0e7275a 100644
> +--- a/src/connman.service.in
> ++++ b/src/connman.service.in
> +@@ -12,7 +12,10 @@ Conflicts=systemd-resolved.service
> + Type=dbus
> + BusName=net.connman
> + Restart=on-failure
> +-ExecStart=@sbindir@/connmand -n
> ++EnvironmentFile=-/tmp/connman.env
> ++ExecStartPre=/bin/sh -c "if grep 'nfsroot\|ip=' /proc/cmdline; then ETH_IFACE=$(ip addr | grep 'eth[0-9]:' | grep 'UP' | sed -e 's,\(eth[0-9]\)\(.*\),\1,' -e 's,^.*: ,,' ); NET_ADDR=$(cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'); echo -e 'OPT=-I '$ETH_IFACE'\nOPT2='$ETH_IFACE'\nNET_ADDR='$NET_ADDR' ' > /tmp/connman.env; fi "
> ++ExecStart=/bin/sh -c "if [ \"$NET_ADDR\" = \"off\" ] || [ \"$NET_ADDR\" = \"none\" ]; then /usr/sbin/connmand -n; else /usr/sbin/connmand -n $OPT; fi"
> ++ExecStartPost=/bin/sh -c "if [ ! -z \"$OPT\" ] && [ \"$NET_ADDR\" = \"dhcp\" ]; then /sbin/udhcpc -i $OPT2; fi"
> + StandardOutput=null
> + CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_ADMIN
> + ProtectHome=true
> diff --git a/meta/recipes-connectivity/connman/connman_1.41.bb b/meta/recipes-connectivity/connman/connman_1.41.bb
> index 736b78eaeb..9c09a71f46 100644
> --- a/meta/recipes-connectivity/connman/connman_1.41.bb
> +++ b/meta/recipes-connectivity/connman/connman_1.41.bb
> @@ -5,6 +5,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
>             file://0001-connman.service-stop-systemd-resolved-when-we-use-co.patch \
>             file://connman \
>             file://no-version-scripts.patch \
> +           file://0001-connman-implement-network-interface-management-techn.patch \
>             "
>  
>  SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"

This definitely needs upstream discussion.

I'd love to understand if this is causing some of our intermittent
issues on the autobuilder around connectivity but the description
included here doesn't really let me do that either. Is there any more
information on this anywhere?

Cheers,

Richard

Patch

diff --git a/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch b/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
new file mode 100644
index 0000000000..06695ea566
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/0001-connman-implement-network-interface-management-techn.patch
@@ -0,0 +1,31 @@ 
+From e6dedb531096f29825bddaf428ca8d3c4ad1df26 Mon Sep 17 00:00:00 2001
+From: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
+Date: Tue, 1 Jul 2014 23:47:15 +0530
+Subject: [PATCH] connman: implement network interface management techniques
+
+This is required to obtain a managed network interface before connman
+tries to call cleanup_devices function, this will let connman
+create new routing table without bringing down the ethernet interface.
+
+Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
+
+---
+ src/connman.service.in | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/connman.service.in b/src/connman.service.in
+index 79e75d6..0e7275a 100644
+--- a/src/connman.service.in
++++ b/src/connman.service.in
+@@ -12,7 +12,10 @@ Conflicts=systemd-resolved.service
+ Type=dbus
+ BusName=net.connman
+ Restart=on-failure
+-ExecStart=@sbindir@/connmand -n
++EnvironmentFile=-/tmp/connman.env
++ExecStartPre=/bin/sh -c "if grep 'nfsroot\|ip=' /proc/cmdline; then ETH_IFACE=$(ip addr | grep 'eth[0-9]:' | grep 'UP' | sed -e 's,\(eth[0-9]\)\(.*\),\1,' -e 's,^.*: ,,' ); NET_ADDR=$(cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'); echo -e 'OPT=-I '$ETH_IFACE'\nOPT2='$ETH_IFACE'\nNET_ADDR='$NET_ADDR' ' > /tmp/connman.env; fi "
++ExecStart=/bin/sh -c "if [ \"$NET_ADDR\" = \"off\" ] || [ \"$NET_ADDR\" = \"none\" ]; then /usr/sbin/connmand -n; else /usr/sbin/connmand -n $OPT; fi"
++ExecStartPost=/bin/sh -c "if [ ! -z \"$OPT\" ] && [ \"$NET_ADDR\" = \"dhcp\" ]; then /sbin/udhcpc -i $OPT2; fi"
+ StandardOutput=null
+ CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_ADMIN
+ ProtectHome=true
diff --git a/meta/recipes-connectivity/connman/connman_1.41.bb b/meta/recipes-connectivity/connman/connman_1.41.bb
index 736b78eaeb..9c09a71f46 100644
--- a/meta/recipes-connectivity/connman/connman_1.41.bb
+++ b/meta/recipes-connectivity/connman/connman_1.41.bb
@@ -5,6 +5,7 @@  SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
            file://0001-connman.service-stop-systemd-resolved-when-we-use-co.patch \
            file://connman \
            file://no-version-scripts.patch \
+           file://0001-connman-implement-network-interface-management-techn.patch \
            "
 
 SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"