Bug#935126: systemd-networkd fails with "Could not bring up interface: Invalid argument"
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Aug 19 20:04:58 BST 2019
Package: systemd
Version: 241-6
Severity: normal
Tags: upstream patch
Control: forwarded -1 https://github.com/systemd/systemd/issues/12784
from the journal:
-- Reboot --
Aug 19 10:55:17 tyr systemd[1]: Starting Network Service...
Aug 19 10:55:19 tyr systemd-networkd[230]: Enumeration completed
Aug 19 10:55:19 tyr systemd[1]: Started Network Service.
Aug 19 10:55:19 tyr systemd-networkd[230]: eth0: Could not bring up interface: Invalid argument
Aug 19 14:48:35 tyr systemd-networkd[230]: eth0: Gained carrier
Aug 19 14:48:37 tyr systemd-networkd[230]: eth0: Gained IPv6LL
Aug 19 14:48:38 tyr systemd-networkd[230]: eth0: DHCPv4 address 10.70.11.3/23 via 10.70.10.1
Aug 19 14:48:49 tyr systemd-networkd[230]: eth0: Configured
note that the "Gained carrier" happend after i manually did "ip l set eth0 up".
The upstream bug report suggests that the attached two patches should resolve the issue, but i haven't tested them.
--dkg
-- Package-specific info:
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Kernel: Linux 5.2.0-2-powerpc-smp (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages systemd depends on:
ii adduser 3.118
ii libacl1 2.2.53-4
ii libapparmor1 2.13.3-4
ii libaudit1 1:2.8.5-2
ii libblkid1 2.34-0.1
ii libc6 2.28-10
ii libcap2 1:2.25-2
ii libcryptsetup12 2:2.2.0-1
ii libgcrypt20 1.8.4-5
ii libgnutls30 3.6.9-4
ii libgpg-error0 1.36-7
ii libidn11 1.33-2.2
ii libip4tc2 1.8.3-2
ii libkmod2 26-1
ii liblz4-1 1.8.3-1
ii liblzma5 5.2.4-1
ii libmount1 2.34-0.1
ii libpam0g 1.3.1-5
ii libpcre2-8-0 10.32-5
ii libseccomp2 2.4.1-2
ii libselinux1 2.9-2+b2
ii libsystemd0 241-6
ii mount 2.34-0.1
ii util-linux 2.34-0.1
Versions of packages systemd recommends:
ii dbus 1.13.8-1
ii libpam-systemd 241-6
Versions of packages systemd suggests:
ii policykit-1 0.105-26
pn systemd-container <none>
Versions of packages systemd is related to:
pn dracut <none>
ii initramfs-tools 0.134
ii udev 241-6
-- Configuration Files:
/etc/systemd/timesyncd.conf changed [not included]
-- no debconf information
-------------- next part --------------
>From 4eb086a38712ea98faf41e075b84555b11b54362 Mon Sep 17 00:00:00 2001
From: Susant Sahani <ssahani at 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.
---
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 3c8b5c5cb4..4db9f3f980 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2031,6 +2031,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");
@@ -2046,6 +2048,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");
--
2.23.0.rc1
-------------- next part --------------
>From 9f6e82e6eb3b6e73d66d00d1d6eee60691fb702f Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github at 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.
---
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 2b6ff2b6c5..b6da4ea70b 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1954,6 +1954,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);
@@ -2047,46 +2050,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)
@@ -3226,11 +3189,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);
}
--
2.23.0.rc1
More information about the Pkg-systemd-maintainers
mailing list