Annotation of /trunk/systemd/patches/systemd-242-networkd-fix-link-up.patch
Parent Directory | Revision Log
Revision 3543 -
(hide annotations)
(download)
Tue Jul 14 09:45:03 2020 UTC (3 years, 10 months ago) by niro
File size: 2510 byte(s)
Tue Jul 14 09:45:03 2020 UTC (3 years, 10 months ago) by niro
File size: 2510 byte(s)
-fixed network link up issues with >=linux-5.2
1 | niro | 3543 | From 467ac87e75c1045bc6affa89de99e21c4e7a1762 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 1/2] 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: Joel Stanley <joel@jms.id.au> | ||
27 | --- | ||
28 | src/network/networkd-link.c | 15 +++++++++++++++ | ||
29 | 1 file changed, 15 insertions(+) | ||
30 | |||
31 | diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c | ||
32 | index 3e334c8d29cc..3a0706e0a894 100644 | ||
33 | --- a/src/network/networkd-link.c | ||
34 | +++ b/src/network/networkd-link.c | ||
35 | @@ -2079,6 +2079,8 @@ static int link_up(Link *link) { | ||
36 | } | ||
37 | |||
38 | if (link_ipv6_enabled(link)) { | ||
39 | + uint8_t ipv6ll_mode; | ||
40 | + | ||
41 | r = sd_netlink_message_open_container(req, IFLA_AF_SPEC); | ||
42 | if (r < 0) | ||
43 | return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m"); | ||
44 | @@ -2094,6 +2096,19 @@ static int link_up(Link *link) { | ||
45 | return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m"); | ||
46 | } | ||
47 | |||
48 | + if (!link_ipv6ll_enabled(link)) | ||
49 | + ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE; | ||
50 | + else if (sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL) < 0) | ||
51 | + /* The file may not exist. And event if it exists, when stable_secret is unset, | ||
52 | + * reading the file fails with EIO. */ | ||
53 | + ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64; | ||
54 | + else | ||
55 | + ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY; | ||
56 | + | ||
57 | + r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode); | ||
58 | + if (r < 0) | ||
59 | + return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m"); | ||
60 | + | ||
61 | r = sd_netlink_message_close_container(req); | ||
62 | if (r < 0) | ||
63 | return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m"); | ||
64 | -- | ||
65 | 2.20.1 | ||
66 | S |