diff options
author | Ricardo Ribalda Delgado <ricardo@ribalda.com> | 2019-07-15 16:32:52 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-07-17 09:36:35 +0100 |
commit | 6726c663fd33dc412a6c6dbcfd36b0f9d5c6d010 (patch) | |
tree | aaaccf1a6358061e2d77b135066375bd170ebc02 /meta/recipes-core | |
parent | eba6cd155a7ad02b736566727f58a3958048bfc8 (diff) | |
download | poky-6726c663fd33dc412a6c6dbcfd36b0f9d5c6d010.tar.gz |
systemd: Fix interface bring-up on kernels >= 5.2
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.
(From OE-Core rev: 536d54ab46708ef921dbdcb68d1cf644ec639be8)
Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
3 files changed, 164 insertions, 0 deletions
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..4c7a0a33a3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-networkd-fix-link-up.patch | |||
@@ -0,0 +1,66 @@ | |||
1 | From 6bd76d2d4ff130decd3aa13e0c2dbfd56ff8d7b7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Susant Sahani <ssahani@gmail.com> | ||
3 | Date: Thu, 9 May 2019 07:35:35 +0530 | ||
4 | Subject: [PATCH] networkd: fix link_up() (#12505) | ||
5 | |||
6 | Fillup IFLA_INET6_ADDR_GEN_MODE while we do link_up. | ||
7 | |||
8 | Fixes the following error: | ||
9 | ``` | ||
10 | dummy-test: Could not bring up interface: Invalid argument | ||
11 | ``` | ||
12 | |||
13 | After reading the kernel code when we do a link up | ||
14 | ``` | ||
15 | net/core/rtnetlink.c | ||
16 | IFLA_AF_SPEC | ||
17 | af_ops->set_link_af(dev, af); | ||
18 | inet6_set_link_af | ||
19 | if (tb[IFLA_INET6_ADDR_GEN_MODE]) | ||
20 | Here it looks for IFLA_INET6_ADDR_GEN_MODE | ||
21 | ``` | ||
22 | Since link up we didn't filling up that it's failing. | ||
23 | |||
24 | Closes #12504. | ||
25 | |||
26 | Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> | ||
27 | |||
28 | Upstream-Status: Backport [https://github.com/systemd/systemd/commit/4eb086a38712ea98faf41e075b84555b11b54362.patch] | ||
29 | |||
30 | --- | ||
31 | src/network/networkd-link.c | 15 +++++++++++++++ | ||
32 | 1 file changed, 15 insertions(+) | ||
33 | |||
34 | diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c | ||
35 | index e466b96792..042496173c 100644 | ||
36 | --- a/src/network/networkd-link.c | ||
37 | +++ b/src/network/networkd-link.c | ||
38 | @@ -2034,6 +2034,8 @@ static int link_up(Link *link) { | ||
39 | } | ||
40 | |||
41 | if (link_ipv6_enabled(link)) { | ||
42 | + uint8_t ipv6ll_mode; | ||
43 | + | ||
44 | r = sd_netlink_message_open_container(req, IFLA_AF_SPEC); | ||
45 | if (r < 0) | ||
46 | return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m"); | ||
47 | @@ -2049,6 +2051,19 @@ static int link_up(Link *link) { | ||
48 | return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m"); | ||
49 | } | ||
50 | |||
51 | + if (!link_ipv6ll_enabled(link)) | ||
52 | + ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE; | ||
53 | + else if (sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL) < 0) | ||
54 | + /* The file may not exist. And event if it exists, when stable_secret is unset, | ||
55 | + * reading the file fails with EIO. */ | ||
56 | + ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64; | ||
57 | + else | ||
58 | + ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY; | ||
59 | + | ||
60 | + r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode); | ||
61 | + if (r < 0) | ||
62 | + return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m"); | ||
63 | + | ||
64 | r = sd_netlink_message_close_container(req); | ||
65 | if (r < 0) | ||
66 | 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..2565314876 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-network-do-not-send-ipv6.patch | |||
@@ -0,0 +1,96 @@ | |||
1 | From b5c4eb818101127a606849e822937b15b8497c75 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yu Watanabe <watanabe.yu+github@gmail.com> | ||
3 | Date: Thu, 9 May 2019 14:39:46 +0900 | ||
4 | Subject: [PATCH] network: do not send ipv6 token to kernel | ||
5 | |||
6 | We disabled kernel RA support. Then, we should not send | ||
7 | IFLA_INET6_TOKEN. | ||
8 | Thus, we do not need to send IFLA_INET6_ADDR_GEN_MODE twice. | ||
9 | |||
10 | Follow-up for 0e2fdb83bb5e22047e0c7cc058b415d0e93f02cf and | ||
11 | 4eb086a38712ea98faf41e075b84555b11b54362. | ||
12 | |||
13 | Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> | ||
14 | |||
15 | Upstream-Status: Backport [https://github.com/systemd/systemd/commit/9f6e82e6eb3b6e73d66d00d1d6eee60691fb702f] | ||
16 | |||
17 | --- | ||
18 | src/network/networkd-link.c | 51 +++++-------------------------------- | ||
19 | 1 file changed, 6 insertions(+), 45 deletions(-) | ||
20 | |||
21 | diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c | ||
22 | index 042496173c..c49dba33da 100644 | ||
23 | --- a/src/network/networkd-link.c | ||
24 | +++ b/src/network/networkd-link.c | ||
25 | @@ -1940,6 +1940,9 @@ static int link_configure_addrgen_mode(Link *link) { | ||
26 | assert(link->manager); | ||
27 | assert(link->manager->rtnl); | ||
28 | |||
29 | + if (!socket_ipv6_is_supported()) | ||
30 | + return 0; | ||
31 | + | ||
32 | log_link_debug(link, "Setting address genmode for link"); | ||
33 | |||
34 | r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex); | ||
35 | @@ -2033,46 +2036,6 @@ static int link_up(Link *link) { | ||
36 | return log_link_error_errno(link, r, "Could not set MAC address: %m"); | ||
37 | } | ||
38 | |||
39 | - if (link_ipv6_enabled(link)) { | ||
40 | - uint8_t ipv6ll_mode; | ||
41 | - | ||
42 | - r = sd_netlink_message_open_container(req, IFLA_AF_SPEC); | ||
43 | - if (r < 0) | ||
44 | - return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m"); | ||
45 | - | ||
46 | - /* if the kernel lacks ipv6 support setting IFF_UP fails if any ipv6 options are passed */ | ||
47 | - r = sd_netlink_message_open_container(req, AF_INET6); | ||
48 | - if (r < 0) | ||
49 | - return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m"); | ||
50 | - | ||
51 | - if (!in_addr_is_null(AF_INET6, &link->network->ipv6_token)) { | ||
52 | - r = sd_netlink_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6); | ||
53 | - if (r < 0) | ||
54 | - return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m"); | ||
55 | - } | ||
56 | - | ||
57 | - if (!link_ipv6ll_enabled(link)) | ||
58 | - ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE; | ||
59 | - else if (sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL) < 0) | ||
60 | - /* The file may not exist. And event if it exists, when stable_secret is unset, | ||
61 | - * reading the file fails with EIO. */ | ||
62 | - ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64; | ||
63 | - else | ||
64 | - ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY; | ||
65 | - | ||
66 | - r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode); | ||
67 | - if (r < 0) | ||
68 | - return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m"); | ||
69 | - | ||
70 | - r = sd_netlink_message_close_container(req); | ||
71 | - if (r < 0) | ||
72 | - return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m"); | ||
73 | - | ||
74 | - r = sd_netlink_message_close_container(req); | ||
75 | - if (r < 0) | ||
76 | - return log_link_error_errno(link, r, "Could not close IFLA_AF_SPEC container: %m"); | ||
77 | - } | ||
78 | - | ||
79 | r = netlink_call_async(link->manager->rtnl, NULL, req, link_up_handler, | ||
80 | link_netlink_destroy_callback, link); | ||
81 | if (r < 0) | ||
82 | @@ -3208,11 +3171,9 @@ static int link_configure(Link *link) { | ||
83 | if (r < 0) | ||
84 | return r; | ||
85 | |||
86 | - if (socket_ipv6_is_supported()) { | ||
87 | - r = link_configure_addrgen_mode(link); | ||
88 | - if (r < 0) | ||
89 | - return r; | ||
90 | - } | ||
91 | + r = link_configure_addrgen_mode(link); | ||
92 | + if (r < 0) | ||
93 | + return r; | ||
94 | |||
95 | return link_configure_after_setting_mtu(link); | ||
96 | } | ||
diff --git a/meta/recipes-core/systemd/systemd_242.bb b/meta/recipes-core/systemd/systemd_242.bb index ca083ad376..1953fef413 100644 --- a/meta/recipes-core/systemd/systemd_242.bb +++ b/meta/recipes-core/systemd/systemd_242.bb | |||
@@ -26,6 +26,8 @@ SRC_URI += "file://touchscreen.rules \ | |||
26 | file://99-default.preset \ | 26 | file://99-default.preset \ |
27 | file://0001-resolved-Fix-incorrect-use-of-OpenSSL-BUF_MEM.patch \ | 27 | file://0001-resolved-Fix-incorrect-use-of-OpenSSL-BUF_MEM.patch \ |
28 | file://0001-core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-.patch \ | 28 | file://0001-core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-.patch \ |
29 | file://0001-networkd-fix-link-up.patch \ | ||
30 | file://0002-network-do-not-send-ipv6.patch \ | ||
29 | " | 31 | " |
30 | 32 | ||
31 | # patches needed by musl | 33 | # patches needed by musl |