All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] systemd: Fix interface bring-up on kernels >= 5.2
@ 2019-07-09  8:43 Ricardo Ribalda Delgado
  2019-07-09  9:01 ` ✗ patchtest: failure for " Patchwork
  2019-07-09 11:12 ` [PATCH] " Alex Kiernan
  0 siblings, 2 replies; 5+ messages in thread
From: Ricardo Ribalda Delgado @ 2019-07-09  8:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ricardo Ribalda Delgado

With kernels >=5.2  systemd-networkd is unable to bring up the link.

eth0: Could not bring up interface: Invalid argument

This is already reported upstream and fixed on master:

https://github.com/systemd/systemd/issues/12784

They recommend Debian to backport two patches.

Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
---
 .../systemd/0001-networkd-fix-link-up.patch   | 66 +++++++++++++
 .../0002-network-do-not-send-ipv6.patch       | 96 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_242.bb      |  2 +
 3 files changed, 164 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0001-networkd-fix-link-up.patch
 create mode 100644 meta/recipes-core/systemd/systemd/0002-network-do-not-send-ipv6.patch

diff --git a/meta/recipes-core/systemd/systemd/0001-networkd-fix-link-up.patch b/meta/recipes-core/systemd/systemd/0001-networkd-fix-link-up.patch
new file mode 100644
index 0000000000..7a3b3f172d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-networkd-fix-link-up.patch
@@ -0,0 +1,66 @@
+From 6bd76d2d4ff130decd3aa13e0c2dbfd56ff8d7b7 Mon Sep 17 00:00:00 2001
+From: Susant Sahani <ssahani@gmail.com>
+Date: Thu, 9 May 2019 07:35:35 +0530
+Subject: [PATCH] networkd: fix link_up() (#12505)
+
+Fillup IFLA_INET6_ADDR_GEN_MODE while we do link_up.
+
+Fixes the following error:
+```
+dummy-test: Could not bring up interface: Invalid argument
+```
+
+After reading the kernel code when we do a link up
+```
+net/core/rtnetlink.c
+IFLA_AF_SPEC
+ af_ops->set_link_af(dev, af);
+  inet6_set_link_af
+   if (tb[IFLA_INET6_ADDR_GEN_MODE])
+             Here it looks for IFLA_INET6_ADDR_GEN_MODE
+```
+Since link up we didn't filling up that it's failing.
+
+Closes #12504.
+
+Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
+
+Upstream-Status: backport https://github.com/systemd/systemd/commit/4eb086a38712ea98faf41e075b84555b11b54362.patch
+
+---
+ src/network/networkd-link.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index e466b96792..042496173c 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -2034,6 +2034,8 @@ static int link_up(Link *link) {
+         }
+ 
+         if (link_ipv6_enabled(link)) {
++                uint8_t ipv6ll_mode;
++
+                 r = sd_netlink_message_open_container(req, IFLA_AF_SPEC);
+                 if (r < 0)
+                         return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m");
+@@ -2049,6 +2051,19 @@ static int link_up(Link *link) {
+                                 return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m");
+                 }
+ 
++                if (!link_ipv6ll_enabled(link))
++                        ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE;
++                else if (sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL) < 0)
++                        /* The file may not exist. And event if it exists, when stable_secret is unset,
++                         * reading the file fails with EIO. */
++                        ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64;
++                else
++                        ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
++
++                r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
++                if (r < 0)
++                        return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m");
++
+                 r = sd_netlink_message_close_container(req);
+                 if (r < 0)
+                         return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m");
diff --git a/meta/recipes-core/systemd/systemd/0002-network-do-not-send-ipv6.patch b/meta/recipes-core/systemd/systemd/0002-network-do-not-send-ipv6.patch
new file mode 100644
index 0000000000..6e6ace4c5f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0002-network-do-not-send-ipv6.patch
@@ -0,0 +1,96 @@
+From b5c4eb818101127a606849e822937b15b8497c75 Mon Sep 17 00:00:00 2001
+From: Yu Watanabe <watanabe.yu+github@gmail.com>
+Date: Thu, 9 May 2019 14:39:46 +0900
+Subject: [PATCH] network: do not send ipv6 token to kernel
+
+We disabled kernel RA support. Then, we should not send
+IFLA_INET6_TOKEN.
+Thus, we do not need to send IFLA_INET6_ADDR_GEN_MODE twice.
+
+Follow-up for 0e2fdb83bb5e22047e0c7cc058b415d0e93f02cf and
+4eb086a38712ea98faf41e075b84555b11b54362.
+
+Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
+
+Upstream-Status: backport https://github.com/systemd/systemd/commit/9f6e82e6eb3b6e73d66d00d1d6eee60691fb702f
+
+---
+ src/network/networkd-link.c | 51 +++++--------------------------------
+ 1 file changed, 6 insertions(+), 45 deletions(-)
+
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 042496173c..c49dba33da 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -1940,6 +1940,9 @@ static int link_configure_addrgen_mode(Link *link) {
+         assert(link->manager);
+         assert(link->manager->rtnl);
+ 
++        if (!socket_ipv6_is_supported())
++                return 0;
++
+         log_link_debug(link, "Setting address genmode for link");
+ 
+         r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex);
+@@ -2033,46 +2036,6 @@ static int link_up(Link *link) {
+                         return log_link_error_errno(link, r, "Could not set MAC address: %m");
+         }
+ 
+-        if (link_ipv6_enabled(link)) {
+-                uint8_t ipv6ll_mode;
+-
+-                r = sd_netlink_message_open_container(req, IFLA_AF_SPEC);
+-                if (r < 0)
+-                        return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m");
+-
+-                /* if the kernel lacks ipv6 support setting IFF_UP fails if any ipv6 options are passed */
+-                r = sd_netlink_message_open_container(req, AF_INET6);
+-                if (r < 0)
+-                        return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m");
+-
+-                if (!in_addr_is_null(AF_INET6, &link->network->ipv6_token)) {
+-                        r = sd_netlink_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
+-                        if (r < 0)
+-                                return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m");
+-                }
+-
+-                if (!link_ipv6ll_enabled(link))
+-                        ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE;
+-                else if (sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL) < 0)
+-                        /* The file may not exist. And event if it exists, when stable_secret is unset,
+-                         * reading the file fails with EIO. */
+-                        ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64;
+-                else
+-                        ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
+-
+-                r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
+-                if (r < 0)
+-                        return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m");
+-
+-                r = sd_netlink_message_close_container(req);
+-                if (r < 0)
+-                        return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m");
+-
+-                r = sd_netlink_message_close_container(req);
+-                if (r < 0)
+-                        return log_link_error_errno(link, r, "Could not close IFLA_AF_SPEC container: %m");
+-        }
+-
+         r = netlink_call_async(link->manager->rtnl, NULL, req, link_up_handler,
+                                link_netlink_destroy_callback, link);
+         if (r < 0)
+@@ -3208,11 +3171,9 @@ static int link_configure(Link *link) {
+         if (r < 0)
+                 return r;
+ 
+-        if (socket_ipv6_is_supported()) {
+-                r = link_configure_addrgen_mode(link);
+-                if (r < 0)
+-                        return r;
+-        }
++        r = link_configure_addrgen_mode(link);
++        if (r < 0)
++                return r;
+ 
+         return link_configure_after_setting_mtu(link);
+ }
diff --git a/meta/recipes-core/systemd/systemd_242.bb b/meta/recipes-core/systemd/systemd_242.bb
index 29f64b995a..5085eb515b 100644
--- a/meta/recipes-core/systemd/systemd_242.bb
+++ b/meta/recipes-core/systemd/systemd_242.bb
@@ -25,6 +25,8 @@ SRC_URI += "file://touchscreen.rules \
            file://0006-network-remove-redunant-link-name-in-message.patch \
            file://99-default.preset \
            file://0001-resolved-Fix-incorrect-use-of-OpenSSL-BUF_MEM.patch \
+           file://0001-networkd-fix-link-up.patch \
+           file://0002-network-do-not-send-ipv6.patch \
            "
 
 # patches needed by musl
