Contents of /trunk/systemd/patches/systemd-242-network-do-not-send-ipv6-token-to-kernel.patch
Parent Directory | Revision Log
Revision 3368 -
(show annotations)
(download)
Tue Jul 9 11:20:22 2019 UTC (5 years, 2 months ago) by niro
File size: 4080 byte(s)
Tue Jul 9 11:20:22 2019 UTC (5 years, 2 months ago) by niro
File size: 4080 byte(s)
-added systemd-242 upstream patches
1 | From 9f6e82e6eb3b6e73d66d00d1d6eee60691fb702f 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 | src/network/networkd-link.c | 51 +++++-------------------------------- |
14 | 1 file changed, 6 insertions(+), 45 deletions(-) |
15 | |
16 | diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c |
17 | index 2b6ff2b6c58..b6da4ea70b7 100644 |
18 | --- a/src/network/networkd-link.c |
19 | +++ b/src/network/networkd-link.c |
20 | @@ -1954,6 +1954,9 @@ static int link_configure_addrgen_mode(Link *link) { |
21 | assert(link->manager); |
22 | assert(link->manager->rtnl); |
23 | |
24 | + if (!socket_ipv6_is_supported()) |
25 | + return 0; |
26 | + |
27 | log_link_debug(link, "Setting address genmode for link"); |
28 | |
29 | r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINK, link->ifindex); |
30 | @@ -2047,46 +2050,6 @@ static int link_up(Link *link) { |
31 | return log_link_error_errno(link, r, "Could not set MAC address: %m"); |
32 | } |
33 | |
34 | - if (link_ipv6_enabled(link)) { |
35 | - uint8_t ipv6ll_mode; |
36 | - |
37 | - r = sd_netlink_message_open_container(req, IFLA_AF_SPEC); |
38 | - if (r < 0) |
39 | - return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m"); |
40 | - |
41 | - /* if the kernel lacks ipv6 support setting IFF_UP fails if any ipv6 options are passed */ |
42 | - r = sd_netlink_message_open_container(req, AF_INET6); |
43 | - if (r < 0) |
44 | - return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m"); |
45 | - |
46 | - if (!in_addr_is_null(AF_INET6, &link->network->ipv6_token)) { |
47 | - r = sd_netlink_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6); |
48 | - if (r < 0) |
49 | - return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m"); |
50 | - } |
51 | - |
52 | - if (!link_ipv6ll_enabled(link)) |
53 | - ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE; |
54 | - else if (sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL) < 0) |
55 | - /* The file may not exist. And event if it exists, when stable_secret is unset, |
56 | - * reading the file fails with EIO. */ |
57 | - ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64; |
58 | - else |
59 | - ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY; |
60 | - |
61 | - r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode); |
62 | - if (r < 0) |
63 | - return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m"); |
64 | - |
65 | - r = sd_netlink_message_close_container(req); |
66 | - if (r < 0) |
67 | - return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m"); |
68 | - |
69 | - r = sd_netlink_message_close_container(req); |
70 | - if (r < 0) |
71 | - return log_link_error_errno(link, r, "Could not close IFLA_AF_SPEC container: %m"); |
72 | - } |
73 | - |
74 | r = netlink_call_async(link->manager->rtnl, NULL, req, link_up_handler, |
75 | link_netlink_destroy_callback, link); |
76 | if (r < 0) |
77 | @@ -3226,11 +3189,9 @@ static int link_configure(Link *link) { |
78 | if (r < 0) |
79 | return r; |
80 | |
81 | - if (socket_ipv6_is_supported()) { |
82 | - r = link_configure_addrgen_mode(link); |
83 | - if (r < 0) |
84 | - return r; |
85 | - } |
86 | + r = link_configure_addrgen_mode(link); |
87 | + if (r < 0) |
88 | + return r; |
89 | |
90 | return link_configure_after_setting_mtu(link); |
91 | } |