-- 
2.20.1



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

* ✗ patchtest: failure for systemd: Fix interface bring-up on kernels >= 5.2
  2019-07-09  8:43 [PATCH] systemd: Fix interface bring-up on kernels >= 5.2 Ricardo Ribalda Delgado
@ 2019-07-09  9:01 ` Patchwork
  2019-07-09 11:12 ` [PATCH] " Alex Kiernan
  1 sibling, 0 replies; 5+ messages in thread
From: Patchwork @ 2019-07-09  9:01 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado; +Cc: openembedded-core

== Series Details ==

Series: systemd: Fix interface bring-up on kernels >= 5.2
Revision: 1
URL   : https://patchwork.openembedded.org/series/18577/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Upstream-Status is in incorrect format [test_upstream_status_presence_format] 
  Suggested fix    Fix Upstream-Status format in 0001-networkd-fix-link-up.patch
  Current          Upstream-Status: backport https://github.com/systemd/systemd/commit/4eb086a38712ea98faf41e075b84555b11b54362.patch
  Standard format  Upstream-Status: <Valid status>
  Valid status     Pending, Accepted, Backport, Denied, Inappropriate [reason], Submitted [where]



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



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

* Re: [PATCH] systemd: Fix interface bring-up on kernels >= 5.2
  2019-07-09  8:43 [PATCH] systemd: Fix interface bring-up on kernels >= 5.2 Ricardo Ribalda Delgado
  2019-07-09  9:01 ` ✗ patchtest: failure for " Patchwork
@ 2019-07-09 11:12 ` Alex Kiernan
  2019-07-09 11:59   ` Ricardo Ribalda Delgado
  1 sibling, 1 reply; 5+ messages in thread
From: Alex Kiernan @ 2019-07-09 11:12 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado; +Cc: Patches and discussions about the oe-core layer

On Tue, Jul 9, 2019 at 9:43 AM Ricardo Ribalda Delgado
<ricardo@ribalda.com> wrote:
>
> With kernels >=5.2  systemd-networkd is unable to bring up the link.
>
> eth0: Could not bring up interface: Invalid argument
>
> This is already reported upstream and fixed on master:
>
> https://github.com/systemd/systemd/issues/12784
>
> They recommend Debian to backport two patches.
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
> ---

Could we just move the SRCREV to the top of systemd-stable, which
includes a change that looks a lot like this problem, but isn't the
exact same change?

-- 
Alex Kiernan


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

* Re: [PATCH] systemd: Fix interface bring-up on kernels >= 5.2
  2019-07-09 11:12 ` [PATCH] " Alex Kiernan
@ 2019-07-09 11:59   ` Ricardo Ribalda Delgado
  2019-07-09 12:19     ` Alex Kiernan
  0 siblings, 1 reply; 5+ messages in thread
From: Ricardo Ribalda Delgado @ 2019-07-09 11:59 UTC (permalink / raw)
  To: Alex Kiernan; +Cc: Patches and discussions about the oe-core layer

Hi Alex

That would also be ok. Is this already on a released version or is
only on the "master" branch?



On Tue, Jul 9, 2019 at 1:12 PM Alex Kiernan <alex.kiernan@gmail.com> wrote:
>
> On Tue, Jul 9, 2019 at 9:43 AM Ricardo Ribalda Delgado
> <ricardo@ribalda.com> wrote:
> >
> > With kernels >=5.2  systemd-networkd is unable to bring up the link.
> >
> > eth0: Could not bring up interface: Invalid argument
> >
> > This is already reported upstream and fixed on master:
> >
> > https://github.com/systemd/systemd/issues/12784
> >
> > They recommend Debian to backport two patches.
> >
> > Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
> > ---
>
> Could we just move the SRCREV to the top of systemd-stable, which
> includes a change that looks a lot like this problem, but isn't the
> exact same change?
>
> --
> Alex Kiernan



-- 
Ricardo Ribalda


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

* Re: [PATCH] systemd: Fix interface bring-up on kernels >= 5.2
  2019-07-09 11:59   ` Ricardo Ribalda Delgado
@ 2019-07-09 12:19     ` Alex Kiernan
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Kiernan @ 2019-07-09 12:19 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado; +Cc: Patches and discussions about the oe-core layer

On Tue, Jul 9, 2019 at 12:59 PM Ricardo Ribalda Delgado
<ricardo@ribalda.com> wrote:
>
> Hi Alex
>
> That would also be ok. Is this already on a released version or is
> only on the "master" branch?
>
>

It's on the v242-stable branch:

https://github.com/systemd/systemd-stable/commit/8fbc72f45f4aa84889bc8694a9ce662946464c37

-- 
Alex Kiernan


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

end of thread, other threads:[~2019-07-09 12:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09  8:43 [PATCH] systemd: Fix interface bring-up on kernels >= 5.2 Ricardo Ribalda Delgado
2019-07-09  9:01 ` ✗ patchtest: failure for " Patchwork
2019-07-09 11:12 ` [PATCH] " Alex Kiernan
2019-07-09 11:59   ` Ricardo Ribalda Delgado
2019-07-09 12:19     ` Alex Kiernan

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.