Bug Summary

File:build-scan/../src/network/networkd-link.c
Warning:line 454, column 25
Potential leak of memory pointed to by 'link'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name networkd-link.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -fdenormal-fp-math=preserve-sign,preserve-sign -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -include config.h -I src/network/libnetworkd-core.a.p -I src/network -I ../src/network -I src/basic -I ../src/basic -I src/shared -I ../src/shared -I src/systemd -I ../src/systemd -I src/journal -I ../src/journal -I src/journal-remote -I ../src/journal-remote -I src/nspawn -I ../src/nspawn -I src/resolve -I ../src/resolve -I src/timesync -I ../src/timesync -I ../src/time-wait-sync -I src/login -I ../src/login -I src/udev -I ../src/udev -I src/libudev -I ../src/libudev -I src/core -I ../src/core -I ../src/libsystemd/sd-bus -I ../src/libsystemd/sd-device -I ../src/libsystemd/sd-hwdb -I ../src/libsystemd/sd-id128 -I ../src/libsystemd/sd-netlink -I ../src/libsystemd/sd-network -I src/libsystemd-network -I ../src/libsystemd-network -I . -I .. -D _FILE_OFFSET_BITS=64 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Wno-error=nonnull -std=gnu99 -fconst-strings -fdebug-compilation-dir /home/mrc0mmand/repos/@redhat-plumbers/systemd-rhel8/build-scan -ferror-limit 19 -fvisibility hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -analyzer-output=html -faddrsig -o /tmp/scan-build-2021-07-16-221226-1465241-1 -x c ../src/network/networkd-link.c
1/* SPDX-License-Identifier: LGPL-2.1+ */
2
3#include <netinet/ether.h>
4#include <linux1/if.h>
5#include <linux1/can/netlink.h>
6#include <unistd.h>
7#include <stdio_ext.h>
8
9#include "alloc-util.h"
10#include "bus-util.h"
11#include "dhcp-lease-internal.h"
12#include "fd-util.h"
13#include "fileio.h"
14#include "netlink-util.h"
15#include "network-internal.h"
16#include "networkd-ipv6-proxy-ndp.h"
17#include "networkd-lldp-tx.h"
18#include "networkd-manager.h"
19#include "networkd-ndisc.h"
20#include "networkd-radv.h"
21#include "networkd-routing-policy-rule.h"
22#include "set.h"
23#include "socket-util.h"
24#include "stdio-util.h"
25#include "string-table.h"
26#include "udev-util.h"
27#include "util.h"
28#include "virt.h"
29
30static bool_Bool link_dhcp6_enabled(Link *link) {
31 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 31, __PRETTY_FUNCTION__); } while (0)
;
32
33 if (!socket_ipv6_is_supported())
34 return false0;
35
36 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
37 return false0;
38
39 if (!link->network)
40 return false0;
41
42 return link->network->dhcp & ADDRESS_FAMILY_IPV6;
43}
44
45static bool_Bool link_dhcp4_enabled(Link *link) {
46 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 46, __PRETTY_FUNCTION__); } while (0)
;
47
48 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
49 return false0;
50
51 if (!link->network)
52 return false0;
53
54 return link->network->dhcp & ADDRESS_FAMILY_IPV4;
55}
56
57static bool_Bool link_dhcp4_server_enabled(Link *link) {
58 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 58, __PRETTY_FUNCTION__); } while (0)
;
59
60 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
61 return false0;
62
63 if (!link->network)
64 return false0;
65
66 return link->network->dhcp_server;
67}
68
69static bool_Bool link_ipv4ll_enabled(Link *link) {
70 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 70, __PRETTY_FUNCTION__); } while (0)
;
71
72 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
73 return false0;
74
75 if (!link->network)
76 return false0;
77
78 if (streq_ptr(link->kind, "wireguard"))
79 return false0;
80
81 return link->network->link_local & ADDRESS_FAMILY_IPV4;
82}
83
84static bool_Bool link_ipv6ll_enabled(Link *link) {
85 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 85, __PRETTY_FUNCTION__); } while (0)
;
86
87 if (!socket_ipv6_is_supported())
88 return false0;
89
90 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
91 return false0;
92
93 if (!link->network)
94 return false0;
95
96 if (streq_ptr(link->kind, "wireguard"))
97 return false0;
98
99 return link->network->link_local & ADDRESS_FAMILY_IPV6;
100}
101
102static bool_Bool link_ipv6_enabled(Link *link) {
103 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 103, __PRETTY_FUNCTION__); } while (0)
;
104
105 if (!socket_ipv6_is_supported())
106 return false0;
107
108 if (link->network->bridge)
109 return false0;
110
111 /* DHCPv6 client will not be started if no IPv6 link-local address is configured. */
112 return link_ipv6ll_enabled(link) || network_has_static_ipv6_addresses(link->network);
113}
114
115static bool_Bool link_radv_enabled(Link *link) {
116 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 116, __PRETTY_FUNCTION__); } while (0)
;
117
118 if (!link_ipv6ll_enabled(link))
119 return false0;
120
121 return link->network->router_prefix_delegation != RADV_PREFIX_DELEGATION_NONE;
122}
123
124static bool_Bool link_lldp_rx_enabled(Link *link) {
125 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 125, __PRETTY_FUNCTION__); } while (0)
;
126
127 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
128 return false0;
129
130 if (link->iftype != ARPHRD_ETHER1)
131 return false0;
132
133 if (!link->network)
134 return false0;
135
136 /* LLDP should be handled on bridge slaves as those have a direct
137 * connection to their peers not on the bridge master. Linux doesn't
138 * even (by default) forward lldp packets to the bridge master.*/
139 if (streq_ptr("bridge", link->kind))
140 return false0;
141
142 return link->network->lldp_mode != LLDP_MODE_NO;
143}
144
145static bool_Bool link_lldp_emit_enabled(Link *link) {
146 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 146, __PRETTY_FUNCTION__); } while (0)
;
147
148 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
149 return false0;
150
151 if (link->iftype != ARPHRD_ETHER1)
152 return false0;
153
154 if (!link->network)
155 return false0;
156
157 return link->network->lldp_emit != LLDP_EMIT_NO;
158}
159
160static bool_Bool link_ipv4_forward_enabled(Link *link) {
161 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 161, __PRETTY_FUNCTION__); } while (0)
;
162
163 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
164 return false0;
165
166 if (!link->network)
167 return false0;
168
169 if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
170 return false0;
171
172 return link->network->ip_forward & ADDRESS_FAMILY_IPV4;
173}
174
175static bool_Bool link_ipv6_forward_enabled(Link *link) {
176 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 176, __PRETTY_FUNCTION__); } while (0)
;
177
178 if (!socket_ipv6_is_supported())
179 return false0;
180
181 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
182 return false0;
183
184 if (!link->network)
185 return false0;
186
187 if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
188 return false0;
189
190 return link->network->ip_forward & ADDRESS_FAMILY_IPV6;
191}
192
193static bool_Bool link_proxy_arp_enabled(Link *link) {
194 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 194, __PRETTY_FUNCTION__); } while (0)
;
195
196 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
197 return false0;
198
199 if (!link->network)
200 return false0;
201
202 if (link->network->proxy_arp < 0)
203 return false0;
204
205 return true1;
206}
207
208static bool_Bool link_ipv6_accept_ra_enabled(Link *link) {
209 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 209, __PRETTY_FUNCTION__); } while (0)
;
210
211 if (!socket_ipv6_is_supported())
212 return false0;
213
214 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
215 return false0;
216
217 if (!link->network)
218 return false0;
219
220 if (!link_ipv6ll_enabled(link))
221 return false0;
222
223 /* If unset use system default (enabled if local forwarding is disabled.
224 * disabled if local forwarding is enabled).
225 * If set, ignore or enforce RA independent of local forwarding state.
226 */
227 if (link->network->ipv6_accept_ra < 0)
228 /* default to accept RA if ip_forward is disabled and ignore RA if ip_forward is enabled */
229 return !link_ipv6_forward_enabled(link);
230 else if (link->network->ipv6_accept_ra > 0)
231 /* accept RA even if ip_forward is enabled */
232 return true1;
233 else
234 /* ignore RA */
235 return false0;
236}
237
238static IPv6PrivacyExtensions link_ipv6_privacy_extensions(Link *link) {
239 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 239, __PRETTY_FUNCTION__); } while (0)
;
240
241 if (!socket_ipv6_is_supported())
242 return _IPV6_PRIVACY_EXTENSIONS_INVALID;
243
244 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
245 return _IPV6_PRIVACY_EXTENSIONS_INVALID;
246
247 if (!link->network)
248 return _IPV6_PRIVACY_EXTENSIONS_INVALID;
249
250 return link->network->ipv6_privacy_extensions;
251}
252
253static int link_enable_ipv6(Link *link) {
254 const char *p = NULL((void*)0);
255 bool_Bool disabled;
256 int r;
257
258 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
259 return 0;
260
261 disabled = !link_ipv6_enabled(link);
262
263 p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/disable_ipv6")({ const char *_appendees_[] = { "/proc/sys/net/ipv6/conf/", link
->ifname, "/disable_ipv6" }; char *_d_, *_p_; size_t _len_
= 0; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
264
265 r = write_string_file(p, one_zero(disabled), WRITE_STRING_FILE_VERIFY_ON_FAILURE);
266 if (r < 0)
267 log_link_warning_errno(link, r, "Cannot %s IPv6 for interface %s: %m",({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 268, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Cannot %s IPv6 for interface %s: %m", enable_disable(!
disabled), link->ifname) : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), r, "../src/network/networkd-link.c", 268
, __func__, "Cannot %s IPv6 for interface %s: %m", enable_disable
(!disabled), link->ifname); })
268 enable_disable(!disabled), link->ifname)({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 268, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Cannot %s IPv6 for interface %s: %m", enable_disable(!
disabled), link->ifname) : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), r, "../src/network/networkd-link.c", 268
, __func__, "Cannot %s IPv6 for interface %s: %m", enable_disable
(!disabled), link->ifname); })
;
269 else
270 log_link_info(link, "IPv6 successfully %sd", enable_disable(!disabled))({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 270, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "IPv6 successfully %sd", enable_disable(!disabled)) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((6))), 0, "../src/network/networkd-link.c"
, 270, __func__, "IPv6 successfully %sd", enable_disable(!disabled
)); })
;
271
272 return 0;
273}
274
275void link_update_operstate(Link *link) {
276 LinkOperationalState operstate;
277 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 277, __PRETTY_FUNCTION__); } while (0)
;
278
279 if (link->kernel_operstate == IF_OPER_DORMANT)
280 operstate = LINK_OPERSTATE_DORMANT;
281 else if (link_has_carrier(link)) {
282 Address *address;
283 uint8_t scope = RT_SCOPE_NOWHERE;
284 Iterator i;
285
286 /* if we have carrier, check what addresses we have */
287 SET_FOREACH(address, link->addresses, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->addresses), &
(i), (void**)&(address)); )
{
288 if (!address_is_ready(address))
289 continue;
290
291 if (address->scope < scope)
292 scope = address->scope;
293 }
294
295 /* for operstate we also take foreign addresses into account */
296 SET_FOREACH(address, link->addresses_foreign, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->addresses_foreign
), &(i), (void**)&(address)); )
{
297 if (!address_is_ready(address))
298 continue;
299
300 if (address->scope < scope)
301 scope = address->scope;
302 }
303
304 if (scope < RT_SCOPE_SITE)
305 /* universally accessible addresses found */
306 operstate = LINK_OPERSTATE_ROUTABLE;
307 else if (scope < RT_SCOPE_HOST)
308 /* only link or site local addresses found */
309 operstate = LINK_OPERSTATE_DEGRADED;
310 else
311 /* no useful addresses found */
312 operstate = LINK_OPERSTATE_CARRIER;
313 } else if (link->flags & IFF_UPIFF_UP)
314 operstate = LINK_OPERSTATE_NO_CARRIER;
315 else
316 operstate = LINK_OPERSTATE_OFF;
317
318 if (link->operstate != operstate) {
319 link->operstate = operstate;
320 link_send_changed(link, "OperationalState", NULL((void*)0));
321 link_dirty(link);
322 }
323}
324
325#define FLAG_STRING(string, flag, old, new)(((old ^ new) & flag) ? ((old & flag) ? (" -" string)
: (" +" string)) : "")
\
326 (((old ^ new) & flag) \
327 ? ((old & flag) ? (" -" string) : (" +" string)) \
328 : "")
329
330static int link_update_flags(Link *link, sd_netlink_message *m) {
331 unsigned flags, unknown_flags_added, unknown_flags_removed, unknown_flags;
332 uint8_t operstate;
333 int r;
334
335 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 335, __PRETTY_FUNCTION__); } while (0)
;
336
337 r = sd_rtnl_message_link_get_flags(m, &flags);
338 if (r < 0)
339 return log_link_warning_errno(link, r, "Could not get link flags: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 339, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not get link flags: %m") : log_internal_realm(((
LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 339, __func__, "Could not get link flags: %m"); })
;
340
341 r = sd_netlink_message_read_u8(m, IFLA_OPERSTATE, &operstate);
342 if (r < 0)
343 /* if we got a message without operstate, take it to mean
344 the state was unchanged */
345 operstate = link->kernel_operstate;
346
347 if ((link->flags == flags) && (link->kernel_operstate == operstate))
348 return 0;
349
350 if (link->flags != flags) {
351 log_link_debug(link, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
352 FLAG_STRING("LOOPBACK", IFF_LOOPBACK, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
353 FLAG_STRING("MASTER", IFF_MASTER, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
354 FLAG_STRING("SLAVE", IFF_SLAVE, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
355 FLAG_STRING("UP", IFF_UP, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
356 FLAG_STRING("DORMANT", IFF_DORMANT, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
357 FLAG_STRING("LOWER_UP", IFF_LOWER_UP, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
358 FLAG_STRING("RUNNING", IFF_RUNNING, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
359 FLAG_STRING("MULTICAST", IFF_MULTICAST, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
360 FLAG_STRING("BROADCAST", IFF_BROADCAST, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
361 FLAG_STRING("POINTOPOINT", IFF_POINTOPOINT, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
362 FLAG_STRING("PROMISC", IFF_PROMISC, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
363 FLAG_STRING("ALLMULTI", IFF_ALLMULTI, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
364 FLAG_STRING("PORTSEL", IFF_PORTSEL, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
365 FLAG_STRING("AUTOMEDIA", IFF_AUTOMEDIA, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
366 FLAG_STRING("DYNAMIC", IFF_DYNAMIC, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
367 FLAG_STRING("NOARP", IFF_NOARP, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
368 FLAG_STRING("NOTRAILERS", IFF_NOTRAILERS, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
369 FLAG_STRING("DEBUG", IFF_DEBUG, link->flags, flags),({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
370 FLAG_STRING("ECHO", IFF_ECHO, link->flags, flags))({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 370, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (
((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->flags
& IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"))
: ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 370, __func__, "Flags change:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
, (((link->flags ^ flags) & IFF_LOOPBACK) ? ((link->
flags & IFF_LOOPBACK) ? (" -" "LOOPBACK") : (" +" "LOOPBACK"
)) : ""), (((link->flags ^ flags) & IFF_MASTER) ? ((link
->flags & IFF_MASTER) ? (" -" "MASTER") : (" +" "MASTER"
)) : ""), (((link->flags ^ flags) & IFF_SLAVE) ? ((link
->flags & IFF_SLAVE) ? (" -" "SLAVE") : (" +" "SLAVE")
) : ""), (((link->flags ^ flags) & IFF_UP) ? ((link->
flags & IFF_UP) ? (" -" "UP") : (" +" "UP")) : ""), (((link
->flags ^ flags) & IFF_DORMANT) ? ((link->flags &
IFF_DORMANT) ? (" -" "DORMANT") : (" +" "DORMANT")) : ""), (
((link->flags ^ flags) & IFF_LOWER_UP) ? ((link->flags
& IFF_LOWER_UP) ? (" -" "LOWER_UP") : (" +" "LOWER_UP"))
: ""), (((link->flags ^ flags) & IFF_RUNNING) ? ((link
->flags & IFF_RUNNING) ? (" -" "RUNNING") : (" +" "RUNNING"
)) : ""), (((link->flags ^ flags) & IFF_MULTICAST) ? (
(link->flags & IFF_MULTICAST) ? (" -" "MULTICAST") : (
" +" "MULTICAST")) : ""), (((link->flags ^ flags) & IFF_BROADCAST
) ? ((link->flags & IFF_BROADCAST) ? (" -" "BROADCAST"
) : (" +" "BROADCAST")) : ""), (((link->flags ^ flags) &
IFF_POINTOPOINT) ? ((link->flags & IFF_POINTOPOINT) ?
(" -" "POINTOPOINT") : (" +" "POINTOPOINT")) : ""), (((link->
flags ^ flags) & IFF_PROMISC) ? ((link->flags & IFF_PROMISC
) ? (" -" "PROMISC") : (" +" "PROMISC")) : ""), (((link->flags
^ flags) & IFF_ALLMULTI) ? ((link->flags & IFF_ALLMULTI
) ? (" -" "ALLMULTI") : (" +" "ALLMULTI")) : ""), (((link->
flags ^ flags) & IFF_PORTSEL) ? ((link->flags & IFF_PORTSEL
) ? (" -" "PORTSEL") : (" +" "PORTSEL")) : ""), (((link->flags
^ flags) & IFF_AUTOMEDIA) ? ((link->flags & IFF_AUTOMEDIA
) ? (" -" "AUTOMEDIA") : (" +" "AUTOMEDIA")) : ""), (((link->
flags ^ flags) & IFF_DYNAMIC) ? ((link->flags & IFF_DYNAMIC
) ? (" -" "DYNAMIC") : (" +" "DYNAMIC")) : ""), (((link->flags
^ flags) & IFF_NOARP) ? ((link->flags & IFF_NOARP
) ? (" -" "NOARP") : (" +" "NOARP")) : ""), (((link->flags
^ flags) & IFF_NOTRAILERS) ? ((link->flags & IFF_NOTRAILERS
) ? (" -" "NOTRAILERS") : (" +" "NOTRAILERS")) : ""), (((link
->flags ^ flags) & IFF_DEBUG) ? ((link->flags &
IFF_DEBUG) ? (" -" "DEBUG") : (" +" "DEBUG")) : ""), (((link
->flags ^ flags) & IFF_ECHO) ? ((link->flags & IFF_ECHO
) ? (" -" "ECHO") : (" +" "ECHO")) : "")); })
;
371
372 unknown_flags = ~(IFF_LOOPBACKIFF_LOOPBACK | IFF_MASTERIFF_MASTER | IFF_SLAVEIFF_SLAVE | IFF_UPIFF_UP |
373 IFF_DORMANTIFF_DORMANT | IFF_LOWER_UPIFF_LOWER_UP | IFF_RUNNINGIFF_RUNNING |
374 IFF_MULTICASTIFF_MULTICAST | IFF_BROADCASTIFF_BROADCAST | IFF_POINTOPOINTIFF_POINTOPOINT |
375 IFF_PROMISCIFF_PROMISC | IFF_ALLMULTIIFF_ALLMULTI | IFF_PORTSELIFF_PORTSEL |
376 IFF_AUTOMEDIAIFF_AUTOMEDIA | IFF_DYNAMICIFF_DYNAMIC | IFF_NOARPIFF_NOARP |
377 IFF_NOTRAILERSIFF_NOTRAILERS | IFF_DEBUGIFF_DEBUG | IFF_ECHOIFF_ECHO);
378 unknown_flags_added = ((link->flags ^ flags) & flags & unknown_flags);
379 unknown_flags_removed = ((link->flags ^ flags) & link->flags & unknown_flags);
380
381 /* link flags are currently at most 18 bits, let's align to
382 * printing 20 */
383 if (unknown_flags_added)
384 log_link_debug(link,({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 386, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Unknown link flags gained: %#.5x (ignoring)", unknown_flags_added
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 386, __func__, "Unknown link flags gained: %#.5x (ignoring)"
, unknown_flags_added); })
385 "Unknown link flags gained: %#.5x (ignoring)",({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 386, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Unknown link flags gained: %#.5x (ignoring)", unknown_flags_added
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 386, __func__, "Unknown link flags gained: %#.5x (ignoring)"
, unknown_flags_added); })
386 unknown_flags_added)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 386, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Unknown link flags gained: %#.5x (ignoring)", unknown_flags_added
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 386, __func__, "Unknown link flags gained: %#.5x (ignoring)"
, unknown_flags_added); })
;
387
388 if (unknown_flags_removed)
389 log_link_debug(link,({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 391, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Unknown link flags lost: %#.5x (ignoring)", unknown_flags_removed
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 391, __func__, "Unknown link flags lost: %#.5x (ignoring)"
, unknown_flags_removed); })
390 "Unknown link flags lost: %#.5x (ignoring)",({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 391, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Unknown link flags lost: %#.5x (ignoring)", unknown_flags_removed
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 391, __func__, "Unknown link flags lost: %#.5x (ignoring)"
, unknown_flags_removed); })
391 unknown_flags_removed)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 391, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Unknown link flags lost: %#.5x (ignoring)", unknown_flags_removed
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 391, __func__, "Unknown link flags lost: %#.5x (ignoring)"
, unknown_flags_removed); })
;
392 }
393
394 link->flags = flags;
395 link->kernel_operstate = operstate;
396
397 link_update_operstate(link);
398
399 return 0;
400}
401
402static int link_new(Manager *manager, sd_netlink_message *message, Link **ret) {
403 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = NULL((void*)0);
404 uint16_t type;
405 const char *ifname, *kind = NULL((void*)0);
406 int r, ifindex;
407 unsigned short iftype;
408
409 assert(manager)do { if ((__builtin_expect(!!(!(manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("manager"), "../src/network/networkd-link.c"
, 409, __PRETTY_FUNCTION__); } while (0)
;
30
Taking false branch
31
Loop condition is false. Exiting loop
410 assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("message"), "../src/network/networkd-link.c"
, 410, __PRETTY_FUNCTION__); } while (0)
;
32
Taking false branch
33
Loop condition is false. Exiting loop
411 assert(ret)do { if ((__builtin_expect(!!(!(ret)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("ret"), "../src/network/networkd-link.c"
, 411, __PRETTY_FUNCTION__); } while (0)
;
34
Taking false branch
35
Loop condition is false. Exiting loop
412
413 /* check for link kind */
414 r = sd_netlink_message_enter_container(message, IFLA_LINKINFOIFLA_LINKINFO);
415 if (r == 0) {
36
Assuming 'r' is not equal to 0
37
Taking false branch
416 (void)sd_netlink_message_read_string(message, IFLA_INFO_KIND, &kind);
417 r = sd_netlink_message_exit_container(message);
418 if (r < 0)
419 return r;
420 }
421
422 r = sd_netlink_message_get_type(message, &type);
423 if (r < 0)
38
Assuming 'r' is >= 0
39
Taking false branch
424 return r;
425 else if (type != RTM_NEWLINKRTM_NEWLINK)
40
Assuming 'type' is equal to RTM_NEWLINK
41
Taking false branch
426 return -EINVAL22;
427
428 r = sd_rtnl_message_link_get_ifindex(message, &ifindex);
429 if (r < 0)
42
Assuming 'r' is >= 0
43
Taking false branch
430 return r;
431 else if (ifindex <= 0)
44
Assuming 'ifindex' is > 0
45
Taking false branch
432 return -EINVAL22;
433
434 r = sd_rtnl_message_link_get_type(message, &iftype);
435 if (r < 0)
46
Assuming 'r' is >= 0
47
Taking false branch
436 return r;
437
438 r = sd_netlink_message_read_string(message, IFLA_IFNAME, &ifname);
439 if (r < 0)
48
Assuming 'r' is >= 0
49
Taking false branch
440 return r;
441
442 link = new0(Link, 1)((Link*) calloc((1), sizeof(Link)));
50
Memory is allocated
443 if (!link)
51
Assuming 'link' is non-null
52
Taking false branch
444 return -ENOMEM12;
445
446 link->n_ref = 1;
447 link->manager = manager;
448 link->state = LINK_STATE_PENDING;
449 link->rtnl_extended_attrs = true1;
450 link->ifindex = ifindex;
451 link->iftype = iftype;
452 link->ifname = strdup(ifname);
453 if (!link->ifname)
53
Assuming field 'ifname' is null
54
Taking true branch
454 return -ENOMEM12;
55
Potential leak of memory pointed to by 'link'
455
456 if (kind) {
457 link->kind = strdup(kind);
458 if (!link->kind)
459 return -ENOMEM12;
460 }
461
462 r = sd_netlink_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
463 if (r < 0)
464 log_link_debug_errno(link, r, "MAC address not found for new device, continuing without")({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 464, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "MAC address not found for new device, continuing without"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), r, "../src/network/networkd-link.c", 464, __func__, "MAC address not found for new device, continuing without"
); })
;
465
466 if (asprintf(&link->state_file, "/run/systemd/netif/links/%d", link->ifindex) < 0)
467 return -ENOMEM12;
468
469 if (asprintf(&link->lease_file, "/run/systemd/netif/leases/%d", link->ifindex) < 0)
470 return -ENOMEM12;
471
472 if (asprintf(&link->lldp_file, "/run/systemd/netif/lldp/%d", link->ifindex) < 0)
473 return -ENOMEM12;
474
475 r = hashmap_ensure_allocated(&manager->links, NULL)internal_hashmap_ensure_allocated(&manager->links, ((void
*)0) )
;
476 if (r < 0)
477 return r;
478
479 r = hashmap_put(manager->links, INT_TO_PTR(link->ifindex)((void *) ((intptr_t) (link->ifindex))), link);
480 if (r < 0)
481 return r;
482
483 r = link_update_flags(link, message);
484 if (r < 0)
485 return r;
486
487 *ret = TAKE_PTR(link)({ typeof(link) _ptr_ = (link); (link) = ((void*)0); _ptr_; }
)
;
488
489 return 0;
490}
491
492static void link_free(Link *link) {
493 Address *address;
494 Link *carrier;
495 Iterator i;
496
497 if (!link)
498 return;
499
500 while (!set_isempty(link->addresses))
501 address_free(set_first(link->addresses));
502
503 while (!set_isempty(link->addresses_foreign))
504 address_free(set_first(link->addresses_foreign));
505
506 link->addresses = set_free(link->addresses);
507
508 link->addresses_foreign = set_free(link->addresses_foreign);
509
510 while ((address = link->pool_addresses)) {
511 LIST_REMOVE(addresses, link->pool_addresses, address)do { typeof(*(link->pool_addresses)) **_head = &(link->
pool_addresses), *_item = (address); do { if ((__builtin_expect
(!!(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD,
("_item"), "../src/network/networkd-link.c", 511, __PRETTY_FUNCTION__
); } while (0); if (_item->addresses_next) _item->addresses_next
->addresses_prev = _item->addresses_prev; if (_item->
addresses_prev) _item->addresses_prev->addresses_next =
_item->addresses_next; else { do { if ((__builtin_expect(
!!(!(*_head == _item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("*_head == _item"), "../src/network/networkd-link.c", 511,
__PRETTY_FUNCTION__); } while (0); *_head = _item->addresses_next
; } _item->addresses_next = _item->addresses_prev = ((void
*)0); } while (0)
;
512 address_free(address);
513 }
514
515 sd_dhcp_server_unref(link->dhcp_server);
516 sd_dhcp_client_unref(link->dhcp_client);
517 sd_dhcp_lease_unref(link->dhcp_lease);
518
519 link_lldp_emit_stop(link);
520
521 free(link->lease_file);
522
523 sd_lldp_unref(link->lldp);
524 free(link->lldp_file);
525
526 ndisc_flush(link);
527
528 sd_ipv4ll_unref(link->ipv4ll);
529 sd_dhcp6_client_unref(link->dhcp6_client);
530 sd_ndisc_unref(link->ndisc);
531 sd_radv_unref(link->radv);
532
533 if (link->manager)
534 hashmap_remove(link->manager->links, INT_TO_PTR(link->ifindex)((void *) ((intptr_t) (link->ifindex))));
535
536 free(link->ifname);
537
538 free(link->kind);
539
540 (void)unlink(link->state_file);
541 free(link->state_file);
542
543 udev_device_unref(link->udev_device);
544
545 HASHMAP_FOREACH (carrier, link->bound_to_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_to_links
), &(i), (void**)&(carrier), ((void*)0)); )
546 hashmap_remove(link->bound_to_links, INT_TO_PTR(carrier->ifindex)((void *) ((intptr_t) (carrier->ifindex))));
547 hashmap_free(link->bound_to_links);
548
549 HASHMAP_FOREACH (carrier, link->bound_by_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_by_links
), &(i), (void**)&(carrier), ((void*)0)); )
550 hashmap_remove(link->bound_by_links, INT_TO_PTR(carrier->ifindex)((void *) ((intptr_t) (carrier->ifindex))));
551 hashmap_free(link->bound_by_links);
552
553 free(link);
554}
555
556Link *link_unref(Link *link) {
557 if (!link)
558 return NULL((void*)0);
559
560 assert(link->n_ref > 0)do { if ((__builtin_expect(!!(!(link->n_ref > 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->n_ref > 0"), "../src/network/networkd-link.c"
, 560, __PRETTY_FUNCTION__); } while (0)
;
561
562 link->n_ref--;
563
564 if (link->n_ref > 0)
565 return NULL((void*)0);
566
567 link_free(link);
568
569 return NULL((void*)0);
570}
571
572Link *link_ref(Link *link) {
573 if (!link)
574 return NULL((void*)0);
575
576 assert(link->n_ref > 0)do { if ((__builtin_expect(!!(!(link->n_ref > 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->n_ref > 0"), "../src/network/networkd-link.c"
, 576, __PRETTY_FUNCTION__); } while (0)
;
577
578 link->n_ref++;
579
580 return link;
581}
582
583int link_get(Manager *m, int ifindex, Link **ret) {
584 Link *link;
585
586 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 586
, __PRETTY_FUNCTION__); } while (0)
;
587 assert(ifindex)do { if ((__builtin_expect(!!(!(ifindex)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("ifindex"), "../src/network/networkd-link.c"
, 587, __PRETTY_FUNCTION__); } while (0)
;
588 assert(ret)do { if ((__builtin_expect(!!(!(ret)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("ret"), "../src/network/networkd-link.c"
, 588, __PRETTY_FUNCTION__); } while (0)
;
589
590 link = hashmap_get(m->links, INT_TO_PTR(ifindex)((void *) ((intptr_t) (ifindex))));
591 if (!link)
592 return -ENODEV19;
593
594 *ret = link;
595
596 return 0;
597}
598
599static void link_set_state(Link *link, LinkState state) {
600 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 600, __PRETTY_FUNCTION__); } while (0)
;
601
602 if (link->state == state)
603 return;
604
605 link->state = state;
606
607 link_send_changed(link, "AdministrativeState", NULL((void*)0));
608}
609
610static void link_enter_unmanaged(Link *link) {
611 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 611, __PRETTY_FUNCTION__); } while (0)
;
612
613 log_link_debug(link, "Unmanaged")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 613, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Unmanaged") : log_internal_realm(((LOG_REALM_SYSTEMD) <<
10 | ((7))), 0, "../src/network/networkd-link.c", 613, __func__
, "Unmanaged"); })
;
614
615 link_set_state(link, LINK_STATE_UNMANAGED);
616
617 link_dirty(link);
618}
619
620static int link_stop_clients(Link *link) {
621 int r = 0, k;
622
623 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 623, __PRETTY_FUNCTION__); } while (0)
;
624 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 624, __PRETTY_FUNCTION__); } while (0)
;
625 assert(link->manager->event)do { if ((__builtin_expect(!!(!(link->manager->event)),
0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->event"
), "../src/network/networkd-link.c", 625, __PRETTY_FUNCTION__
); } while (0)
;
626
627 if (link->dhcp_client) {
628 k = sd_dhcp_client_stop(link->dhcp_client);
629 if (k < 0)
630 r = log_link_warning_errno(link, k, "Could not stop DHCPv4 client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, k, "../src/network/networkd-link.c"
, 630, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not stop DHCPv4 client: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), k, "../src/network/networkd-link.c"
, 630, __func__, "Could not stop DHCPv4 client: %m"); })
;
631 }
632
633 if (link->ipv4ll) {
634 k = sd_ipv4ll_stop(link->ipv4ll);
635 if (k < 0)
636 r = log_link_warning_errno(link, k, "Could not stop IPv4 link-local: %m")({ const Link *_l = (link); _l ? log_object_internal(4, k, "../src/network/networkd-link.c"
, 636, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not stop IPv4 link-local: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), k, "../src/network/networkd-link.c"
, 636, __func__, "Could not stop IPv4 link-local: %m"); })
;
637 }
638
639 if (link->dhcp6_client) {
640 k = sd_dhcp6_client_stop(link->dhcp6_client);
641 if (k < 0)
642 r = log_link_warning_errno(link, k, "Could not stop DHCPv6 client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, k, "../src/network/networkd-link.c"
, 642, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not stop DHCPv6 client: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), k, "../src/network/networkd-link.c"
, 642, __func__, "Could not stop DHCPv6 client: %m"); })
;
643 }
644
645 if (link->ndisc) {
646 k = sd_ndisc_stop(link->ndisc);
647 if (k < 0)
648 r = log_link_warning_errno(link, k, "Could not stop IPv6 Router Discovery: %m")({ const Link *_l = (link); _l ? log_object_internal(4, k, "../src/network/networkd-link.c"
, 648, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not stop IPv6 Router Discovery: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), k, "../src/network/networkd-link.c"
, 648, __func__, "Could not stop IPv6 Router Discovery: %m");
})
;
649 }
650
651 if (link->radv) {
652 k = sd_radv_stop(link->radv);
653 if (k < 0)
654 r = log_link_warning_errno(link, k, "Could not stop IPv6 Router Advertisement: %m")({ const Link *_l = (link); _l ? log_object_internal(4, k, "../src/network/networkd-link.c"
, 654, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not stop IPv6 Router Advertisement: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), k, "../src/network/networkd-link.c"
, 654, __func__, "Could not stop IPv6 Router Advertisement: %m"
); })
;
655 }
656
657 link_lldp_emit_stop(link);
658 return r;
659}
660
661void link_enter_failed(Link *link) {
662 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 662, __PRETTY_FUNCTION__); } while (0)
;
663
664 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
665 return;
666
667 log_link_warning(link, "Failed")({ const Link *_l = (link); _l ? log_object_internal(4, 0, "../src/network/networkd-link.c"
, 667, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Failed") : log_internal_realm(((LOG_REALM_SYSTEMD) <<
10 | ((4))), 0, "../src/network/networkd-link.c", 667, __func__
, "Failed"); })
;
668
669 link_set_state(link, LINK_STATE_FAILED);
670
671 link_stop_clients(link);
672
673 link_dirty(link);
674}
675
676static Address* link_find_dhcp_server_address(Link *link) {
677 Address *address;
678
679 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 679, __PRETTY_FUNCTION__); } while (0)
;
680 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 680, __PRETTY_FUNCTION__); } while (0)
;
681
682 /* The first statically configured address if there is any */
683 LIST_FOREACH(addresses, address, link->network->static_addresses)for ((address) = (link->network->static_addresses); (address
); (address) = (address)->addresses_next)
{
684
685 if (address->family != AF_INET2)
686 continue;
687
688 if (in_addr_is_null(address->family, &address->in_addr))
689 continue;
690
691 return address;
692 }
693
694 /* If that didn't work, find a suitable address we got from the pool */
695 LIST_FOREACH(addresses, address, link->pool_addresses)for ((address) = (link->pool_addresses); (address); (address
) = (address)->addresses_next)
{
696 if (address->family != AF_INET2)
697 continue;
698
699 return address;
700 }
701
702 return NULL((void*)0);
703}
704
705static void link_enter_configured(Link *link) {
706 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 706, __PRETTY_FUNCTION__); } while (0)
;
707 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 707, __PRETTY_FUNCTION__); } while (0)
;
708
709 if (link->state != LINK_STATE_SETTING_ROUTES)
710 return;
711
712 log_link_info(link, "Configured")({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 712, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Configured") : log_internal_realm(((LOG_REALM_SYSTEMD)
<< 10 | ((6))), 0, "../src/network/networkd-link.c", 712
, __func__, "Configured"); })
;
713
714 link_set_state(link, LINK_STATE_CONFIGURED);
715
716 link_dirty(link);
717}
718
719void link_check_ready(Link *link) {
720 Address *a;
721 Iterator i;
722
723 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 723, __PRETTY_FUNCTION__); } while (0)
;
724
725 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
726 return;
727
728 if (!link->network)
729 return;
730
731 if (!link->static_routes_configured)
732 return;
733
734 if (!link->routing_policy_rules_configured)
735 return;
736
737 if (link_ipv4ll_enabled(link))
738 if (!link->ipv4ll_address ||
739 !link->ipv4ll_route)
740 return;
741
742 if (!link->network->bridge) {
743
744 if (link_ipv6ll_enabled(link))
745 if (in_addr_is_null(AF_INET610, (const union in_addr_union*) &link->ipv6ll_address) > 0)
746 return;
747
748 if ((link_dhcp4_enabled(link) && !link_dhcp6_enabled(link) &&
749 !link->dhcp4_configured) ||
750 (link_dhcp6_enabled(link) && !link_dhcp4_enabled(link) &&
751 !link->dhcp6_configured) ||
752 (link_dhcp4_enabled(link) && link_dhcp6_enabled(link) &&
753 !link->dhcp4_configured && !link->dhcp6_configured))
754 return;
755
756 if (link_ipv6_accept_ra_enabled(link) && !link->ndisc_configured)
757 return;
758 }
759
760 SET_FOREACH(a, link->addresses, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->addresses), &
(i), (void**)&(a)); )
761 if (!address_is_ready(a))
762 return;
763
764 if (link->state != LINK_STATE_CONFIGURED)
765 link_enter_configured(link);
766
767 return;
768}
769
770static int link_set_routing_policy_rule(Link *link) {
771 RoutingPolicyRule *rule, *rrule = NULL((void*)0);
772 int r;
773
774 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 774, __PRETTY_FUNCTION__); } while (0)
;
775 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 775, __PRETTY_FUNCTION__); } while (0)
;
776
777 LIST_FOREACH(rules, rule, link->network->rules)for ((rule) = (link->network->rules); (rule); (rule) = (
rule)->rules_next)
{
778 r = routing_policy_rule_get(link->manager, rule->family, &rule->from, rule->from_prefixlen, &rule->to,
779 rule->to_prefixlen, rule->tos, rule->fwmark, rule->table, rule->iif, rule->oif, &rrule);
780 if (r == 1) {
781 (void) routing_policy_rule_make_local(link->manager, rrule);
782 continue;
783 }
784
785 r = routing_policy_rule_configure(rule, link, link_routing_policy_rule_handler, false0);
786 if (r < 0) {
787 log_link_warning_errno(link, r, "Could not set routing policy rules: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 787, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not set routing policy rules: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 787, __func__, "Could not set routing policy rules: %m"); }
)
;
788 link_enter_failed(link);
789 return r;
790 }
791
792 link->routing_policy_rule_messages++;
793 }
794
795 routing_policy_rule_purge(link->manager, link);
796 if (link->routing_policy_rule_messages == 0) {
797 link->routing_policy_rules_configured = true1;
798 link_check_ready(link);
799 } else
800 log_link_debug(link, "Setting routing policy rules")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 800, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Setting routing policy rules") : log_internal_realm(((
LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 800, __func__, "Setting routing policy rules"); })
;
801
802 return 0;
803}
804
805static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
806 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
807 int r;
808
809 assert(link->route_messages > 0)do { if ((__builtin_expect(!!(!(link->route_messages > 0
)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->route_messages > 0"
), "../src/network/networkd-link.c", 809, __PRETTY_FUNCTION__
); } while (0)
;
810 assert(IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES,do { if ((__builtin_expect(!!(!(({ _Bool _found = 0; static __attribute__
((unused)) char _static_assert__macros_need_to_be_extended[20
- sizeof((int[]){LINK_STATE_SETTING_ADDRESSES, LINK_STATE_SETTING_ROUTES
, LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof(int)]; switch
(link->state) { case LINK_STATE_SETTING_ADDRESSES: case LINK_STATE_SETTING_ROUTES
: case LINK_STATE_FAILED: case LINK_STATE_LINGER: _found = 1;
break; default: break; } _found; }))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES, LINK_STATE_SETTING_ROUTES, LINK_STATE_FAILED, LINK_STATE_LINGER)"
), "../src/network/networkd-link.c", 812, __PRETTY_FUNCTION__
); } while (0)
811 LINK_STATE_SETTING_ROUTES, LINK_STATE_FAILED,do { if ((__builtin_expect(!!(!(({ _Bool _found = 0; static __attribute__
((unused)) char _static_assert__macros_need_to_be_extended[20
- sizeof((int[]){LINK_STATE_SETTING_ADDRESSES, LINK_STATE_SETTING_ROUTES
, LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof(int)]; switch
(link->state) { case LINK_STATE_SETTING_ADDRESSES: case LINK_STATE_SETTING_ROUTES
: case LINK_STATE_FAILED: case LINK_STATE_LINGER: _found = 1;
break; default: break; } _found; }))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES, LINK_STATE_SETTING_ROUTES, LINK_STATE_FAILED, LINK_STATE_LINGER)"
), "../src/network/networkd-link.c", 812, __PRETTY_FUNCTION__
); } while (0)
812 LINK_STATE_LINGER))do { if ((__builtin_expect(!!(!(({ _Bool _found = 0; static __attribute__
((unused)) char _static_assert__macros_need_to_be_extended[20
- sizeof((int[]){LINK_STATE_SETTING_ADDRESSES, LINK_STATE_SETTING_ROUTES
, LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof(int)]; switch
(link->state) { case LINK_STATE_SETTING_ADDRESSES: case LINK_STATE_SETTING_ROUTES
: case LINK_STATE_FAILED: case LINK_STATE_LINGER: _found = 1;
break; default: break; } _found; }))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES, LINK_STATE_SETTING_ROUTES, LINK_STATE_FAILED, LINK_STATE_LINGER)"
), "../src/network/networkd-link.c", 812, __PRETTY_FUNCTION__
); } while (0)
;
813
814 link->route_messages--;
815
816 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
817 return 1;
818
819 r = sd_netlink_message_get_errno(m);
820 if (r < 0 && r != -EEXIST17)
821 log_link_warning_errno(link, r, "Could not set route: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 821, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not set route: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), r, "../src/network/networkd-link.c", 821
, __func__, "Could not set route: %m"); })
;
822
823 if (link->route_messages == 0) {
824 log_link_debug(link, "Routes set")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 824, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Routes set") : log_internal_realm(((LOG_REALM_SYSTEMD)
<< 10 | ((7))), 0, "../src/network/networkd-link.c", 824
, __func__, "Routes set"); })
;
825 link->static_routes_configured = true1;
826 link_check_ready(link);
827 }
828
829 return 1;
830}
831
832static int link_enter_set_routes(Link *link) {
833 Route *rt;
834 int r;
835
836 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 836, __PRETTY_FUNCTION__); } while (0)
;
837 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 837, __PRETTY_FUNCTION__); } while (0)
;
838 assert(link->state == LINK_STATE_SETTING_ADDRESSES)do { if ((__builtin_expect(!!(!(link->state == LINK_STATE_SETTING_ADDRESSES
)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->state == LINK_STATE_SETTING_ADDRESSES"
), "../src/network/networkd-link.c", 838, __PRETTY_FUNCTION__
); } while (0)
;
839
840 (void) link_set_routing_policy_rule(link);
841
842 link_set_state(link, LINK_STATE_SETTING_ROUTES);
843
844 LIST_FOREACH(routes, rt, link->network->static_routes)for ((rt) = (link->network->static_routes); (rt); (rt) =
(rt)->routes_next)
{
845 r = route_configure(rt, link, route_handler);
846 if (r < 0) {
847 log_link_warning_errno(link, r, "Could not set routes: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 847, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not set routes: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), r, "../src/network/networkd-link.c", 847
, __func__, "Could not set routes: %m"); })
;
848 link_enter_failed(link);
849 return r;
850 }
851
852 link->route_messages++;
853 }
854
855 if (link->route_messages == 0) {
856 link->static_routes_configured = true1;
857 link_check_ready(link);
858 } else
859 log_link_debug(link, "Setting routes")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 859, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Setting routes") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 859
, __func__, "Setting routes"); })
;
860
861 return 0;
862}
863
864int link_route_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
865 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
866 int r;
867
868 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 868
, __PRETTY_FUNCTION__); } while (0)
;
869 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 869, __PRETTY_FUNCTION__); } while (0)
;
870 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 870, __PRETTY_FUNCTION__); } while (0)
;
871
872 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
873 return 1;
874
875 r = sd_netlink_message_get_errno(m);
876 if (r < 0 && r != -ESRCH3)
877 log_link_warning_errno(link, r, "Could not drop route: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 877, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Could not drop route: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), r, "../src/network/networkd-link.c", 877
, __func__, "Could not drop route: %m"); })
;
878
879 return 1;
880}
881
882static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
883 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
884 int r;
885
886 assert(rtnl)do { if ((__builtin_expect(!!(!(rtnl)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rtnl"), "../src/network/networkd-link.c"
, 886, __PRETTY_FUNCTION__); } while (0)
;
887 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 887
, __PRETTY_FUNCTION__); } while (0)
;
888 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 888, __PRETTY_FUNCTION__); } while (0)
;
889 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 889, __PRETTY_FUNCTION__); } while (0)
;
890 assert(link->address_messages > 0)do { if ((__builtin_expect(!!(!(link->address_messages >
0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->address_messages > 0"
), "../src/network/networkd-link.c", 890, __PRETTY_FUNCTION__
); } while (0)
;
891 assert(IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES,do { if ((__builtin_expect(!!(!(({ _Bool _found = 0; static __attribute__
((unused)) char _static_assert__macros_need_to_be_extended[20
- sizeof((int[]){LINK_STATE_SETTING_ADDRESSES, LINK_STATE_FAILED
, LINK_STATE_LINGER})/sizeof(int)]; switch(link->state) { case
LINK_STATE_SETTING_ADDRESSES: case LINK_STATE_FAILED: case LINK_STATE_LINGER
: _found = 1; break; default: break; } _found; }))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES, LINK_STATE_FAILED, LINK_STATE_LINGER)"
), "../src/network/networkd-link.c", 892, __PRETTY_FUNCTION__
); } while (0)
892 LINK_STATE_FAILED, LINK_STATE_LINGER))do { if ((__builtin_expect(!!(!(({ _Bool _found = 0; static __attribute__
((unused)) char _static_assert__macros_need_to_be_extended[20
- sizeof((int[]){LINK_STATE_SETTING_ADDRESSES, LINK_STATE_FAILED
, LINK_STATE_LINGER})/sizeof(int)]; switch(link->state) { case
LINK_STATE_SETTING_ADDRESSES: case LINK_STATE_FAILED: case LINK_STATE_LINGER
: _found = 1; break; default: break; } _found; }))),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("IN_SET(link->state, LINK_STATE_SETTING_ADDRESSES, LINK_STATE_FAILED, LINK_STATE_LINGER)"
), "../src/network/networkd-link.c", 892, __PRETTY_FUNCTION__
); } while (0)
;
893
894 link->address_messages--;
895
896 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
897 return 1;
898
899 r = sd_netlink_message_get_errno(m);
900 if (r < 0 && r != -EEXIST17)
901 log_link_warning_errno(link, r, "could not set address: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 901, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "could not set address: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), r, "../src/network/networkd-link.c", 901
, __func__, "could not set address: %m"); })
;
902 else if (r >= 0)
903 manager_rtnl_process_address(rtnl, m, link->manager);
904
905 if (link->address_messages == 0) {
906 log_link_debug(link, "Addresses set")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 906, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Addresses set") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 906
, __func__, "Addresses set"); })
;
907 link_enter_set_routes(link);
908 }
909
910 return 1;
911}
912
913static int address_label_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
914 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
915 int r;
916
917 assert(rtnl)do { if ((__builtin_expect(!!(!(rtnl)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("rtnl"), "../src/network/networkd-link.c"
, 917, __PRETTY_FUNCTION__); } while (0)
;
918 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 918
, __PRETTY_FUNCTION__); } while (0)
;
919 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 919, __PRETTY_FUNCTION__); } while (0)
;
920 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 920, __PRETTY_FUNCTION__); } while (0)
;
921 assert(link->address_label_messages > 0)do { if ((__builtin_expect(!!(!(link->address_label_messages
> 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->address_label_messages > 0"
), "../src/network/networkd-link.c", 921, __PRETTY_FUNCTION__
); } while (0)
;
922
923 link->address_label_messages--;
924
925 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
926 return 1;
927
928 r = sd_netlink_message_get_errno(m);
929 if (r < 0 && r != -EEXIST17)
930 log_link_warning_errno(link, r, "could not set address label: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 930, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "could not set address label: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 930, __func__, "could not set address label: %m"); })
;
931 else if (r >= 0)
932 manager_rtnl_process_address(rtnl, m, link->manager);
933
934 if (link->address_label_messages == 0)
935 log_link_debug(link, "Addresses label set")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 935, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((void
*)0), "Addresses label set") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 935
, __func__, "Addresses label set"); })
;
936
937 return 1;
938}
939
940static int link_push_uplink_dns_to_dhcp_server(Link *link, sd_dhcp_server *s) {
941 _cleanup_free___attribute__((cleanup(freep))) struct in_addr *addresses = NULL((void*)0);
942 size_t n_addresses = 0, n_allocated = 0;
943 unsigned i;
944
945 log_debug("Copying DNS server information from %s", link->ifname)({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/network/networkd-link.c", 945, __func__, "Copying DNS server information from %s"
, link->ifname) : -abs(_e); })
;
946
947 if (!link->network)
948 return 0;
949
950 for (i = 0; i < link->network->n_dns; i++) {
951 struct in_addr ia;
952
953 /* Only look for IPv4 addresses */
954 if (link->network->dns[i].family != AF_INET2)
955 continue;
956
957 ia = link->network->dns[i].address.in;
958
959 /* Never propagate obviously borked data */
960 if (in4_addr_is_null(&ia) || in4_addr_is_localhost(&ia))
961 continue;
962
963 if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + 1)greedy_realloc((void**) &(addresses), &(n_allocated),
(n_addresses + 1), sizeof((addresses)[0]))
)
964 return log_oom()log_oom_internal(LOG_REALM_SYSTEMD, "../src/network/networkd-link.c"
, 964, __func__)
;
965
966 addresses[n_addresses++] = ia;
967 }
968
969 if (link->network->dhcp_use_dns && link->dhcp_lease) {
970 const struct in_addr *da = NULL((void*)0);
971 int n;
972
973 n = sd_dhcp_lease_get_dns(link->dhcp_lease, &da);
974 if (n > 0) {
975
976 if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n)greedy_realloc((void**) &(addresses), &(n_allocated),
(n_addresses + n), sizeof((addresses)[0]))
)
977 return log_oom()log_oom_internal(LOG_REALM_SYSTEMD, "../src/network/networkd-link.c"
, 977, __func__)
;
978
979 memcpy(addresses + n_addresses, da, n * sizeof(struct in_addr));
980 n_addresses += n;
981 }
982 }
983
984 if (n_addresses <= 0)
985 return 0;
986
987 return sd_dhcp_server_set_dns(s, addresses, n_addresses);
988}
989
990static int link_push_uplink_ntp_to_dhcp_server(Link *link, sd_dhcp_server *s) {
991 _cleanup_free___attribute__((cleanup(freep))) struct in_addr *addresses = NULL((void*)0);
992 size_t n_addresses = 0, n_allocated = 0;
993 char **a;
994
995 if (!link->network)
996 return 0;
997
998 log_debug("Copying NTP server information from %s", link->ifname)({ int _level = (((7))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/network/networkd-link.c", 998, __func__, "Copying NTP server information from %s"
, link->ifname) : -abs(_e); })
;
999
1000 STRV_FOREACH(a, link->network->ntp)for ((a) = (link->network->ntp); (a) && *(a); (
a)++)
{
1001 struct in_addr ia;
1002
1003 /* Only look for IPv4 addresses */
1004 if (inet_pton(AF_INET2, *a, &ia) <= 0)
1005 continue;
1006
1007 /* Never propagate obviously borked data */
1008 if (in4_addr_is_null(&ia) || in4_addr_is_localhost(&ia))
1009 continue;
1010
1011 if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + 1)greedy_realloc((void**) &(addresses), &(n_allocated),
(n_addresses + 1), sizeof((addresses)[0]))
)
1012 return log_oom()log_oom_internal(LOG_REALM_SYSTEMD, "../src/network/networkd-link.c"
, 1012, __func__)
;
1013
1014 addresses[n_addresses++] = ia;
1015 }
1016
1017 if (link->network->dhcp_use_ntp && link->dhcp_lease) {
1018 const struct in_addr *da = NULL((void*)0);
1019 int n;
1020
1021 n = sd_dhcp_lease_get_ntp(link->dhcp_lease, &da);
1022 if (n > 0) {
1023
1024 if (!GREEDY_REALLOC(addresses, n_allocated, n_addresses + n)greedy_realloc((void**) &(addresses), &(n_allocated),
(n_addresses + n), sizeof((addresses)[0]))
)
1025 return log_oom()log_oom_internal(LOG_REALM_SYSTEMD, "../src/network/networkd-link.c"
, 1025, __func__)
;
1026
1027 memcpy(addresses + n_addresses, da, n * sizeof(struct in_addr));
1028 n_addresses += n;
1029 }
1030 }
1031
1032 if (n_addresses <= 0)
1033 return 0;
1034
1035 return sd_dhcp_server_set_ntp(s, addresses, n_addresses);
1036}
1037
1038static int link_set_bridge_fdb(Link *link) {
1039 FdbEntry *fdb_entry;
1040 int r;
1041
1042 LIST_FOREACH(static_fdb_entries, fdb_entry, link->network->static_fdb_entries)for ((fdb_entry) = (link->network->static_fdb_entries);
(fdb_entry); (fdb_entry) = (fdb_entry)->static_fdb_entries_next
)
{
1043 r = fdb_entry_configure(link, fdb_entry);
1044 if (r < 0)
1045 return log_link_error_errno(link, r, "Failed to add MAC entry to static MAC table: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1045, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to add MAC entry to static MAC table: %m") :
log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3)))
, r, "../src/network/networkd-link.c", 1045, __func__, "Failed to add MAC entry to static MAC table: %m"
); })
;
1046 }
1047
1048 return 0;
1049}
1050
1051static int link_enter_set_addresses(Link *link) {
1052 AddressLabel *label;
1053 Address *ad;
1054 int r;
1055
1056 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1056, __PRETTY_FUNCTION__); } while (0)
;
1057 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 1057, __PRETTY_FUNCTION__); } while (0)
;
1058 assert(link->state != _LINK_STATE_INVALID)do { if ((__builtin_expect(!!(!(link->state != _LINK_STATE_INVALID
)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->state != _LINK_STATE_INVALID"
), "../src/network/networkd-link.c", 1058, __PRETTY_FUNCTION__
); } while (0)
;
1059
1060 r = link_set_bridge_fdb(link);
1061 if (r < 0)
1062 return r;
1063
1064 link_set_state(link, LINK_STATE_SETTING_ADDRESSES);
1065
1066 LIST_FOREACH(addresses, ad, link->network->static_addresses)for ((ad) = (link->network->static_addresses); (ad); (ad
) = (ad)->addresses_next)
{
1067 r = address_configure(ad, link, address_handler, false0);
1068 if (r < 0) {
1069 log_link_warning_errno(link, r, "Could not set addresses: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1069, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set addresses: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1069, __func__, "Could not set addresses: %m"); })
;
1070 link_enter_failed(link);
1071 return r;
1072 }
1073
1074 link->address_messages++;
1075 }
1076
1077 LIST_FOREACH(labels, label, link->network->address_labels)for ((label) = (link->network->address_labels); (label)
; (label) = (label)->labels_next)
{
1078 r = address_label_configure(label, link, address_label_handler, false0);
1079 if (r < 0) {
1080 log_link_warning_errno(link, r, "Could not set address label: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1080, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set address label: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1080, __func__, "Could not set address label: %m"); })
;
1081 link_enter_failed(link);
1082 return r;
1083 }
1084
1085 link->address_label_messages++;
1086 }
1087
1088 /* now that we can figure out a default address for the dhcp server,
1089 start it */
1090 if (link_dhcp4_server_enabled(link)) {
1091 Address *address;
1092 Link *uplink = NULL((void*)0);
1093 bool_Bool acquired_uplink = false0;
1094
1095 address = link_find_dhcp_server_address(link);
1096 if (!address) {
1097 log_link_warning(link, "Failed to find suitable address for DHCPv4 server instance.")({ const Link *_l = (link); _l ? log_object_internal(4, 0, "../src/network/networkd-link.c"
, 1097, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to find suitable address for DHCPv4 server instance."
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), 0, "../src/network/networkd-link.c", 1097, __func__, "Failed to find suitable address for DHCPv4 server instance."
); })
;
1098 link_enter_failed(link);
1099 return 0;
1100 }
1101
1102 /* use the server address' subnet as the pool */
1103 r = sd_dhcp_server_configure_pool(link->dhcp_server, &address->in_addr.in, address->prefixlen,
1104 link->network->dhcp_server_pool_offset, link->network->dhcp_server_pool_size);
1105 if (r < 0)
1106 return r;
1107
1108 /* TODO:
1109 r = sd_dhcp_server_set_router(link->dhcp_server,
1110 &main_address->in_addr.in);
1111 if (r < 0)
1112 return r;
1113 */
1114
1115 if (link->network->dhcp_server_max_lease_time_usec > 0) {
1116 r = sd_dhcp_server_set_max_lease_time(
1117 link->dhcp_server,
1118 DIV_ROUND_UP(link->network->dhcp_server_max_lease_time_usec, USEC_PER_SEC)({ const typeof((link->network->dhcp_server_max_lease_time_usec
)) __unique_prefix_X20 = ((link->network->dhcp_server_max_lease_time_usec
)); const typeof((((usec_t) 1000000ULL))) __unique_prefix_Y21
= ((((usec_t) 1000000ULL))); (__unique_prefix_X20 / __unique_prefix_Y21
+ !!(__unique_prefix_X20 % __unique_prefix_Y21)); })
);
1119 if (r < 0)
1120 return r;
1121 }
1122
1123 if (link->network->dhcp_server_default_lease_time_usec > 0) {
1124 r = sd_dhcp_server_set_default_lease_time(
1125 link->dhcp_server,
1126 DIV_ROUND_UP(link->network->dhcp_server_default_lease_time_usec, USEC_PER_SEC)({ const typeof((link->network->dhcp_server_default_lease_time_usec
)) __unique_prefix_X22 = ((link->network->dhcp_server_default_lease_time_usec
)); const typeof((((usec_t) 1000000ULL))) __unique_prefix_Y23
= ((((usec_t) 1000000ULL))); (__unique_prefix_X22 / __unique_prefix_Y23
+ !!(__unique_prefix_X22 % __unique_prefix_Y23)); })
);
1127 if (r < 0)
1128 return r;
1129 }
1130
1131 if (link->network->dhcp_server_emit_dns) {
1132
1133 if (link->network->n_dhcp_server_dns > 0)
1134 r = sd_dhcp_server_set_dns(link->dhcp_server, link->network->dhcp_server_dns, link->network->n_dhcp_server_dns);
1135 else {
1136 uplink = manager_find_uplink(link->manager, link);
1137 acquired_uplink = true1;
1138
1139 if (!uplink) {
1140 log_link_debug(link, "Not emitting DNS server information on link, couldn't find suitable uplink.")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1140, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Not emitting DNS server information on link, couldn't find suitable uplink."
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 1140, __func__, "Not emitting DNS server information on link, couldn't find suitable uplink."
); })
;
1141 r = 0;
1142 } else
1143 r = link_push_uplink_dns_to_dhcp_server(uplink, link->dhcp_server);
1144 }
1145 if (r < 0)
1146 log_link_warning_errno(link, r, "Failed to set DNS server for DHCP server, ignoring: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1146, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to set DNS server for DHCP server, ignoring: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 1146, __func__, "Failed to set DNS server for DHCP server, ignoring: %m"
); })
;
1147 }
1148
1149 if (link->network->dhcp_server_emit_ntp) {
1150
1151 if (link->network->n_dhcp_server_ntp > 0)
1152 r = sd_dhcp_server_set_ntp(link->dhcp_server, link->network->dhcp_server_ntp, link->network->n_dhcp_server_ntp);
1153 else {
1154 if (!acquired_uplink)
1155 uplink = manager_find_uplink(link->manager, link);
1156
1157 if (!uplink) {
1158 log_link_debug(link, "Not emitting NTP server information on link, couldn't find suitable uplink.")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1158, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Not emitting NTP server information on link, couldn't find suitable uplink."
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 1158, __func__, "Not emitting NTP server information on link, couldn't find suitable uplink."
); })
;
1159 r = 0;
1160 } else
1161 r = link_push_uplink_ntp_to_dhcp_server(uplink, link->dhcp_server);
1162
1163 }
1164 if (r < 0)
1165 log_link_warning_errno(link, r, "Failed to set NTP server for DHCP server, ignoring: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1165, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to set NTP server for DHCP server, ignoring: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 1165, __func__, "Failed to set NTP server for DHCP server, ignoring: %m"
); })
;
1166 }
1167
1168 r = sd_dhcp_server_set_emit_router(link->dhcp_server, link->network->dhcp_server_emit_router);
1169 if (r < 0) {
1170 log_link_warning_errno(link, r, "Failed to set router emission for DHCP server: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1170, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to set router emission for DHCP server: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 1170, __func__, "Failed to set router emission for DHCP server: %m"
); })
;
1171 return r;
1172 }
1173
1174 if (link->network->dhcp_server_emit_timezone) {
1175 _cleanup_free___attribute__((cleanup(freep))) char *buffer = NULL((void*)0);
1176 const char *tz = NULL((void*)0);
1177
1178 if (link->network->dhcp_server_timezone)
1179 tz = link->network->dhcp_server_timezone;
1180 else {
1181 r = get_timezone(&buffer);
1182 if (r < 0)
1183 log_warning_errno(r, "Failed to determine timezone: %m")({ int _level = ((4)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/network/networkd-link.c", 1183, __func__, "Failed to determine timezone: %m"
) : -abs(_e); })
;
1184 else
1185 tz = buffer;
1186 }
1187
1188 if (tz) {
1189 r = sd_dhcp_server_set_timezone(link->dhcp_server, tz);
1190 if (r < 0)
1191 return r;
1192 }
1193 }
1194
1195 r = sd_dhcp_server_start(link->dhcp_server);
1196 if (r < 0) {
1197 log_link_warning_errno(link, r, "Could not start DHCPv4 server instance: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1197, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not start DHCPv4 server instance: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1197, __func__, "Could not start DHCPv4 server instance: %m"
); })
;
1198
1199 link_enter_failed(link);
1200
1201 return 0;
1202 }
1203
1204 log_link_debug(link, "Offering DHCPv4 leases")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1204, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Offering DHCPv4 leases") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1204
, __func__, "Offering DHCPv4 leases"); })
;
1205 }
1206
1207 if (link->address_messages == 0)
1208 link_enter_set_routes(link);
1209 else
1210 log_link_debug(link, "Setting addresses")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1210, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Setting addresses") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1210
, __func__, "Setting addresses"); })
;
1211
1212 return 0;
1213}
1214
1215int link_address_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
1216 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
1217 int r;
1218
1219 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 1219
, __PRETTY_FUNCTION__); } while (0)
;
1220 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1220, __PRETTY_FUNCTION__); } while (0)
;
1221 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 1221, __PRETTY_FUNCTION__); } while (0)
;
1222
1223 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
1224 return 1;
1225
1226 r = sd_netlink_message_get_errno(m);
1227 if (r < 0 && r != -EADDRNOTAVAIL99)
1228 log_link_warning_errno(link, r, "Could not drop address: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1228, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not drop address: %m") : log_internal_realm(
((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1228, __func__, "Could not drop address: %m"); })
;
1229
1230 return 1;
1231}
1232
1233static int link_set_bridge_vlan(Link *link) {
1234 int r = 0;
1235
1236 r = br_vlan_configure(link, link->network->pvid, link->network->br_vid_bitmap, link->network->br_untagged_bitmap);
1237 if (r < 0)
1238 log_link_error_errno(link, r, "Failed to assign VLANs to bridge port: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1238, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to assign VLANs to bridge port: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1238, __func__, "Failed to assign VLANs to bridge port: %m"
); })
;
1239
1240 return r;
1241}
1242
1243static int link_set_proxy_arp(Link *link) {
1244 const char *p = NULL((void*)0);
1245 int r;
1246
1247 if (!link_proxy_arp_enabled(link))
1248 return 0;
1249
1250 p = strjoina("/proc/sys/net/ipv4/conf/", link->ifname, "/proxy_arp")({ const char *_appendees_[] = { "/proc/sys/net/ipv4/conf/", link
->ifname, "/proxy_arp" }; char *_d_, *_p_; size_t _len_ = 0
; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
1251
1252 r = write_string_file(p, one_zero(link->network->proxy_arp), WRITE_STRING_FILE_VERIFY_ON_FAILURE);
1253 if (r < 0)
1254 log_link_warning_errno(link, r, "Cannot configure proxy ARP for interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1254, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot configure proxy ARP for interface: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1254, __func__, "Cannot configure proxy ARP for interface: %m"
); })
;
1255
1256 return 0;
1257}
1258
1259static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
1260 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
1261 int r;
1262
1263 log_link_debug(link, "Set link")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1263, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Set link") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1263
, __func__, "Set link"); })
;
1264
1265 r = sd_netlink_message_get_errno(m);
1266 if (r < 0 && r != -EEXIST17) {
1267 log_link_error_errno(link, r, "Could not join netdev: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1267, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not join netdev: %m") : log_internal_realm((
(LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1267, __func__, "Could not join netdev: %m"); })
;
1268 link_enter_failed(link);
1269 return 1;
1270 }
1271
1272 return 0;
1273}
1274
1275static int set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
1276 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
1277 int r;
1278
1279 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 1279
, __PRETTY_FUNCTION__); } while (0)
;
1280 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1280, __PRETTY_FUNCTION__); } while (0)
;
1281 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 1281, __PRETTY_FUNCTION__); } while (0)
;
1282
1283 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
1284 return 1;
1285
1286 r = sd_netlink_message_get_errno(m);
1287 if (r < 0)
1288 log_link_warning_errno(link, r, "Could not set MTU: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1288, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set MTU: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), r, "../src/network/networkd-link.c", 1288
, __func__, "Could not set MTU: %m"); })
;
1289
1290 return 1;
1291}
1292
1293int link_set_mtu(Link *link, uint32_t mtu) {
1294 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
1295 int r;
1296
1297 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1297, __PRETTY_FUNCTION__); } while (0)
;
1298 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 1298, __PRETTY_FUNCTION__); } while (0)
;
1299 assert(link->manager->rtnl)do { if ((__builtin_expect(!!(!(link->manager->rtnl)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->rtnl"
), "../src/network/networkd-link.c", 1299, __PRETTY_FUNCTION__
); } while (0)
;
1300
1301 log_link_debug(link, "Setting MTU: %" PRIu32, mtu)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1301, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Setting MTU: %" "u", mtu) : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1301
, __func__, "Setting MTU: %" "u", mtu); })
;
1302
1303 r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINKRTM_SETLINK, link->ifindex);
1304 if (r < 0)
1305 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1305, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not allocate RTM_SETLINK message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1305, __func__, "Could not allocate RTM_SETLINK message: %m"
); })
;
1306
1307 /* If IPv6 not configured (no static IPv6 address and IPv6LL autoconfiguration is disabled)
1308 for this interface, or if it is a bridge slave, then disable IPv6 else enable it. */
1309 (void) link_enable_ipv6(link);
1310
1311 /* IPv6 protocol requires a minimum MTU of IPV6_MTU_MIN(1280) bytes
1312 on the interface. Bump up MTU bytes to IPV6_MTU_MIN. */
1313 if (link_ipv6_enabled(link) && link->network->mtu < IPV6_MIN_MTU1280) {
1314
1315 log_link_warning(link, "Bumping MTU to " STRINGIFY(IPV6_MIN_MTU) ", as "({ const Link *_l = (link); _l ? log_object_internal(4, 0, "../src/network/networkd-link.c"
, 1316, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Bumping MTU to " "1280" ", as " "IPv6 is requested and requires a minimum MTU of "
"1280" " bytes: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), 0, "../src/network/networkd-link.c", 1316
, __func__, "Bumping MTU to " "1280" ", as " "IPv6 is requested and requires a minimum MTU of "
"1280" " bytes: %m"); })
1316 "IPv6 is requested and requires a minimum MTU of " STRINGIFY(IPV6_MIN_MTU) " bytes: %m")({ const Link *_l = (link); _l ? log_object_internal(4, 0, "../src/network/networkd-link.c"
, 1316, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Bumping MTU to " "1280" ", as " "IPv6 is requested and requires a minimum MTU of "
"1280" " bytes: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((4))), 0, "../src/network/networkd-link.c", 1316
, __func__, "Bumping MTU to " "1280" ", as " "IPv6 is requested and requires a minimum MTU of "
"1280" " bytes: %m"); })
;
1317
1318 link->network->mtu = IPV6_MIN_MTU1280;
1319 }
1320
1321 r = sd_netlink_message_append_u32(req, IFLA_MTU, link->network->mtu);
1322 if (r < 0)
1323 return log_link_error_errno(link, r, "Could not set MTU: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1323, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set MTU: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((3))), r, "../src/network/networkd-link.c", 1323
, __func__, "Could not set MTU: %m"); })
;
1324
1325 r = sd_netlink_message_append_u32(req, IFLA_MTU, mtu);
1326 if (r < 0)
1327 return log_link_error_errno(link, r, "Could not append MTU: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1327, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append MTU: %m") : log_internal_realm(((
LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1327, __func__, "Could not append MTU: %m"); })
;
1328
1329 r = sd_netlink_call_async(link->manager->rtnl, req, set_mtu_handler, link, 0, NULL((void*)0));
1330 if (r < 0)
1331 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1331, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1331, __func__, "Could not send rtnetlink message: %m"); })
;
1332
1333 link->setting_mtu = true1;
1334
1335 link_ref(link);
1336
1337 return 0;
1338}
1339
1340static int set_flags_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
1341 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
1342 int r;
1343
1344 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 1344
, __PRETTY_FUNCTION__); } while (0)
;
1345 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1345, __PRETTY_FUNCTION__); } while (0)
;
1346 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 1346, __PRETTY_FUNCTION__); } while (0)
;
1347
1348 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
1349 return 1;
1350
1351 r = sd_netlink_message_get_errno(m);
1352 if (r < 0)
1353 log_link_warning_errno(link, r, "Could not set link flags: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1353, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set link flags: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1353, __func__, "Could not set link flags: %m"); })
;
1354
1355 return 1;
1356}
1357
1358static int link_set_flags(Link *link) {
1359 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
1360 unsigned ifi_change = 0;
1361 unsigned ifi_flags = 0;
1362 int r;
1363
1364 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1364, __PRETTY_FUNCTION__); } while (0)
;
1365 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 1365, __PRETTY_FUNCTION__); } while (0)
;
1366 assert(link->manager->rtnl)do { if ((__builtin_expect(!!(!(link->manager->rtnl)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->rtnl"
), "../src/network/networkd-link.c", 1366, __PRETTY_FUNCTION__
); } while (0)
;
1367
1368 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
1369 return 0;
1370
1371 if (!link->network)
1372 return 0;
1373
1374 if (link->network->arp < 0 && link->network->multicast < 0 && link->network->allmulticast < 0)
1375 return 0;
1376
1377 r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINKRTM_SETLINK, link->ifindex);
1378 if (r < 0)
1379 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1379, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not allocate RTM_SETLINK message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1379, __func__, "Could not allocate RTM_SETLINK message: %m"
); })
;
1380
1381 if (link->network->arp >= 0) {
1382 ifi_change |= IFF_NOARPIFF_NOARP;
1383 SET_FLAG(ifi_flags, IFF_NOARP, link->network->arp == 0)(ifi_flags) = (link->network->arp == 0) ? ((ifi_flags) |
(IFF_NOARP)) : ((ifi_flags) & ~(IFF_NOARP))
;
1384 }
1385
1386 if (link->network->multicast >= 0) {
1387 ifi_change |= IFF_MULTICASTIFF_MULTICAST;
1388 SET_FLAG(ifi_flags, IFF_MULTICAST, link->network->multicast)(ifi_flags) = (link->network->multicast) ? ((ifi_flags)
| (IFF_MULTICAST)) : ((ifi_flags) & ~(IFF_MULTICAST))
;
1389 }
1390
1391 if (link->network->allmulticast >= 0) {
1392 ifi_change |= IFF_ALLMULTIIFF_ALLMULTI;
1393 SET_FLAG(ifi_flags, IFF_ALLMULTI, link->network->allmulticast)(ifi_flags) = (link->network->allmulticast) ? ((ifi_flags
) | (IFF_ALLMULTI)) : ((ifi_flags) & ~(IFF_ALLMULTI))
;
1394 }
1395
1396 r = sd_rtnl_message_link_set_flags(req, ifi_flags, ifi_change);
1397 if (r < 0)
1398 return log_link_error_errno(link, r, "Could not set link flags: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1398, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set link flags: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1398, __func__, "Could not set link flags: %m"); })
;
1399
1400 r = sd_netlink_call_async(link->manager->rtnl, req, set_flags_handler, link, 0, NULL((void*)0));
1401 if (r < 0)
1402 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1402, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1402, __func__, "Could not send rtnetlink message: %m"); })
;
1403
1404 link_ref(link);
1405
1406 return 0;
1407}
1408
1409static int link_set_bridge(Link *link) {
1410 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
1411 int r;
1412
1413 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1413, __PRETTY_FUNCTION__); } while (0)
;
1414 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 1414, __PRETTY_FUNCTION__); } while (0)
;
1415
1416 r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINKRTM_SETLINK, link->ifindex);
1417 if (r < 0)
1418 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1418, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not allocate RTM_SETLINK message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1418, __func__, "Could not allocate RTM_SETLINK message: %m"
); })
;
1419
1420 r = sd_rtnl_message_link_set_family(req, PF_BRIDGE7);
1421 if (r < 0)
1422 return log_link_error_errno(link, r, "Could not set message family: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1422, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set message family: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1422, __func__, "Could not set message family: %m"); })
;
1423
1424 r = sd_netlink_message_open_container(req, IFLA_PROTINFOIFLA_PROTINFO);
1425 if (r < 0)
1426 return log_link_error_errno(link, r, "Could not append IFLA_PROTINFO attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1426, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_PROTINFO attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1426, __func__, "Could not append IFLA_PROTINFO attribute: %m"
); })
;
1427
1428 if (link->network->use_bpdu >= 0) {
1429 r = sd_netlink_message_append_u8(req, IFLA_BRPORT_GUARD, link->network->use_bpdu);
1430 if (r < 0)
1431 return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_GUARD attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1431, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BRPORT_GUARD attribute: %m")
: log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3)
)), r, "../src/network/networkd-link.c", 1431, __func__, "Could not append IFLA_BRPORT_GUARD attribute: %m"
); })
;
1432 }
1433
1434 if (link->network->hairpin >= 0) {
1435 r = sd_netlink_message_append_u8(req, IFLA_BRPORT_MODE, link->network->hairpin);
1436 if (r < 0)
1437 return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_MODE attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1437, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BRPORT_MODE attribute: %m") :
log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3)))
, r, "../src/network/networkd-link.c", 1437, __func__, "Could not append IFLA_BRPORT_MODE attribute: %m"
); })
;
1438 }
1439
1440 if (link->network->fast_leave >= 0) {
1441 r = sd_netlink_message_append_u8(req, IFLA_BRPORT_FAST_LEAVE, link->network->fast_leave);
1442 if (r < 0)
1443 return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_FAST_LEAVE attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1443, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BRPORT_FAST_LEAVE attribute: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1443, __func__, "Could not append IFLA_BRPORT_FAST_LEAVE attribute: %m"
); })
;
1444 }
1445
1446 if (link->network->allow_port_to_be_root >= 0) {
1447 r = sd_netlink_message_append_u8(req, IFLA_BRPORT_PROTECT, link->network->allow_port_to_be_root);
1448 if (r < 0)
1449 return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_PROTECT attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1449, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BRPORT_PROTECT attribute: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1449, __func__, "Could not append IFLA_BRPORT_PROTECT attribute: %m"
); })
;
1450
1451 }
1452
1453 if (link->network->unicast_flood >= 0) {
1454 r = sd_netlink_message_append_u8(req, IFLA_BRPORT_UNICAST_FLOOD, link->network->unicast_flood);
1455 if (r < 0)
1456 return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1456, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1456, __func__, "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m"
); })
;
1457
1458 }
1459
1460 if (link->network->cost != 0) {
1461 r = sd_netlink_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost);
1462 if (r < 0)
1463 return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_COST attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1463, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BRPORT_COST attribute: %m") :
log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3)))
, r, "../src/network/networkd-link.c", 1463, __func__, "Could not append IFLA_BRPORT_COST attribute: %m"
); })
;
1464 }
1465 if (link->network->priority != LINK_BRIDGE_PORT_PRIORITY_INVALID128) {
1466 r = sd_netlink_message_append_u16(req, IFLA_BRPORT_PRIORITY, link->network->priority);
1467 if (r < 0)
1468 return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_PRIORITY attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1468, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BRPORT_PRIORITY attribute: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1468, __func__, "Could not append IFLA_BRPORT_PRIORITY attribute: %m"
); })
;
1469 }
1470
1471 r = sd_netlink_message_close_container(req);
1472 if (r < 0)
1473 return log_link_error_errno(link, r, "Could not append IFLA_LINKINFO attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1473, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_LINKINFO attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1473, __func__, "Could not append IFLA_LINKINFO attribute: %m"
); })
;
1474
1475 r = sd_netlink_call_async(link->manager->rtnl, req, link_set_handler, link, 0, NULL((void*)0));
1476 if (r < 0)
1477 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1477, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1477, __func__, "Could not send rtnetlink message: %m"); })
;
1478
1479 link_ref(link);
1480
1481 return r;
1482}
1483
1484static int link_bond_set(Link *link) {
1485 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
1486 int r;
1487
1488 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1488, __PRETTY_FUNCTION__); } while (0)
;
1489 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 1489, __PRETTY_FUNCTION__); } while (0)
;
1490
1491 r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_NEWLINKRTM_NEWLINK, link->network->bond->ifindex);
1492 if (r < 0)
1493 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1493, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not allocate RTM_SETLINK message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1493, __func__, "Could not allocate RTM_SETLINK message: %m"
); })
;
1494
1495 r = sd_netlink_message_set_flags(req, NLM_F_REQUEST0x01 | NLM_F_ACK0x04);
1496 if (r < 0)
1497 return log_link_error_errno(link, r, "Could not set netlink flags: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1497, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set netlink flags: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1497, __func__, "Could not set netlink flags: %m"); })
;
1498
1499 r = sd_netlink_message_open_container(req, IFLA_LINKINFOIFLA_LINKINFO);
1500 if (r < 0)
1501 return log_link_error_errno(link, r, "Could not append IFLA_PROTINFO attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1501, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_PROTINFO attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1501, __func__, "Could not append IFLA_PROTINFO attribute: %m"
); })
;
1502
1503 r = sd_netlink_message_open_container_union(req, IFLA_INFO_DATA, "bond");
1504 if (r < 0)
1505 return log_link_error_errno(link, r, "Could not append IFLA_INFO_DATA attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1505, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_INFO_DATA attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1505, __func__, "Could not append IFLA_INFO_DATA attribute: %m"
); })
;
1506
1507 if (link->network->active_slave) {
1508 r = sd_netlink_message_append_u32(req, IFLA_BOND_ACTIVE_SLAVE, link->ifindex);
1509 if (r < 0)
1510 return log_link_error_errno(link, r, "Could not append IFLA_BOND_ACTIVE_SLAVE attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1510, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BOND_ACTIVE_SLAVE attribute: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1510, __func__, "Could not append IFLA_BOND_ACTIVE_SLAVE attribute: %m"
); })
;
1511 }
1512
1513 if (link->network->primary_slave) {
1514 r = sd_netlink_message_append_u32(req, IFLA_BOND_PRIMARY, link->ifindex);
1515 if (r < 0)
1516 return log_link_error_errno(link, r, "Could not append IFLA_BOND_PRIMARY attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1516, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_BOND_PRIMARY attribute: %m")
: log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3)
)), r, "../src/network/networkd-link.c", 1516, __func__, "Could not append IFLA_BOND_PRIMARY attribute: %m"
); })
;
1517 }
1518
1519 r = sd_netlink_message_close_container(req);
1520 if (r < 0)
1521 return log_link_error_errno(link, r, "Could not append IFLA_LINKINFO attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1521, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_LINKINFO attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1521, __func__, "Could not append IFLA_LINKINFO attribute: %m"
); })
;
1522
1523 r = sd_netlink_message_close_container(req);
1524 if (r < 0)
1525 return log_link_error_errno(link, r, "Could not append IFLA_INFO_DATA attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1525, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_INFO_DATA attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1525, __func__, "Could not append IFLA_INFO_DATA attribute: %m"
); })
;
1526
1527 r = sd_netlink_call_async(link->manager->rtnl, req, set_flags_handler, link, 0, NULL((void*)0));
1528 if (r < 0)
1529 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1529, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1529, __func__, "Could not send rtnetlink message: %m"); })
;
1530
1531 link_ref(link);
1532
1533 return r;
1534}
1535
1536static int link_lldp_save(Link *link) {
1537 _cleanup_free___attribute__((cleanup(freep))) char *temp_path = NULL((void*)0);
1538 _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0);
1539 sd_lldp_neighbor **l = NULL((void*)0);
1540 int n = 0, r, i;
1541
1542 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1542, __PRETTY_FUNCTION__); } while (0)
;
1543 assert(link->lldp_file)do { if ((__builtin_expect(!!(!(link->lldp_file)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->lldp_file"), "../src/network/networkd-link.c"
, 1543, __PRETTY_FUNCTION__); } while (0)
;
1544
1545 if (!link->lldp) {
1546 (void) unlink(link->lldp_file);
1547 return 0;
1548 }
1549
1550 r = sd_lldp_get_neighbors(link->lldp, &l);
1551 if (r < 0)
1552 goto finish;
1553 if (r == 0) {
1554 (void) unlink(link->lldp_file);
1555 goto finish;
1556 }
1557
1558 n = r;
1559
1560 r = fopen_temporary(link->lldp_file, &f, &temp_path);
1561 if (r < 0)
1562 goto finish;
1563
1564 fchmod(fileno(f), 0644);
1565
1566 for (i = 0; i < n; i++) {
1567 const void *p;
1568 le64_t u;
1569 size_t sz;
1570
1571 r = sd_lldp_neighbor_get_raw(l[i], &p, &sz);
1572 if (r < 0)
1573 goto finish;
1574
1575 u = htole64(sz);
1576 (void) fwrite(&u, 1, sizeof(u), f);
1577 (void) fwrite(p, 1, sz, f);
1578 }
1579
1580 r = fflush_and_check(f);
1581 if (r < 0)
1582 goto finish;
1583
1584 if (rename(temp_path, link->lldp_file) < 0) {
1585 r = -errno(*__errno_location ());
1586 goto finish;
1587 }
1588
1589finish:
1590 if (r < 0) {
1591 (void) unlink(link->lldp_file);
1592 if (temp_path)
1593 (void) unlink(temp_path);
1594
1595 log_link_error_errno(link, r, "Failed to save LLDP data to %s: %m", link->lldp_file)({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1595, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to save LLDP data to %s: %m", link->lldp_file
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1595, __func__, "Failed to save LLDP data to %s: %m"
, link->lldp_file); })
;
1596 }
1597
1598 if (l) {
1599 for (i = 0; i < n; i++)
1600 sd_lldp_neighbor_unref(l[i]);
1601 free(l);
1602 }
1603
1604 return r;
1605}
1606
1607static void lldp_handler(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata) {
1608 Link *link = userdata;
1609 int r;
1610
1611 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1611, __PRETTY_FUNCTION__); } while (0)
;
1612
1613 (void) link_lldp_save(link);
1614
1615 if (link_lldp_emit_enabled(link) && event == SD_LLDP_EVENT_ADDED) {
1616 /* If we received information about a new neighbor, restart the LLDP "fast" logic */
1617
1618 log_link_debug(link, "Received LLDP datagram from previously unknown neighbor, restarting 'fast' LLDP transmission.")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1618, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Received LLDP datagram from previously unknown neighbor, restarting 'fast' LLDP transmission."
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 1618, __func__, "Received LLDP datagram from previously unknown neighbor, restarting 'fast' LLDP transmission."
); })
;
1619
1620 r = link_lldp_emit_start(link);
1621 if (r < 0)
1622 log_link_warning_errno(link, r, "Failed to restart LLDP transmission: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1622, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to restart LLDP transmission: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1622, __func__, "Failed to restart LLDP transmission: %m");
})
;
1623 }
1624}
1625
1626static int link_acquire_ipv6_conf(Link *link) {
1627 int r;
1628
1629 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1629, __PRETTY_FUNCTION__); } while (0)
;
1630
1631 if (link_dhcp6_enabled(link)) {
1632 assert(link->dhcp6_client)do { if ((__builtin_expect(!!(!(link->dhcp6_client)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->dhcp6_client"), "../src/network/networkd-link.c"
, 1632, __PRETTY_FUNCTION__); } while (0)
;
1633 assert(in_addr_is_link_local(AF_INET6, (const union in_addr_union*)&link->ipv6ll_address) > 0)do { if ((__builtin_expect(!!(!(in_addr_is_link_local(10, (const
union in_addr_union*)&link->ipv6ll_address) > 0)),
0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("in_addr_is_link_local(AF_INET6, (const union in_addr_union*)&link->ipv6ll_address) > 0"
), "../src/network/networkd-link.c", 1633, __PRETTY_FUNCTION__
); } while (0)
;
1634
1635 /* start DHCPv6 client in stateless mode */
1636 r = dhcp6_request_address(link, true1);
1637 if (r < 0 && r != -EBUSY16)
1638 return log_link_warning_errno(link, r, "Could not acquire DHCPv6 lease: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1638, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not acquire DHCPv6 lease: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1638, __func__, "Could not acquire DHCPv6 lease: %m"); })
;
1639 else
1640 log_link_debug(link, "Acquiring DHCPv6 lease")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1640, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Acquiring DHCPv6 lease") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1640
, __func__, "Acquiring DHCPv6 lease"); })
;
1641 }
1642
1643 if (link_ipv6_accept_ra_enabled(link)) {
1644 assert(link->ndisc)do { if ((__builtin_expect(!!(!(link->ndisc)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ndisc"), "../src/network/networkd-link.c"
, 1644, __PRETTY_FUNCTION__); } while (0)
;
1645
1646 log_link_debug(link, "Discovering IPv6 routers")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1646, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Discovering IPv6 routers") : log_internal_realm(((
LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 1646, __func__, "Discovering IPv6 routers"); })
;
1647
1648 r = sd_ndisc_start(link->ndisc);
1649 if (r < 0 && r != -EBUSY16)
1650 return log_link_warning_errno(link, r, "Could not start IPv6 Router Discovery: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1650, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not start IPv6 Router Discovery: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1650, __func__, "Could not start IPv6 Router Discovery: %m"
); })
;
1651 }
1652
1653 if (link_radv_enabled(link)) {
1654 assert(link->radv)do { if ((__builtin_expect(!!(!(link->radv)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->radv"), "../src/network/networkd-link.c"
, 1654, __PRETTY_FUNCTION__); } while (0)
;
1655 assert(in_addr_is_link_local(AF_INET6, (const union in_addr_union*)&link->ipv6ll_address) > 0)do { if ((__builtin_expect(!!(!(in_addr_is_link_local(10, (const
union in_addr_union*)&link->ipv6ll_address) > 0)),
0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("in_addr_is_link_local(AF_INET6, (const union in_addr_union*)&link->ipv6ll_address) > 0"
), "../src/network/networkd-link.c", 1655, __PRETTY_FUNCTION__
); } while (0)
;
1656
1657 log_link_debug(link, "Starting IPv6 Router Advertisements")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1657, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Starting IPv6 Router Advertisements") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 1657, __func__, "Starting IPv6 Router Advertisements"); })
;
1658
1659 r = sd_radv_start(link->radv);
1660 if (r < 0 && r != -EBUSY16)
1661 return log_link_warning_errno(link, r, "Could not start IPv6 Router Advertisement: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1661, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not start IPv6 Router Advertisement: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1661, __func__, "Could not start IPv6 Router Advertisement: %m"
); })
;
1662 }
1663
1664 return 0;
1665}
1666
1667static int link_acquire_ipv4_conf(Link *link) {
1668 int r;
1669
1670 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1670, __PRETTY_FUNCTION__); } while (0)
;
1671 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 1671, __PRETTY_FUNCTION__); } while (0)
;
1672 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 1672, __PRETTY_FUNCTION__); } while (0)
;
1673 assert(link->manager->event)do { if ((__builtin_expect(!!(!(link->manager->event)),
0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->event"
), "../src/network/networkd-link.c", 1673, __PRETTY_FUNCTION__
); } while (0)
;
1674
1675 if (link_ipv4ll_enabled(link)) {
1676 assert(link->ipv4ll)do { if ((__builtin_expect(!!(!(link->ipv4ll)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ipv4ll"), "../src/network/networkd-link.c"
, 1676, __PRETTY_FUNCTION__); } while (0)
;
1677
1678 log_link_debug(link, "Acquiring IPv4 link-local address")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1678, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Acquiring IPv4 link-local address") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 1678, __func__, "Acquiring IPv4 link-local address"); })
;
1679
1680 r = sd_ipv4ll_start(link->ipv4ll);
1681 if (r < 0)
1682 return log_link_warning_errno(link, r, "Could not acquire IPv4 link-local address: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1682, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not acquire IPv4 link-local address: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1682, __func__, "Could not acquire IPv4 link-local address: %m"
); })
;
1683 }
1684
1685 if (link_dhcp4_enabled(link)) {
1686 assert(link->dhcp_client)do { if ((__builtin_expect(!!(!(link->dhcp_client)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->dhcp_client"), "../src/network/networkd-link.c"
, 1686, __PRETTY_FUNCTION__); } while (0)
;
1687
1688 log_link_debug(link, "Acquiring DHCPv4 lease")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1688, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Acquiring DHCPv4 lease") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1688
, __func__, "Acquiring DHCPv4 lease"); })
;
1689
1690 r = sd_dhcp_client_start(link->dhcp_client);
1691 if (r < 0)
1692 return log_link_warning_errno(link, r, "Could not acquire DHCPv4 lease: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1692, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not acquire DHCPv4 lease: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1692, __func__, "Could not acquire DHCPv4 lease: %m"); })
;
1693 }
1694
1695 return 0;
1696}
1697
1698static int link_acquire_conf(Link *link) {
1699 int r;
1700
1701 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1701, __PRETTY_FUNCTION__); } while (0)
;
1702
1703 if (link->setting_mtu) {
1704 link->setting_mtu = false0;
1705 return 0;
1706 }
1707
1708 r = link_acquire_ipv4_conf(link);
1709 if (r < 0)
1710 return r;
1711
1712 if (in_addr_is_null(AF_INET610, (const union in_addr_union*) &link->ipv6ll_address) == 0) {
1713 r = link_acquire_ipv6_conf(link);
1714 if (r < 0)
1715 return r;
1716 }
1717
1718 if (link_lldp_emit_enabled(link)) {
1719 r = link_lldp_emit_start(link);
1720 if (r < 0)
1721 return log_link_warning_errno(link, r, "Failed to start LLDP transmission: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1721, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to start LLDP transmission: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1721, __func__, "Failed to start LLDP transmission: %m"); }
)
;
1722 }
1723
1724 return 0;
1725}
1726
1727bool_Bool link_has_carrier(Link *link) {
1728 /* see Documentation/networking/operstates.txt in the kernel sources */
1729
1730 if (link->kernel_operstate == IF_OPER_UP6)
1731 return true1;
1732
1733 if (link->kernel_operstate == IF_OPER_UNKNOWN0)
1734 /* operstate may not be implemented, so fall back to flags */
1735 if ((link->flags & IFF_LOWER_UPIFF_LOWER_UP) && !(link->flags & IFF_DORMANTIFF_DORMANT))
1736 return true1;
1737
1738 return false0;
1739}
1740
1741static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
1742 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
1743 int r;
1744
1745 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1745, __PRETTY_FUNCTION__); } while (0)
;
1746
1747 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
1748 return 1;
1749
1750 r = sd_netlink_message_get_errno(m);
1751 if (r < 0)
1752 /* we warn but don't fail the link, as it may be
1753 brought up later */
1754 log_link_warning_errno(link, r, "Could not bring up interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1754, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not bring up interface: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1754, __func__, "Could not bring up interface: %m"); })
;
1755
1756 return 1;
1757}
1758
1759int link_up(Link *link) {
1760 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
1761 uint8_t ipv6ll_mode;
1762 int r;
1763
1764 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1764, __PRETTY_FUNCTION__); } while (0)
;
1765 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 1765, __PRETTY_FUNCTION__); } while (0)
;
1766 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 1766, __PRETTY_FUNCTION__); } while (0)
;
1767 assert(link->manager->rtnl)do { if ((__builtin_expect(!!(!(link->manager->rtnl)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->rtnl"
), "../src/network/networkd-link.c", 1767, __PRETTY_FUNCTION__
); } while (0)
;
1768
1769 log_link_debug(link, "Bringing link up")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1769, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Bringing link up") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1769
, __func__, "Bringing link up"); })
;
1770
1771 r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINKRTM_SETLINK, link->ifindex);
1772 if (r < 0)
1773 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1773, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not allocate RTM_SETLINK message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1773, __func__, "Could not allocate RTM_SETLINK message: %m"
); })
;
1774
1775 /* set it free if not enslaved with networkd */
1776 if (!link->network->bridge && !link->network->bond && !link->network->vrf) {
1777 r = sd_netlink_message_append_u32(req, IFLA_MASTERIFLA_MASTER, 0);
1778 if (r < 0)
1779 return log_link_error_errno(link, r, "Could not append IFLA_MASTER attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1779, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_MASTER attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1779, __func__, "Could not append IFLA_MASTER attribute: %m"
); })
;
1780 }
1781
1782 r = sd_rtnl_message_link_set_flags(req, IFF_UPIFF_UP, IFF_UPIFF_UP);
1783 if (r < 0)
1784 return log_link_error_errno(link, r, "Could not set link flags: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1784, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set link flags: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1784, __func__, "Could not set link flags: %m"); })
;
1785
1786 if (link->network->mac) {
1787 r = sd_netlink_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
1788 if (r < 0)
1789 return log_link_error_errno(link, r, "Could not set MAC address: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1789, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set MAC address: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1789, __func__, "Could not set MAC address: %m"); })
;
1790 }
1791
1792 r = sd_netlink_message_open_container(req, IFLA_AF_SPEC);
1793 if (r < 0)
1794 return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1794, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not open IFLA_AF_SPEC container: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1794, __func__, "Could not open IFLA_AF_SPEC container: %m"
); })
;
1795
1796 if (link_ipv6_enabled(link)) {
1797 /* if the kernel lacks ipv6 support setting IFF_UP fails if any ipv6 options are passed */
1798 r = sd_netlink_message_open_container(req, AF_INET610);
1799 if (r < 0)
1800 return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1800, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not open AF_INET6 container: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1800, __func__, "Could not open AF_INET6 container: %m"); }
)
;
1801
1802 if (!link_ipv6ll_enabled(link))
1803 ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE;
1804 else {
1805 const char *p = NULL((void*)0);
1806 _cleanup_free___attribute__((cleanup(freep))) char *stable_secret = NULL((void*)0);
1807
1808 p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/stable_secret")({ const char *_appendees_[] = { "/proc/sys/net/ipv6/conf/", link
->ifname, "/stable_secret" }; char *_d_, *_p_; size_t _len_
= 0; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
1809 r = read_one_line_file(p, &stable_secret);
1810
1811 if (r < 0)
1812 ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64;
1813 else
1814 ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
1815 }
1816 r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
1817 if (r < 0)
1818 return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1818, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_INET6_ADDR_GEN_MODE: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1818, __func__, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m"
); })
;
1819
1820 if (!in_addr_is_null(AF_INET610, &link->network->ipv6_token)) {
1821 r = sd_netlink_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
1822 if (r < 0)
1823 return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1823, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_INET6_TOKEN: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1823, __func__, "Could not append IFLA_INET6_TOKEN: %m"); }
)
;
1824 }
1825
1826 r = sd_netlink_message_close_container(req);
1827 if (r < 0)
1828 return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1828, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not close AF_INET6 container: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1828, __func__, "Could not close AF_INET6 container: %m"); }
)
;
1829 }
1830
1831 r = sd_netlink_message_close_container(req);
1832 if (r < 0)
1833 return log_link_error_errno(link, r, "Could not close IFLA_AF_SPEC container: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1833, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not close IFLA_AF_SPEC container: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1833, __func__, "Could not close IFLA_AF_SPEC container: %m"
); })
;
1834
1835 r = sd_netlink_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL((void*)0));
1836 if (r < 0)
1837 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1837, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1837, __func__, "Could not send rtnetlink message: %m"); })
;
1838
1839 link_ref(link);
1840
1841 return 0;
1842}
1843
1844static int link_up_can(Link *link) {
1845 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
1846 int r;
1847
1848 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1848, __PRETTY_FUNCTION__); } while (0)
;
1849
1850 log_link_debug(link, "Bringing CAN link up")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1850, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Bringing CAN link up") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1850
, __func__, "Bringing CAN link up"); })
;
1851
1852 r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_SETLINKRTM_SETLINK, link->ifindex);
1853 if (r < 0)
1854 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1854, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not allocate RTM_SETLINK message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1854, __func__, "Could not allocate RTM_SETLINK message: %m"
); })
;
1855
1856 r = sd_rtnl_message_link_set_flags(req, IFF_UPIFF_UP, IFF_UPIFF_UP);
1857 if (r < 0)
1858 return log_link_error_errno(link, r, "Could not set link flags: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1858, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set link flags: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1858, __func__, "Could not set link flags: %m"); })
;
1859
1860 r = sd_netlink_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL((void*)0));
1861 if (r < 0)
1862 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1862, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1862, __func__, "Could not send rtnetlink message: %m"); })
;
1863
1864 link_ref(link);
1865
1866 return 0;
1867}
1868
1869static int link_set_can(Link *link) {
1870 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *m = NULL((void*)0);
1871 int r;
1872
1873 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1873, __PRETTY_FUNCTION__); } while (0)
;
1874 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 1874, __PRETTY_FUNCTION__); } while (0)
;
1875 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 1875, __PRETTY_FUNCTION__); } while (0)
;
1876 assert(link->manager->rtnl)do { if ((__builtin_expect(!!(!(link->manager->rtnl)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->rtnl"
), "../src/network/networkd-link.c", 1876, __PRETTY_FUNCTION__
); } while (0)
;
1877
1878 log_link_debug(link, "link_set_can")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1878, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "link_set_can") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1878
, __func__, "link_set_can"); })
;
1879
1880 r = sd_rtnl_message_new_link(link->manager->rtnl, &m, RTM_NEWLINKRTM_NEWLINK, link->ifindex);
1881 if (r < 0)
1882 return log_link_error_errno(link, r, "Failed to allocate netlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1882, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to allocate netlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1882, __func__, "Failed to allocate netlink message: %m"); }
)
;
1883
1884 r = sd_netlink_message_set_flags(m, NLM_F_REQUEST0x01 | NLM_F_ACK0x04);
1885 if (r < 0)
1886 return log_link_error_errno(link, r, "Could not set netlink flags: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1886, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set netlink flags: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1886, __func__, "Could not set netlink flags: %m"); })
;
1887
1888 r = sd_netlink_message_open_container(m, IFLA_LINKINFOIFLA_LINKINFO);
1889 if (r < 0)
1890 return log_link_error_errno(link, r, "Failed to open netlink container: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1890, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to open netlink container: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1890, __func__, "Failed to open netlink container: %m"); })
;
1891
1892 r = sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, link->kind);
1893 if (r < 0)
1894 return log_link_error_errno(link, r, "Could not append IFLA_INFO_DATA attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1894, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_INFO_DATA attribute: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1894, __func__, "Could not append IFLA_INFO_DATA attribute: %m"
); })
;
1895
1896 if (link->network->can_bitrate > 0 || link->network->can_sample_point > 0) {
1897 struct can_bittiming bt = {
1898 .bitrate = link->network->can_bitrate,
1899 .sample_point = link->network->can_sample_point,
1900 };
1901
1902 if (link->network->can_bitrate > UINT32_MAX(4294967295U)) {
1903 log_link_error(link, "bitrate (%zu) too big.", link->network->can_bitrate)({ const Link *_l = (link); _l ? log_object_internal(3, 0, "../src/network/networkd-link.c"
, 1903, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "bitrate (%zu) too big.", link->network->can_bitrate
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), 0, "../src/network/networkd-link.c", 1903, __func__, "bitrate (%zu) too big."
, link->network->can_bitrate); })
;
1904 return -ERANGE34;
1905 }
1906
1907 log_link_debug(link, "Setting bitrate = %d bit/s", bt.bitrate)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1907, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Setting bitrate = %d bit/s", bt.bitrate) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 1907, __func__, "Setting bitrate = %d bit/s", bt.bitrate); }
)
;
1908 if (link->network->can_sample_point > 0)
1909 log_link_debug(link, "Setting sample point = %d.%d%%", bt.sample_point / 10, bt.sample_point % 10)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1909, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Setting sample point = %d.%d%%", bt.sample_point /
10, bt.sample_point % 10) : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1909
, __func__, "Setting sample point = %d.%d%%", bt.sample_point
/ 10, bt.sample_point % 10); })
;
1910 else
1911 log_link_debug(link, "Using default sample point")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1911, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Using default sample point") : log_internal_realm(
((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 1911, __func__, "Using default sample point"); })
;
1912
1913 r = sd_netlink_message_append_data(m, IFLA_CAN_BITTIMING, &bt, sizeof(bt));
1914 if (r < 0)
1915 return log_link_error_errno(link, r, "Could not append IFLA_CAN_BITTIMING attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1915, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_CAN_BITTIMING attribute: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1915, __func__, "Could not append IFLA_CAN_BITTIMING attribute: %m"
); })
;
1916 }
1917
1918 if (link->network->can_restart_us > 0) {
1919 char time_string[FORMAT_TIMESPAN_MAX64];
1920 uint64_t restart_ms;
1921
1922 if (link->network->can_restart_us == USEC_INFINITY((usec_t) -1))
1923 restart_ms = 0;
1924 else
1925 restart_ms = DIV_ROUND_UP(link->network->can_restart_us, USEC_PER_MSEC)({ const typeof((link->network->can_restart_us)) __unique_prefix_X24
= ((link->network->can_restart_us)); const typeof((((usec_t
) 1000ULL))) __unique_prefix_Y25 = ((((usec_t) 1000ULL))); (__unique_prefix_X24
/ __unique_prefix_Y25 + !!(__unique_prefix_X24 % __unique_prefix_Y25
)); })
;
1926
1927 format_timespan(time_string, FORMAT_TIMESPAN_MAX64, restart_ms * 1000, MSEC_PER_SEC1000ULL);
1928
1929 if (restart_ms > UINT32_MAX(4294967295U)) {
1930 log_link_error(link, "restart timeout (%s) too big.", time_string)({ const Link *_l = (link); _l ? log_object_internal(3, 0, "../src/network/networkd-link.c"
, 1930, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "restart timeout (%s) too big.", time_string) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), 0, "../src/network/networkd-link.c"
, 1930, __func__, "restart timeout (%s) too big.", time_string
); })
;
1931 return -ERANGE34;
1932 }
1933
1934 log_link_debug(link, "Setting restart = %s", time_string)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1934, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Setting restart = %s", time_string) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 1934, __func__, "Setting restart = %s", time_string); })
;
1935
1936 r = sd_netlink_message_append_u32(m, IFLA_CAN_RESTART_MS, restart_ms);
1937 if (r < 0)
1938 return log_link_error_errno(link, r, "Could not append IFLA_CAN_RESTART_MS attribute: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1938, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not append IFLA_CAN_RESTART_MS attribute: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 1938, __func__, "Could not append IFLA_CAN_RESTART_MS attribute: %m"
); })
;
1939 }
1940
1941 r = sd_netlink_message_close_container(m);
1942 if (r < 0)
1943 return log_link_error_errno(link, r, "Failed to close netlink container: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1943, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to close netlink container: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1943, __func__, "Failed to close netlink container: %m"); }
)
;
1944
1945 r = sd_netlink_message_close_container(m);
1946 if (r < 0)
1947 return log_link_error_errno(link, r, "Failed to close netlink container: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1947, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to close netlink container: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1947, __func__, "Failed to close netlink container: %m"); }
)
;
1948
1949 r = sd_netlink_call_async(link->manager->rtnl, m, link_set_handler, link, 0, NULL((void*)0));
1950 if (r < 0)
1951 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 1951, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 1951, __func__, "Could not send rtnetlink message: %m"); })
;
1952
1953 link_ref(link);
1954
1955 if (!(link->flags & IFF_UPIFF_UP)) {
1956 r = link_up_can(link);
1957 if (r < 0) {
1958 link_enter_failed(link);
1959 return r;
1960 }
1961 }
1962
1963 log_link_debug(link, "link_set_can done")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1963, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "link_set_can done") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1963
, __func__, "link_set_can done"); })
;
1964
1965 return r;
1966}
1967
1968static int link_down_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
1969 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
1970 int r;
1971
1972 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1972, __PRETTY_FUNCTION__); } while (0)
;
1973
1974 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
1975 return 1;
1976
1977 r = sd_netlink_message_get_errno(m);
1978 if (r < 0)
1979 log_link_warning_errno(link, r, "Could not bring down interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 1979, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not bring down interface: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 1979, __func__, "Could not bring down interface: %m"); })
;
1980
1981 if (streq_ptr(link->kind, "can")) {
1982 link_ref(link);
1983 link_set_can(link);
1984 }
1985
1986 return 1;
1987}
1988
1989int link_down(Link *link) {
1990 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
1991 int r;
1992
1993 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 1993, __PRETTY_FUNCTION__); } while (0)
;
1994 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 1994, __PRETTY_FUNCTION__); } while (0)
;
1995 assert(link->manager->rtnl)do { if ((__builtin_expect(!!(!(link->manager->rtnl)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->rtnl"
), "../src/network/networkd-link.c", 1995, __PRETTY_FUNCTION__
); } while (0)
;
1996
1997 log_link_debug(link, "Bringing link down")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 1997, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Bringing link down") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 1997
, __func__, "Bringing link down"); })
;
1998
1999 r = sd_rtnl_message_new_link(link->manager->rtnl, &req,
2000 RTM_SETLINKRTM_SETLINK, link->ifindex);
2001 if (r < 0)
2002 return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 2002, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not allocate RTM_SETLINK message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 2002, __func__, "Could not allocate RTM_SETLINK message: %m"
); })
;
2003
2004 r = sd_rtnl_message_link_set_flags(req, 0, IFF_UPIFF_UP);
2005 if (r < 0)
2006 return log_link_error_errno(link, r, "Could not set link flags: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 2006, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set link flags: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 2006, __func__, "Could not set link flags: %m"); })
;
2007
2008 r = sd_netlink_call_async(link->manager->rtnl, req, link_down_handler, link, 0, NULL((void*)0));
2009 if (r < 0)
2010 return log_link_error_errno(link, r, "Could not send rtnetlink message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 2010, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not send rtnetlink message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 2010, __func__, "Could not send rtnetlink message: %m"); })
;
2011
2012 link_ref(link);
2013
2014 return 0;
2015}
2016
2017static int link_handle_bound_to_list(Link *link) {
2018 Link *l;
2019 Iterator i;
2020 int r;
2021 bool_Bool required_up = false0;
2022 bool_Bool link_is_up = false0;
2023
2024 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2024, __PRETTY_FUNCTION__); } while (0)
;
2025
2026 if (hashmap_isempty(link->bound_to_links))
2027 return 0;
2028
2029 if (link->flags & IFF_UPIFF_UP)
2030 link_is_up = true1;
2031
2032 HASHMAP_FOREACH (l, link->bound_to_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_to_links
), &(i), (void**)&(l), ((void*)0)); )
2033 if (link_has_carrier(l)) {
2034 required_up = true1;
2035 break;
2036 }
2037
2038 if (!required_up && link_is_up) {
2039 r = link_down(link);
2040 if (r < 0)
2041 return r;
2042 } else if (required_up && !link_is_up) {
2043 r = link_up(link);
2044 if (r < 0)
2045 return r;
2046 }
2047
2048 return 0;
2049}
2050
2051static int link_handle_bound_by_list(Link *link) {
2052 Iterator i;
2053 Link *l;
2054 int r;
2055
2056 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2056, __PRETTY_FUNCTION__); } while (0)
;
2057
2058 if (hashmap_isempty(link->bound_by_links))
2059 return 0;
2060
2061 HASHMAP_FOREACH (l, link->bound_by_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_by_links
), &(i), (void**)&(l), ((void*)0)); )
{
2062 r = link_handle_bound_to_list(l);
2063 if (r < 0)
2064 return r;
2065 }
2066
2067 return 0;
2068}
2069
2070static int link_put_carrier(Link *link, Link *carrier, Hashmap **h) {
2071 int r;
2072
2073 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2073, __PRETTY_FUNCTION__); } while (0)
;
2074 assert(carrier)do { if ((__builtin_expect(!!(!(carrier)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("carrier"), "../src/network/networkd-link.c"
, 2074, __PRETTY_FUNCTION__); } while (0)
;
2075
2076 if (link == carrier)
2077 return 0;
2078
2079 if (hashmap_get(*h, INT_TO_PTR(carrier->ifindex)((void *) ((intptr_t) (carrier->ifindex)))))
2080 return 0;
2081
2082 r = hashmap_ensure_allocated(h, NULL)internal_hashmap_ensure_allocated(h, ((void*)0) );
2083 if (r < 0)
2084 return r;
2085
2086 r = hashmap_put(*h, INT_TO_PTR(carrier->ifindex)((void *) ((intptr_t) (carrier->ifindex))), carrier);
2087 if (r < 0)
2088 return r;
2089
2090 return 0;
2091}
2092
2093static int link_new_bound_by_list(Link *link) {
2094 Manager *m;
2095 Link *carrier;
2096 Iterator i;
2097 int r;
2098 bool_Bool list_updated = false0;
2099
2100 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2100, __PRETTY_FUNCTION__); } while (0)
;
2101 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 2101, __PRETTY_FUNCTION__); } while (0)
;
2102
2103 m = link->manager;
2104
2105 HASHMAP_FOREACH(carrier, m->links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((m->links), &
(i), (void**)&(carrier), ((void*)0)); )
{
2106 if (!carrier->network)
2107 continue;
2108
2109 if (strv_isempty(carrier->network->bind_carrier))
2110 continue;
2111
2112 if (strv_fnmatch(carrier->network->bind_carrier, link->ifname, 0)) {
2113 r = link_put_carrier(link, carrier, &link->bound_by_links);
2114 if (r < 0)
2115 return r;
2116
2117 list_updated = true1;
2118 }
2119 }
2120
2121 if (list_updated)
2122 link_dirty(link);
2123
2124 HASHMAP_FOREACH(carrier, link->bound_by_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_by_links
), &(i), (void**)&(carrier), ((void*)0)); )
{
2125 r = link_put_carrier(carrier, link, &carrier->bound_to_links);
2126 if (r < 0)
2127 return r;
2128
2129 link_dirty(carrier);
2130 }
2131
2132 return 0;
2133}
2134
2135static int link_new_bound_to_list(Link *link) {
2136 Manager *m;
2137 Link *carrier;
2138 Iterator i;
2139 int r;
2140 bool_Bool list_updated = false0;
2141
2142 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2142, __PRETTY_FUNCTION__); } while (0)
;
2143 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 2143, __PRETTY_FUNCTION__); } while (0)
;
2144
2145 if (!link->network)
2146 return 0;
2147
2148 if (strv_isempty(link->network->bind_carrier))
2149 return 0;
2150
2151 m = link->manager;
2152
2153 HASHMAP_FOREACH (carrier, m->links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((m->links), &
(i), (void**)&(carrier), ((void*)0)); )
{
2154 if (strv_fnmatch(link->network->bind_carrier, carrier->ifname, 0)) {
2155 r = link_put_carrier(link, carrier, &link->bound_to_links);
2156 if (r < 0)
2157 return r;
2158
2159 list_updated = true1;
2160 }
2161 }
2162
2163 if (list_updated)
2164 link_dirty(link);
2165
2166 HASHMAP_FOREACH (carrier, link->bound_to_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_to_links
), &(i), (void**)&(carrier), ((void*)0)); )
{
2167 r = link_put_carrier(carrier, link, &carrier->bound_by_links);
2168 if (r < 0)
2169 return r;
2170
2171 link_dirty(carrier);
2172 }
2173
2174 return 0;
2175}
2176
2177static int link_new_carrier_maps(Link *link) {
2178 int r;
2179
2180 r = link_new_bound_by_list(link);
2181 if (r < 0)
2182 return r;
2183
2184 r = link_handle_bound_by_list(link);
2185 if (r < 0)
2186 return r;
2187
2188 r = link_new_bound_to_list(link);
2189 if (r < 0)
2190 return r;
2191
2192 r = link_handle_bound_to_list(link);
2193 if (r < 0)
2194 return r;
2195
2196 return 0;
2197}
2198
2199static void link_free_bound_to_list(Link *link) {
2200 Link *bound_to;
2201 Iterator i;
2202
2203 HASHMAP_FOREACH (bound_to, link->bound_to_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_to_links
), &(i), (void**)&(bound_to), ((void*)0)); )
{
2204 hashmap_remove(link->bound_to_links, INT_TO_PTR(bound_to->ifindex)((void *) ((intptr_t) (bound_to->ifindex))));
2205
2206 if (hashmap_remove(bound_to->bound_by_links, INT_TO_PTR(link->ifindex)((void *) ((intptr_t) (link->ifindex)))))
2207 link_dirty(bound_to);
2208 }
2209
2210 return;
2211}
2212
2213static void link_free_bound_by_list(Link *link) {
2214 Link *bound_by;
2215 Iterator i;
2216
2217 HASHMAP_FOREACH (bound_by, link->bound_by_links, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->bound_by_links
), &(i), (void**)&(bound_by), ((void*)0)); )
{
2218 hashmap_remove(link->bound_by_links, INT_TO_PTR(bound_by->ifindex)((void *) ((intptr_t) (bound_by->ifindex))));
2219
2220 if (hashmap_remove(bound_by->bound_to_links, INT_TO_PTR(link->ifindex)((void *) ((intptr_t) (link->ifindex))))) {
2221 link_dirty(bound_by);
2222 link_handle_bound_to_list(bound_by);
2223 }
2224 }
2225
2226 return;
2227}
2228
2229static void link_free_carrier_maps(Link *link) {
2230 bool_Bool list_updated = false0;
2231
2232 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2232, __PRETTY_FUNCTION__); } while (0)
;
2233
2234 if (!hashmap_isempty(link->bound_to_links)) {
2235 link_free_bound_to_list(link);
2236 list_updated = true1;
2237 }
2238
2239 if (!hashmap_isempty(link->bound_by_links)) {
2240 link_free_bound_by_list(link);
2241 list_updated = true1;
2242 }
2243
2244 if (list_updated)
2245 link_dirty(link);
2246
2247 return;
2248}
2249
2250void link_drop(Link *link) {
2251 if (!link || link->state == LINK_STATE_LINGER)
2252 return;
2253
2254 link_set_state(link, LINK_STATE_LINGER);
2255
2256 link_free_carrier_maps(link);
2257
2258 log_link_debug(link, "Link removed")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2258, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Link removed") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 2258
, __func__, "Link removed"); })
;
2259
2260 (void)unlink(link->state_file);
2261 link_unref(link);
2262
2263 return;
2264}
2265
2266static int link_joined(Link *link) {
2267 int r;
2268
2269 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2269, __PRETTY_FUNCTION__); } while (0)
;
2270 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 2270, __PRETTY_FUNCTION__); } while (0)
;
2271
2272 if (!hashmap_isempty(link->bound_to_links)) {
2273 r = link_handle_bound_to_list(link);
2274 if (r < 0)
2275 return r;
2276 } else if (!(link->flags & IFF_UPIFF_UP)) {
2277 r = link_up(link);
2278 if (r < 0) {
2279 link_enter_failed(link);
2280 return r;
2281 }
2282 }
2283
2284 if (link->network->bridge) {
2285 r = link_set_bridge(link);
2286 if (r < 0)
2287 log_link_error_errno(link, r, "Could not set bridge message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 2287, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set bridge message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 2287, __func__, "Could not set bridge message: %m"); })
;
2288 }
2289
2290 if (link->network->bond) {
2291 r = link_bond_set(link);
2292 if (r < 0)
2293 log_link_error_errno(link, r, "Could not set bond message: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 2293, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set bond message: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 2293, __func__, "Could not set bond message: %m"); })
;
2294 }
2295
2296 if (link->network->use_br_vlan &&
2297 (link->network->bridge || streq_ptr("bridge", link->kind))) {
2298 r = link_set_bridge_vlan(link);
2299 if (r < 0)
2300 log_link_error_errno(link, r, "Could not set bridge vlan: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 2300, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set bridge vlan: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 2300, __func__, "Could not set bridge vlan: %m"); })
;
2301 }
2302
2303 /* Skip setting up addresses until it gets carrier,
2304 or it would try to set addresses twice,
2305 which is bad for non-idempotent steps. */
2306 if (!link_has_carrier(link) && !link->network->configure_without_carrier)
2307 return 0;
2308
2309 return link_enter_set_addresses(link);
2310}
2311
2312static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
2313 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
2314 int r;
2315
2316 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2316, __PRETTY_FUNCTION__); } while (0)
;
2317 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 2317, __PRETTY_FUNCTION__); } while (0)
;
2318
2319 link->enslaving--;
2320
2321 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_FAILED, LINK_STATE_LINGER})/sizeof
(int)]; switch(link->state) { case LINK_STATE_FAILED: case
LINK_STATE_LINGER: _found = 1; break; default: break; } _found
; })
)
2322 return 1;
2323
2324 r = sd_netlink_message_get_errno(m);
2325 if (r < 0 && r != -EEXIST17) {
2326 log_link_error_errno(link, r, "Could not join netdev: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 2326, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not join netdev: %m") : log_internal_realm((
(LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 2326, __func__, "Could not join netdev: %m"); })
;
2327 link_enter_failed(link);
2328 return 1;
2329 } else
2330 log_link_debug(link, "Joined netdev")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2330, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Joined netdev") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 2330
, __func__, "Joined netdev"); })
;
2331
2332 if (link->enslaving <= 0)
2333 link_joined(link);
2334
2335 return 1;
2336}
2337
2338static int link_enter_join_netdev(Link *link) {
2339 NetDev *netdev;
2340 Iterator i;
2341 int r;
2342
2343 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2343, __PRETTY_FUNCTION__); } while (0)
;
2344 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 2344, __PRETTY_FUNCTION__); } while (0)
;
2345 assert(link->state == LINK_STATE_PENDING)do { if ((__builtin_expect(!!(!(link->state == LINK_STATE_PENDING
)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->state == LINK_STATE_PENDING"
), "../src/network/networkd-link.c", 2345, __PRETTY_FUNCTION__
); } while (0)
;
2346
2347 link_set_state(link, LINK_STATE_ENSLAVING);
2348
2349 link_dirty(link);
2350
2351 if (!link->network->bridge &&
2352 !link->network->bond &&
2353 !link->network->vrf &&
2354 hashmap_isempty(link->network->stacked_netdevs))
2355 return link_joined(link);
2356
2357 if (link->network->bond) {
2358 log_struct(LOG_DEBUG,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2361, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bond->ifname, ((void*)0))
2359 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2361, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bond->ifname, ((void*)0))
2360 LOG_NETDEV_INTERFACE(link->network->bond),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2361, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bond->ifname, ((void*)0))
2361 LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->bond->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2361, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bond->ifname, ((void*)0))
;
2362
2363 r = netdev_join(link->network->bond, link, netdev_join_handler);
2364 if (r < 0) {
2365 log_struct_errno(LOG_WARNING, r,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2368, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bond->ifname, ((
void*)0))
2366 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2368, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bond->ifname, ((
void*)0))
2367 LOG_NETDEV_INTERFACE(link->network->bond),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2368, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bond->ifname, ((
void*)0))
2368 LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->bond->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2368, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bond
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bond->ifname, ((
void*)0))
;
2369 link_enter_failed(link);
2370 return r;
2371 }
2372
2373 link->enslaving++;
2374 }
2375
2376 if (link->network->bridge) {
2377 log_struct(LOG_DEBUG,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2380, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bridge->ifname, ((void*)0))
2378 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2380, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bridge->ifname, ((void*)0))
2379 LOG_NETDEV_INTERFACE(link->network->bridge),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2380, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bridge->ifname, ((void*)0))
2380 LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->bridge->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2380, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->bridge->ifname, ((void*)0))
;
2381
2382 r = netdev_join(link->network->bridge, link, netdev_join_handler);
2383 if (r < 0) {
2384 log_struct_errno(LOG_WARNING, r,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2387, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bridge->ifname, (
(void*)0))
2385 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2387, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bridge->ifname, (
(void*)0))
2386 LOG_NETDEV_INTERFACE(link->network->bridge),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2387, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bridge->ifname, (
(void*)0))
2387 LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->bridge->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2387, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->bridge
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->bridge->ifname, (
(void*)0))
;
2388 link_enter_failed(link);
2389 return r;
2390 }
2391
2392 link->enslaving++;
2393 }
2394
2395 if (link->network->vrf) {
2396 log_struct(LOG_DEBUG,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2399, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->vrf->ifname, ((void*)0))
2397 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2399, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->vrf->ifname, ((void*)0))
2398 LOG_NETDEV_INTERFACE(link->network->vrf),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2399, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->vrf->ifname, ((void*)0))
2399 LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->vrf->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2399, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Enslaving by '%s'", (link)->
ifname, link->network->vrf->ifname, ((void*)0))
;
2400
2401 r = netdev_join(link->network->vrf, link, netdev_join_handler);
2402 if (r < 0) {
2403 log_struct_errno(LOG_WARNING, r,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2406, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->vrf->ifname, ((void
*)0))
2404 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2406, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->vrf->ifname, ((void
*)0))
2405 LOG_NETDEV_INTERFACE(link->network->vrf),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2406, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->vrf->ifname, ((void
*)0))
2406 LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->vrf->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2406, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (link->network->vrf
)->ifname, "MESSAGE=%s: " "Could not join netdev '%s': %m"
, (link)->ifname, link->network->vrf->ifname, ((void
*)0))
;
2407 link_enter_failed(link);
2408 return r;
2409 }
2410
2411 link->enslaving++;
2412 }
2413
2414 HASHMAP_FOREACH(netdev, link->network->stacked_netdevs, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((link->network->
stacked_netdevs), &(i), (void**)&(netdev), ((void*)0)
); )
{
2415
2416 if (netdev->ifindex > 0) {
2417 link_joined(link);
2418 continue;
2419 }
2420
2421 log_struct(LOG_DEBUG,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2424, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Enslaving by '%s'", (link)->ifname, netdev->ifname, (
(void*)0))
2422 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2424, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Enslaving by '%s'", (link)->ifname, netdev->ifname, (
(void*)0))
2423 LOG_NETDEV_INTERFACE(netdev),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2424, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Enslaving by '%s'", (link)->ifname, netdev->ifname, (
(void*)0))
2424 LOG_LINK_MESSAGE(link, "Enslaving by '%s'", netdev->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (7)), 0
, "../src/network/networkd-link.c", 2424, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Enslaving by '%s'", (link)->ifname, netdev->ifname, (
(void*)0))
;
2425
2426 r = netdev_join(netdev, link, netdev_join_handler);
2427 if (r < 0) {
2428 log_struct_errno(LOG_WARNING, r,log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2431, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Could not join netdev '%s': %m", (link)->ifname, netdev->
ifname, ((void*)0))
2429 LOG_LINK_INTERFACE(link),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2431, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Could not join netdev '%s': %m", (link)->ifname, netdev->
ifname, ((void*)0))
2430 LOG_NETDEV_INTERFACE(netdev),log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2431, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Could not join netdev '%s': %m", (link)->ifname, netdev->
ifname, ((void*)0))
2431 LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", netdev->ifname))log_struct_internal(((LOG_REALM_SYSTEMD) << 10 | (4)), r
, "../src/network/networkd-link.c", 2431, __func__, "INTERFACE=%s"
, (link)->ifname, "INTERFACE=%s", (netdev)->ifname, "MESSAGE=%s: "
"Could not join netdev '%s': %m", (link)->ifname, netdev->
ifname, ((void*)0))
;
2432 link_enter_failed(link);
2433 return r;
2434 }
2435
2436 link->enslaving++;
2437 }
2438
2439 return 0;
2440}
2441
2442static int link_set_ipv4_forward(Link *link) {
2443 int r;
2444
2445 if (!link_ipv4_forward_enabled(link))
2446 return 0;
2447
2448 /* We propagate the forwarding flag from one interface to the
2449 * global setting one way. This means: as long as at least one
2450 * interface was configured at any time that had IP forwarding
2451 * enabled the setting will stay on for good. We do this
2452 * primarily to keep IPv4 and IPv6 packet forwarding behaviour
2453 * somewhat in sync (see below). */
2454
2455 r = write_string_file("/proc/sys/net/ipv4/ip_forward", "1", WRITE_STRING_FILE_VERIFY_ON_FAILURE);
2456 if (r < 0)
2457 log_link_warning_errno(link, r, "Cannot turn on IPv4 packet forwarding, ignoring: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 2457, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot turn on IPv4 packet forwarding, ignoring: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 2457, __func__, "Cannot turn on IPv4 packet forwarding, ignoring: %m"
); })
;
2458
2459 return 0;
2460}
2461
2462static int link_set_ipv6_forward(Link *link) {
2463 int r;
2464
2465 if (!link_ipv6_forward_enabled(link))
2466 return 0;
2467
2468 /* On Linux, the IPv6 stack does not know a per-interface
2469 * packet forwarding setting: either packet forwarding is on
2470 * for all, or off for all. We hence don't bother with a
2471 * per-interface setting, but simply propagate the interface
2472 * flag, if it is set, to the global flag, one-way. Note that
2473 * while IPv4 would allow a per-interface flag, we expose the
2474 * same behaviour there and also propagate the setting from
2475 * one to all, to keep things simple (see above). */
2476
2477 r = write_string_file("/proc/sys/net/ipv6/conf/all/forwarding", "1", WRITE_STRING_FILE_VERIFY_ON_FAILURE);
2478 if (r < 0)
2479 log_link_warning_errno(link, r, "Cannot configure IPv6 packet forwarding, ignoring: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 2479, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot configure IPv6 packet forwarding, ignoring: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 2479, __func__, "Cannot configure IPv6 packet forwarding, ignoring: %m"
); })
;
2480
2481 return 0;
2482}
2483
2484static int link_set_ipv6_privacy_extensions(Link *link) {
2485 char buf[DECIMAL_STR_MAX(unsigned)(2+(sizeof(unsigned) <= 1 ? 3 : sizeof(unsigned) <= 2 ?
5 : sizeof(unsigned) <= 4 ? 10 : sizeof(unsigned) <= 8
? 20 : sizeof(int[-2*(sizeof(unsigned) > 8)])))
+ 1];
2486 IPv6PrivacyExtensions s;
2487 const char *p = NULL((void*)0);
2488 int r;
2489
2490 s = link_ipv6_privacy_extensions(link);
2491 if (s < 0)
2492 return 0;
2493
2494 p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/use_tempaddr")({ const char *_appendees_[] = { "/proc/sys/net/ipv6/conf/", link
->ifname, "/use_tempaddr" }; char *_d_, *_p_; size_t _len_
= 0; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
2495 xsprintf(buf, "%u", (unsigned) link->network->ipv6_privacy_extensions)do { if ((__builtin_expect(!!(!(((size_t) snprintf(buf, __extension__
(__builtin_choose_expr( !__builtin_types_compatible_p(typeof
(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[0]), ((
void)0))), "%u", (unsigned) link->network->ipv6_privacy_extensions
) < (__extension__ (__builtin_choose_expr( !__builtin_types_compatible_p
(typeof(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[
0]), ((void)0))))))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("xsprintf: " "buf" "[] must be big enough"), "../src/network/networkd-link.c"
, 2495, __PRETTY_FUNCTION__); } while (0)
;
2496
2497 r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE);
2498 if (r < 0)
2499 log_link_warning_errno(link, r, "Cannot configure IPv6 privacy extension for interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 2499, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot configure IPv6 privacy extension for interface: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 2499, __func__, "Cannot configure IPv6 privacy extension for interface: %m"
); })
;
2500
2501 return 0;
2502}
2503
2504static int link_set_ipv6_accept_ra(Link *link) {
2505 const char *p = NULL((void*)0);
2506 int r;
2507
2508 /* Make this a NOP if IPv6 is not available */
2509 if (!socket_ipv6_is_supported())
2510 return 0;
2511
2512 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
2513 return 0;
2514
2515 if (!link->network)
2516 return 0;
2517
2518 p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/accept_ra")({ const char *_appendees_[] = { "/proc/sys/net/ipv6/conf/", link
->ifname, "/accept_ra" }; char *_d_, *_p_; size_t _len_ = 0
; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
2519
2520 /* We handle router advertisements ourselves, tell the kernel to GTFO */
2521 r = write_string_file(p, "0", WRITE_STRING_FILE_VERIFY_ON_FAILURE);
2522 if (r < 0)
2523 log_link_warning_errno(link, r, "Cannot disable kernel IPv6 accept_ra for interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 2523, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot disable kernel IPv6 accept_ra for interface: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 2523, __func__, "Cannot disable kernel IPv6 accept_ra for interface: %m"
); })
;
2524
2525 return 0;
2526}
2527
2528static int link_set_ipv6_dad_transmits(Link *link) {
2529 char buf[DECIMAL_STR_MAX(int)(2+(sizeof(int) <= 1 ? 3 : sizeof(int) <= 2 ? 5 : sizeof
(int) <= 4 ? 10 : sizeof(int) <= 8 ? 20 : sizeof(int[-2
*(sizeof(int) > 8)])))
+ 1];
2530 const char *p = NULL((void*)0);
2531 int r;
2532
2533 /* Make this a NOP if IPv6 is not available */
2534 if (!socket_ipv6_is_supported())
2535 return 0;
2536
2537 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
2538 return 0;
2539
2540 if (!link->network)
2541 return 0;
2542
2543 if (link->network->ipv6_dad_transmits < 0)
2544 return 0;
2545
2546 p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/dad_transmits")({ const char *_appendees_[] = { "/proc/sys/net/ipv6/conf/", link
->ifname, "/dad_transmits" }; char *_d_, *_p_; size_t _len_
= 0; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
2547 xsprintf(buf, "%i", link->network->ipv6_dad_transmits)do { if ((__builtin_expect(!!(!(((size_t) snprintf(buf, __extension__
(__builtin_choose_expr( !__builtin_types_compatible_p(typeof
(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[0]), ((
void)0))), "%i", link->network->ipv6_dad_transmits) <
(__extension__ (__builtin_choose_expr( !__builtin_types_compatible_p
(typeof(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[
0]), ((void)0))))))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("xsprintf: " "buf" "[] must be big enough"), "../src/network/networkd-link.c"
, 2547, __PRETTY_FUNCTION__); } while (0)
;
2548
2549 r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE);
2550 if (r < 0)
2551 log_link_warning_errno(link, r, "Cannot set IPv6 dad transmits for interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 2551, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot set IPv6 dad transmits for interface: %m") :
log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4)))
, r, "../src/network/networkd-link.c", 2551, __func__, "Cannot set IPv6 dad transmits for interface: %m"
); })
;
2552
2553 return 0;
2554}
2555
2556static int link_set_ipv6_hop_limit(Link *link) {
2557 char buf[DECIMAL_STR_MAX(int)(2+(sizeof(int) <= 1 ? 3 : sizeof(int) <= 2 ? 5 : sizeof
(int) <= 4 ? 10 : sizeof(int) <= 8 ? 20 : sizeof(int[-2
*(sizeof(int) > 8)])))
+ 1];
2558 const char *p = NULL((void*)0);
2559 int r;
2560
2561 /* Make this a NOP if IPv6 is not available */
2562 if (!socket_ipv6_is_supported())
2563 return 0;
2564
2565 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
2566 return 0;
2567
2568 if (!link->network)
2569 return 0;
2570
2571 if (link->network->ipv6_hop_limit < 0)
2572 return 0;
2573
2574 p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/hop_limit")({ const char *_appendees_[] = { "/proc/sys/net/ipv6/conf/", link
->ifname, "/hop_limit" }; char *_d_, *_p_; size_t _len_ = 0
; size_t _i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
2575 xsprintf(buf, "%i", link->network->ipv6_hop_limit)do { if ((__builtin_expect(!!(!(((size_t) snprintf(buf, __extension__
(__builtin_choose_expr( !__builtin_types_compatible_p(typeof
(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[0]), ((
void)0))), "%i", link->network->ipv6_hop_limit) < (__extension__
(__builtin_choose_expr( !__builtin_types_compatible_p(typeof
(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[0]), ((
void)0))))))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD,
("xsprintf: " "buf" "[] must be big enough"), "../src/network/networkd-link.c"
, 2575, __PRETTY_FUNCTION__); } while (0)
;
2576
2577 r = write_string_file(p, buf, WRITE_STRING_FILE_VERIFY_ON_FAILURE);
2578 if (r < 0)
2579 log_link_warning_errno(link, r, "Cannot set IPv6 hop limit for interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 2579, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot set IPv6 hop limit for interface: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 2579, __func__, "Cannot set IPv6 hop limit for interface: %m"
); })
;
2580
2581 return 0;
2582}
2583
2584static int link_set_ipv6_mtu(Link *link) {
2585 char buf[DECIMAL_STR_MAX(unsigned)(2+(sizeof(unsigned) <= 1 ? 3 : sizeof(unsigned) <= 2 ?
5 : sizeof(unsigned) <= 4 ? 10 : sizeof(unsigned) <= 8
? 20 : sizeof(int[-2*(sizeof(unsigned) > 8)])))
+ 1];
2586 const char *p = NULL((void*)0);
2587 int r;
2588
2589 /* Make this a NOP if IPv6 is not available */
2590 if (!socket_ipv6_is_supported())
2591 return 0;
2592
2593 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK)
2594 return 0;
2595
2596 if (link->network->ipv6_mtu == 0)
2597 return 0;
2598
2599 p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/mtu")({ const char *_appendees_[] = { "/proc/sys/net/ipv6/conf/", link
->ifname, "/mtu" }; char *_d_, *_p_; size_t _len_ = 0; size_t
_i_; for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr
( !__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _len_ += strlen
(_appendees_[_i_]); _p_ = _d_ = __builtin_alloca (_len_ + 1);
for (_i_ = 0; _i_ < __extension__ (__builtin_choose_expr(
!__builtin_types_compatible_p(typeof(_appendees_), typeof(&
*(_appendees_))), sizeof(_appendees_)/sizeof((_appendees_)[0]
), ((void)0))) && _appendees_[_i_]; _i_++) _p_ = stpcpy
(_p_, _appendees_[_i_]); *_p_ = 0; _d_; })
;
2600
2601 xsprintf(buf, "%" PRIu32, link->network->ipv6_mtu)do { if ((__builtin_expect(!!(!(((size_t) snprintf(buf, __extension__
(__builtin_choose_expr( !__builtin_types_compatible_p(typeof
(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[0]), ((
void)0))), "%" "u", link->network->ipv6_mtu) < (__extension__
(__builtin_choose_expr( !__builtin_types_compatible_p(typeof
(buf), typeof(&*(buf))), sizeof(buf)/sizeof((buf)[0]), ((
void)0))))))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD,
("xsprintf: " "buf" "[] must be big enough"), "../src/network/networkd-link.c"
, 2601, __PRETTY_FUNCTION__); } while (0)
;
2602
2603 r = write_string_file(p, buf, 0);
2604 if (r < 0)
2605 log_link_warning_errno(link, r, "Cannot set IPv6 MTU for interface: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 2605, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Cannot set IPv6 MTU for interface: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 2605, __func__, "Cannot set IPv6 MTU for interface: %m"); }
)
;
2606
2607 return 0;
2608}
2609
2610static int link_drop_foreign_config(Link *link) {
2611 Address *address;
2612 Route *route;
2613 Iterator i;
2614 int r;
2615
2616 SET_FOREACH(address, link->addresses_foreign, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->addresses_foreign
), &(i), (void**)&(address)); )
{
2617 /* we consider IPv6LL addresses to be managed by the kernel */
2618 if (address->family == AF_INET610 && in_addr_is_link_local(AF_INET610, &address->in_addr) == 1)
2619 continue;
2620
2621 r = address_remove(address, link, link_address_remove_handler);
2622 if (r < 0)
2623 return r;
2624 }
2625
2626 SET_FOREACH(route, link->routes_foreign, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->routes_foreign
), &(i), (void**)&(route)); )
{
2627 /* do not touch routes managed by the kernel */
2628 if (route->protocol == RTPROT_KERNEL2)
2629 continue;
2630
2631 r = route_remove(route, link, link_route_remove_handler);
2632 if (r < 0)
2633 return r;
2634 }
2635
2636 return 0;
2637}
2638
2639static int link_drop_config(Link *link) {
2640 Address *address, *pool_address;
2641 Route *route;
2642 Iterator i;
2643 int r;
2644
2645 SET_FOREACH(address, link->addresses, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->addresses), &
(i), (void**)&(address)); )
{
2646 /* we consider IPv6LL addresses to be managed by the kernel */
2647 if (address->family == AF_INET610 && in_addr_is_link_local(AF_INET610, &address->in_addr) == 1)
2648 continue;
2649
2650 r = address_remove(address, link, link_address_remove_handler);
2651 if (r < 0)
2652 return r;
2653
2654 /* If this address came from an address pool, clean up the pool */
2655 LIST_FOREACH(addresses, pool_address, link->pool_addresses)for ((pool_address) = (link->pool_addresses); (pool_address
); (pool_address) = (pool_address)->addresses_next)
{
2656 if (address_equal(address, pool_address)) {
2657 LIST_REMOVE(addresses, link->pool_addresses, pool_address)do { typeof(*(link->pool_addresses)) **_head = &(link->
pool_addresses), *_item = (pool_address); do { if ((__builtin_expect
(!!(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD,
("_item"), "../src/network/networkd-link.c", 2657, __PRETTY_FUNCTION__
); } while (0); if (_item->addresses_next) _item->addresses_next
->addresses_prev = _item->addresses_prev; if (_item->
addresses_prev) _item->addresses_prev->addresses_next =
_item->addresses_next; else { do { if ((__builtin_expect(
!!(!(*_head == _item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("*_head == _item"), "../src/network/networkd-link.c", 2657
, __PRETTY_FUNCTION__); } while (0); *_head = _item->addresses_next
; } _item->addresses_next = _item->addresses_prev = ((void
*)0); } while (0)
;
2658 address_free(pool_address);
2659 break;
2660 }
2661 }
2662 }
2663
2664 SET_FOREACH(route, link->routes, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->routes), &
(i), (void**)&(route)); )
{
2665 /* do not touch routes managed by the kernel */
2666 if (route->protocol == RTPROT_KERNEL2)
2667 continue;
2668
2669 r = route_remove(route, link, link_route_remove_handler);
2670 if (r < 0)
2671 return r;
2672 }
2673
2674 ndisc_flush(link);
2675
2676 return 0;
2677}
2678
2679static int link_update_lldp(Link *link) {
2680 int r;
2681
2682 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2682, __PRETTY_FUNCTION__); } while (0)
;
2683
2684 if (!link->lldp)
2685 return 0;
2686
2687 if (link->flags & IFF_UPIFF_UP) {
2688 r = sd_lldp_start(link->lldp);
2689 if (r > 0)
2690 log_link_debug(link, "Started LLDP.")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2690, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Started LLDP.") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 2690
, __func__, "Started LLDP."); })
;
2691 } else {
2692 r = sd_lldp_stop(link->lldp);
2693 if (r > 0)
2694 log_link_debug(link, "Stopped LLDP.")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2694, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Stopped LLDP.") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 2694
, __func__, "Stopped LLDP."); })
;
2695 }
2696
2697 return r;
2698}
2699
2700static int link_configure_can(Link *link) {
2701 int r;
2702
2703 if (streq_ptr(link->kind, "can")) {
2704 /* The CAN interface must be down to configure bitrate, etc... */
2705 if ((link->flags & IFF_UPIFF_UP)) {
2706 r = link_down(link);
2707 if (r < 0) {
2708 link_enter_failed(link);
2709 return r;
2710 }
2711
2712 return 0;
2713 }
2714
2715 return link_set_can(link);
2716 }
2717
2718 if (!(link->flags & IFF_UPIFF_UP)) {
2719 r = link_up_can(link);
2720 if (r < 0) {
2721 link_enter_failed(link);
2722 return r;
2723 }
2724 }
2725
2726 return 0;
2727}
2728
2729static int link_configure(Link *link) {
2730 int r;
2731
2732 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2732, __PRETTY_FUNCTION__); } while (0)
;
2733 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 2733, __PRETTY_FUNCTION__); } while (0)
;
2734 assert(link->state == LINK_STATE_PENDING)do { if ((__builtin_expect(!!(!(link->state == LINK_STATE_PENDING
)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->state == LINK_STATE_PENDING"
), "../src/network/networkd-link.c", 2734, __PRETTY_FUNCTION__
); } while (0)
;
2735
2736 if (STRPTR_IN_SET(link->kind, "can", "vcan")({ const char* _x = (link->kind); _x && (!!strv_find
((((char**) ((const char*[]) { "can", "vcan", ((void*)0) })))
, (_x))); })
)
2737 return link_configure_can(link);
2738
2739 /* Drop foreign config, but ignore loopback or critical devices.
2740 * We do not want to remove loopback address or addresses used for root NFS. */
2741 if (!(link->flags & IFF_LOOPBACKIFF_LOOPBACK) && !(link->network->dhcp_critical)) {
2742 r = link_drop_foreign_config(link);
2743 if (r < 0)
2744 return r;
2745 }
2746
2747 r = link_set_proxy_arp(link);
2748 if (r < 0)
2749 return r;
2750
2751 r = ipv6_proxy_ndp_addresses_configure(link);
2752 if (r < 0)
2753 return r;
2754
2755 r = link_set_ipv4_forward(link);
2756 if (r < 0)
2757 return r;
2758
2759 r = link_set_ipv6_forward(link);
2760 if (r < 0)
2761 return r;
2762
2763 r = link_set_ipv6_privacy_extensions(link);
2764 if (r < 0)
2765 return r;
2766
2767 r = link_set_ipv6_accept_ra(link);
2768 if (r < 0)
2769 return r;
2770
2771 r = link_set_ipv6_dad_transmits(link);
2772 if (r < 0)
2773 return r;
2774
2775 r = link_set_ipv6_hop_limit(link);
2776 if (r < 0)
2777 return r;
2778
2779 r = link_set_flags(link);
2780 if (r < 0)
2781 return r;
2782
2783 r = link_set_ipv6_mtu(link);
2784 if (r < 0)
2785 return r;
2786
2787 if (link_ipv4ll_enabled(link)) {
2788 r = ipv4ll_configure(link);
2789 if (r < 0)
2790 return r;
2791 }
2792
2793 if (link_dhcp4_enabled(link)) {
2794 r = dhcp4_set_promote_secondaries(link);
2795 if (r < 0)
2796 return r;
2797
2798 r = dhcp4_configure(link);
2799 if (r < 0)
2800 return r;
2801 }
2802
2803 if (link_dhcp4_server_enabled(link)) {
2804 r = sd_dhcp_server_new(&link->dhcp_server, link->ifindex);
2805 if (r < 0)
2806 return r;
2807
2808 r = sd_dhcp_server_attach_event(link->dhcp_server, NULL((void*)0), 0);
2809 if (r < 0)
2810 return r;
2811 }
2812
2813 if (link_dhcp6_enabled(link) ||
2814 link_ipv6_accept_ra_enabled(link)) {
2815 r = dhcp6_configure(link);
2816 if (r < 0)
2817 return r;
2818 }
2819
2820 if (link_ipv6_accept_ra_enabled(link)) {
2821 r = ndisc_configure(link);
2822 if (r < 0)
2823 return r;
2824 }
2825
2826 if (link_radv_enabled(link)) {
2827 r = radv_configure(link);
2828 if (r < 0)
2829 return r;
2830 }
2831
2832 if (link_lldp_rx_enabled(link)) {
2833 r = sd_lldp_new(&link->lldp);
2834 if (r < 0)
2835 return r;
2836
2837 r = sd_lldp_set_ifindex(link->lldp, link->ifindex);
2838 if (r < 0)
2839 return r;
2840
2841 r = sd_lldp_match_capabilities(link->lldp,
2842 link->network->lldp_mode == LLDP_MODE_ROUTERS_ONLY ?
2843 SD_LLDP_SYSTEM_CAPABILITIES_ALL_ROUTERS((uint16_t) (SD_LLDP_SYSTEM_CAPABILITIES_REPEATER| SD_LLDP_SYSTEM_CAPABILITIES_BRIDGE
| SD_LLDP_SYSTEM_CAPABILITIES_WLAN_AP| SD_LLDP_SYSTEM_CAPABILITIES_ROUTER
| SD_LLDP_SYSTEM_CAPABILITIES_DOCSIS| SD_LLDP_SYSTEM_CAPABILITIES_CVLAN
| SD_LLDP_SYSTEM_CAPABILITIES_SVLAN| SD_LLDP_SYSTEM_CAPABILITIES_TPMR
))
:
2844 SD_LLDP_SYSTEM_CAPABILITIES_ALL((uint16_t) -1));
2845 if (r < 0)
2846 return r;
2847
2848 r = sd_lldp_set_filter_address(link->lldp, &link->mac);
2849 if (r < 0)
2850 return r;
2851
2852 r = sd_lldp_attach_event(link->lldp, NULL((void*)0), 0);
2853 if (r < 0)
2854 return r;
2855
2856 r = sd_lldp_set_callback(link->lldp, lldp_handler, link);
2857 if (r < 0)
2858 return r;
2859
2860 r = link_update_lldp(link);
2861 if (r < 0)
2862 return r;
2863 }
2864
2865 if (link->network->mtu > 0) {
2866 r = link_set_mtu(link, link->network->mtu);
2867 if (r < 0)
2868 return r;
2869 }
2870
2871 if (link_has_carrier(link) || link->network->configure_without_carrier) {
2872 r = link_acquire_conf(link);
2873 if (r < 0)
2874 return r;
2875 }
2876
2877 return link_enter_join_netdev(link);
2878}
2879
2880static int link_initialized_and_synced(sd_netlink *rtnl, sd_netlink_message *m,
2881 void *userdata) {
2882 _cleanup_(link_unrefp)__attribute__((cleanup(link_unrefp))) Link *link = userdata;
2883 Network *network;
2884 int r;
2885
2886 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2886, __PRETTY_FUNCTION__); } while (0)
;
2887 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 2887, __PRETTY_FUNCTION__); } while (0)
;
2888 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 2888, __PRETTY_FUNCTION__); } while (0)
;
2889
2890 if (link->state != LINK_STATE_PENDING)
2891 return 1;
2892
2893 log_link_debug(link, "Link state is up-to-date")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2893, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Link state is up-to-date") : log_internal_realm(((
LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 2893, __func__, "Link state is up-to-date"); })
;
2894
2895 r = link_new_bound_by_list(link);
2896 if (r < 0)
2897 return r;
2898
2899 r = link_handle_bound_by_list(link);
2900 if (r < 0)
2901 return r;
2902
2903 if (!link->network) {
2904 r = network_get(link->manager, link->udev_device, link->ifname,
2905 &link->mac, &network);
2906 if (r == -ENOENT2) {
2907 link_enter_unmanaged(link);
2908 return 1;
2909 } else if (r == 0 && network->unmanaged) {
2910 link_enter_unmanaged(link);
2911 return 0;
2912 } else if (r < 0)
2913 return r;
2914
2915 if (link->flags & IFF_LOOPBACKIFF_LOOPBACK) {
2916 if (network->link_local != ADDRESS_FAMILY_NO)
2917 log_link_debug(link, "Ignoring link-local autoconfiguration for loopback link")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2917, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Ignoring link-local autoconfiguration for loopback link"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 2917, __func__, "Ignoring link-local autoconfiguration for loopback link"
); })
;
2918
2919 if (network->dhcp != ADDRESS_FAMILY_NO)
2920 log_link_debug(link, "Ignoring DHCP clients for loopback link")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2920, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Ignoring DHCP clients for loopback link") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 2920, __func__, "Ignoring DHCP clients for loopback link");
})
;
2921
2922 if (network->dhcp_server)
2923 log_link_debug(link, "Ignoring DHCP server for loopback link")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2923, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Ignoring DHCP server for loopback link") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 2923, __func__, "Ignoring DHCP server for loopback link"); }
)
;
2924 }
2925
2926 r = network_apply(network, link);
2927 if (r < 0)
2928 return r;
2929 }
2930
2931 r = link_new_bound_to_list(link);
2932 if (r < 0)
2933 return r;
2934
2935 r = link_configure(link);
2936 if (r < 0)
2937 return r;
2938
2939 return 1;
2940}
2941
2942int link_initialized(Link *link, struct udev_device *device) {
2943 _cleanup_(sd_netlink_message_unrefp)__attribute__((cleanup(sd_netlink_message_unrefp))) sd_netlink_message *req = NULL((void*)0);
2944 int r;
2945
2946 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2946, __PRETTY_FUNCTION__); } while (0)
;
2947 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 2947, __PRETTY_FUNCTION__); } while (0)
;
2948 assert(link->manager->rtnl)do { if ((__builtin_expect(!!(!(link->manager->rtnl)),0
))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("link->manager->rtnl"
), "../src/network/networkd-link.c", 2948, __PRETTY_FUNCTION__
); } while (0)
;
2949 assert(device)do { if ((__builtin_expect(!!(!(device)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("device"), "../src/network/networkd-link.c"
, 2949, __PRETTY_FUNCTION__); } while (0)
;
2950
2951 if (link->state != LINK_STATE_PENDING)
2952 return 0;
2953
2954 if (link->udev_device)
2955 return 0;
2956
2957 log_link_debug(link, "udev initialized link")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 2957, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "udev initialized link") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 2957
, __func__, "udev initialized link"); })
;
2958
2959 link->udev_device = udev_device_ref(device);
2960
2961 /* udev has initialized the link, but we don't know if we have yet
2962 * processed the NEWLINK messages with the latest state. Do a GETLINK,
2963 * when it returns we know that the pending NEWLINKs have already been
2964 * processed and that we are up-to-date */
2965
2966 r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_GETLINKRTM_GETLINK,
2967 link->ifindex);
2968 if (r < 0)
2969 return r;
2970
2971 r = sd_netlink_call_async(link->manager->rtnl, req,
2972 link_initialized_and_synced, link, 0, NULL((void*)0));
2973 if (r < 0)
2974 return r;
2975
2976 link_ref(link);
2977
2978 return 0;
2979}
2980
2981static int link_load(Link *link) {
2982 _cleanup_free___attribute__((cleanup(freep))) char *network_file = NULL((void*)0),
2983 *addresses = NULL((void*)0),
2984 *routes = NULL((void*)0),
2985 *dhcp4_address = NULL((void*)0),
2986 *ipv4ll_address = NULL((void*)0);
2987 union in_addr_union address;
2988 union in_addr_union route_dst;
2989 const char *p;
2990 int r;
2991
2992 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 2992, __PRETTY_FUNCTION__); } while (0)
;
2993
2994 r = parse_env_file(NULL((void*)0), link->state_file, NEWLINE"\n\r",
2995 "NETWORK_FILE", &network_file,
2996 "ADDRESSES", &addresses,
2997 "ROUTES", &routes,
2998 "DHCP4_ADDRESS", &dhcp4_address,
2999 "IPV4LL_ADDRESS", &ipv4ll_address,
3000 NULL((void*)0));
3001 if (r < 0 && r != -ENOENT2)
3002 return log_link_error_errno(link, r, "Failed to read %s: %m", link->state_file)({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3002, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to read %s: %m", link->state_file) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 3002, __func__, "Failed to read %s: %m", link->state_file
); })
;
3003
3004 if (network_file) {
3005 Network *network;
3006 char *suffix;
3007
3008 /* drop suffix */
3009 suffix = strrchr(network_file, '.');
3010 if (!suffix) {
3011 log_link_debug(link, "Failed to get network name from %s", network_file)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3011, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to get network name from %s", network_file)
: log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7)
)), 0, "../src/network/networkd-link.c", 3011, __func__, "Failed to get network name from %s"
, network_file); })
;
3012 goto network_file_fail;
3013 }
3014 *suffix = '\0';
3015
3016 r = network_get_by_name(link->manager, basename(network_file), &network);
3017 if (r < 0) {
3018 log_link_debug_errno(link, r, "Failed to get network %s: %m", basename(network_file))({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 3018, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to get network %s: %m", basename(network_file
)) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((
7))), r, "../src/network/networkd-link.c", 3018, __func__, "Failed to get network %s: %m"
, basename(network_file)); })
;
3019 goto network_file_fail;
3020 }
3021
3022 r = network_apply(network, link);
3023 if (r < 0)
3024 return log_link_error_errno(link, r, "Failed to apply network %s: %m", basename(network_file))({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3024, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to apply network %s: %m", basename(network_file
)) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((
3))), r, "../src/network/networkd-link.c", 3024, __func__, "Failed to apply network %s: %m"
, basename(network_file)); })
;
3025 }
3026
3027network_file_fail:
3028
3029 if (addresses) {
3030 p = addresses;
3031
3032 for (;;) {
3033 _cleanup_free___attribute__((cleanup(freep))) char *address_str = NULL((void*)0);
3034 char *prefixlen_str;
3035 int family;
3036 unsigned char prefixlen;
3037
3038 r = extract_first_word(&p, &address_str, NULL((void*)0), 0);
3039 if (r < 0) {
3040 log_link_debug_errno(link, r, "Failed to extract next address string: %m")({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 3040, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to extract next address string: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), r, "../src/network/networkd-link.c"
, 3040, __func__, "Failed to extract next address string: %m"
); })
;
3041 continue;
3042 }
3043 if (r == 0)
3044 break;
3045
3046 prefixlen_str = strchr(address_str, '/');
3047 if (!prefixlen_str) {
3048 log_link_debug(link, "Failed to parse address and prefix length %s", address_str)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3048, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse address and prefix length %s", address_str
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), 0, "../src/network/networkd-link.c", 3048, __func__, "Failed to parse address and prefix length %s"
, address_str); })
;
3049 continue;
3050 }
3051
3052 *prefixlen_str++ = '\0';
3053
3054 r = sscanf(prefixlen_str, "%hhu", &prefixlen);
3055 if (r != 1) {
3056 log_link_error(link, "Failed to parse prefixlen %s", prefixlen_str)({ const Link *_l = (link); _l ? log_object_internal(3, 0, "../src/network/networkd-link.c"
, 3056, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse prefixlen %s", prefixlen_str) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), 0, "../src/network/networkd-link.c"
, 3056, __func__, "Failed to parse prefixlen %s", prefixlen_str
); })
;
3057 continue;
3058 }
3059
3060 r = in_addr_from_string_auto(address_str, &family, &address);
3061 if (r < 0) {
3062 log_link_debug_errno(link, r, "Failed to parse address %s: %m", address_str)({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 3062, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse address %s: %m", address_str) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), r, "../src/network/networkd-link.c"
, 3062, __func__, "Failed to parse address %s: %m", address_str
); })
;
3063 continue;
3064 }
3065
3066 r = address_add(link, family, &address, prefixlen, NULL((void*)0));
3067 if (r < 0)
3068 return log_link_error_errno(link, r, "Failed to add address: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3068, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to add address: %m") : log_internal_realm((
(LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 3068, __func__, "Failed to add address: %m"); })
;
3069 }
3070 }
3071
3072 if (routes) {
3073 p = routes;
3074
3075 for (;;) {
3076 Route *route;
3077 _cleanup_free___attribute__((cleanup(freep))) char *route_str = NULL((void*)0);
3078 _cleanup_(sd_event_source_unrefp)__attribute__((cleanup(sd_event_source_unrefp))) sd_event_source *expire = NULL((void*)0);
3079 usec_t lifetime;
3080 char *prefixlen_str;
3081 int family;
3082 unsigned char prefixlen, tos, table;
3083 uint32_t priority;
3084
3085 r = extract_first_word(&p, &route_str, NULL((void*)0), 0);
3086 if (r < 0) {
3087 log_link_debug_errno(link, r, "Failed to extract next route string: %m")({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 3087, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to extract next route string: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), r, "../src/network/networkd-link.c"
, 3087, __func__, "Failed to extract next route string: %m");
})
;
3088 continue;
3089 }
3090 if (r == 0)
3091 break;
3092
3093 prefixlen_str = strchr(route_str, '/');
3094 if (!prefixlen_str) {
3095 log_link_debug(link, "Failed to parse route %s", route_str)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3095, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse route %s", route_str) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 3095, __func__, "Failed to parse route %s", route_str); })
;
3096 continue;
3097 }
3098
3099 *prefixlen_str++ = '\0';
3100
3101 r = sscanf(prefixlen_str, "%hhu/%hhu/%"SCNu32"u""/%hhu/"USEC_FMT"%" "l" "u", &prefixlen, &tos, &priority, &table, &lifetime);
3102 if (r != 5) {
3103 log_link_debug(link,({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3105, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse destination prefix length, tos, priority, table or expiration %s"
, prefixlen_str) : log_internal_realm(((LOG_REALM_SYSTEMD) <<
10 | ((7))), 0, "../src/network/networkd-link.c", 3105, __func__
, "Failed to parse destination prefix length, tos, priority, table or expiration %s"
, prefixlen_str); })
3104 "Failed to parse destination prefix length, tos, priority, table or expiration %s",({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3105, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse destination prefix length, tos, priority, table or expiration %s"
, prefixlen_str) : log_internal_realm(((LOG_REALM_SYSTEMD) <<
10 | ((7))), 0, "../src/network/networkd-link.c", 3105, __func__
, "Failed to parse destination prefix length, tos, priority, table or expiration %s"
, prefixlen_str); })
3105 prefixlen_str)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3105, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse destination prefix length, tos, priority, table or expiration %s"
, prefixlen_str) : log_internal_realm(((LOG_REALM_SYSTEMD) <<
10 | ((7))), 0, "../src/network/networkd-link.c", 3105, __func__
, "Failed to parse destination prefix length, tos, priority, table or expiration %s"
, prefixlen_str); })
;
3106 continue;
3107 }
3108
3109 r = in_addr_from_string_auto(route_str, &family, &route_dst);
3110 if (r < 0) {
3111 log_link_debug_errno(link, r, "Failed to parse route destination %s: %m", route_str)({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 3111, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse route destination %s: %m", route_str
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), r, "../src/network/networkd-link.c", 3111, __func__, "Failed to parse route destination %s: %m"
, route_str); })
;
3112 continue;
3113 }
3114
3115 r = route_add(link, family, &route_dst, prefixlen, tos, priority, table, &route);
3116 if (r < 0)
3117 return log_link_error_errno(link, r, "Failed to add route: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3117, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to add route: %m") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((3))), r, "../src/network/networkd-link.c", 3117
, __func__, "Failed to add route: %m"); })
;
3118
3119 if (lifetime != USEC_INFINITY((usec_t) -1) && !kernel_route_expiration_supported()) {
3120 r = sd_event_add_time(link->manager->event, &expire, clock_boottime_or_monotonic(), lifetime,
3121 0, route_expire_handler, route);
3122 if (r < 0)
3123 log_link_warning_errno(link, r, "Could not arm route expiration handler: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3123, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not arm route expiration handler: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 3123, __func__, "Could not arm route expiration handler: %m"
); })
;
3124 }
3125
3126 route->lifetime = lifetime;
3127 sd_event_source_unref(route->expire);
3128 route->expire = TAKE_PTR(expire)({ typeof(expire) _ptr_ = (expire); (expire) = ((void*)0); _ptr_
; })
;
3129 }
3130 }
3131
3132 if (dhcp4_address) {
3133 r = in_addr_from_string(AF_INET2, dhcp4_address, &address);
3134 if (r < 0) {
3135 log_link_debug_errno(link, r, "Failed to parse DHCPv4 address %s: %m", dhcp4_address)({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 3135, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse DHCPv4 address %s: %m", dhcp4_address
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), r, "../src/network/networkd-link.c", 3135, __func__, "Failed to parse DHCPv4 address %s: %m"
, dhcp4_address); })
;
3136 goto dhcp4_address_fail;
3137 }
3138
3139 r = sd_dhcp_client_new(&link->dhcp_client, link->network ? link->network->dhcp_anonymize : 0);
3140 if (r < 0)
3141 return log_link_error_errno(link, r, "Failed to create DHCPv4 client: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3141, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to create DHCPv4 client: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 3141, __func__, "Failed to create DHCPv4 client: %m"); })
;
3142
3143 r = sd_dhcp_client_set_request_address(link->dhcp_client, &address.in);
3144 if (r < 0)
3145 return log_link_error_errno(link, r, "Failed to set initial DHCPv4 address %s: %m", dhcp4_address)({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3145, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to set initial DHCPv4 address %s: %m", dhcp4_address
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 3145, __func__, "Failed to set initial DHCPv4 address %s: %m"
, dhcp4_address); })
;
3146 }
3147
3148dhcp4_address_fail:
3149
3150 if (ipv4ll_address) {
3151 r = in_addr_from_string(AF_INET2, ipv4ll_address, &address);
3152 if (r < 0) {
3153 log_link_debug_errno(link, r, "Failed to parse IPv4LL address %s: %m", ipv4ll_address)({ const Link *_l = (link); _l ? log_object_internal(7, r, "../src/network/networkd-link.c"
, 3153, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to parse IPv4LL address %s: %m", ipv4ll_address
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7
))), r, "../src/network/networkd-link.c", 3153, __func__, "Failed to parse IPv4LL address %s: %m"
, ipv4ll_address); })
;
3154 goto ipv4ll_address_fail;
3155 }
3156
3157 r = sd_ipv4ll_new(&link->ipv4ll);
3158 if (r < 0)
3159 return log_link_error_errno(link, r, "Failed to create IPv4LL client: %m")({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3159, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to create IPv4LL client: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((3))), r, "../src/network/networkd-link.c"
, 3159, __func__, "Failed to create IPv4LL client: %m"); })
;
3160
3161 r = sd_ipv4ll_set_address(link->ipv4ll, &address.in);
3162 if (r < 0)
3163 return log_link_error_errno(link, r, "Failed to set initial IPv4LL address %s: %m", ipv4ll_address)({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3163, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to set initial IPv4LL address %s: %m", ipv4ll_address
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 3163, __func__, "Failed to set initial IPv4LL address %s: %m"
, ipv4ll_address); })
;
3164 }
3165
3166ipv4ll_address_fail:
3167
3168 return 0;
3169}
3170
3171int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
3172 Link *link;
3173 _cleanup_(udev_device_unrefp)__attribute__((cleanup(udev_device_unrefp))) struct udev_device *device = NULL((void*)0);
3174 char ifindex_str[2 + DECIMAL_STR_MAX(int)(2+(sizeof(int) <= 1 ? 3 : sizeof(int) <= 2 ? 5 : sizeof
(int) <= 4 ? 10 : sizeof(int) <= 8 ? 20 : sizeof(int[-2
*(sizeof(int) > 8)])))
];
3175 int r;
3176
3177 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 3177
, __PRETTY_FUNCTION__); } while (0)
;
19
Assuming 'm' is non-null
20
Taking false branch
21
Loop condition is false. Exiting loop
3178 assert(m->rtnl)do { if ((__builtin_expect(!!(!(m->rtnl)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m->rtnl"), "../src/network/networkd-link.c"
, 3178, __PRETTY_FUNCTION__); } while (0)
;
22
Assuming field 'rtnl' is non-null
23
Taking false branch
24
Loop condition is false. Exiting loop
3179 assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("message"), "../src/network/networkd-link.c"
, 3179, __PRETTY_FUNCTION__); } while (0)
;
25
Taking false branch
26
Loop condition is false. Exiting loop
3180 assert(ret)do { if ((__builtin_expect(!!(!(ret)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("ret"), "../src/network/networkd-link.c"
, 3180, __PRETTY_FUNCTION__); } while (0)
;
27
Taking false branch
28
Loop condition is false. Exiting loop
3181
3182 r = link_new(m, message, ret);
29
Calling 'link_new'
3183 if (r < 0)
3184 return r;
3185
3186 link = *ret;
3187
3188 log_link_debug(link, "Link %d added", link->ifindex)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3188, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Link %d added", link->ifindex) : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 3188, __func__, "Link %d added", link->ifindex); })
;
3189
3190 r = link_load(link);
3191 if (r < 0)
3192 return r;
3193
3194 if (detect_container() <= 0) {
3195 /* not in a container, udev will be around */
3196 sprintf(ifindex_str, "n%d", link->ifindex);
3197 device = udev_device_new_from_device_id(m->udev, ifindex_str);
3198 if (!device) {
3199 r = log_link_warning_errno(link, errno, "Could not find udev device: %m")({ const Link *_l = (link); _l ? log_object_internal(4, (*__errno_location
()), "../src/network/networkd-link.c", 3199, __func__, "INTERFACE="
, _l->ifname, ((void*)0), ((void*)0), "Could not find udev device: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), (*__errno_location ()), "../src/network/networkd-link.c"
, 3199, __func__, "Could not find udev device: %m"); })
;
3200 goto failed;
3201 }
3202
3203 if (udev_device_get_is_initialized(device) <= 0) {
3204 /* not yet ready */
3205 log_link_debug(link, "link pending udev initialization...")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3205, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "link pending udev initialization...") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((7))), 0, "../src/network/networkd-link.c"
, 3205, __func__, "link pending udev initialization..."); })
;
3206 return 0;
3207 }
3208
3209 r = link_initialized(link, device);
3210 if (r < 0)
3211 goto failed;
3212 } else {
3213 /* we are calling a callback directly, so must take a ref */
3214 link_ref(link);
3215
3216 r = link_initialized_and_synced(m->rtnl, NULL((void*)0), link);
3217 if (r < 0)
3218 goto failed;
3219 }
3220
3221 return 0;
3222failed:
3223 link_enter_failed(link);
3224 return r;
3225}
3226
3227int link_ipv6ll_gained(Link *link, const struct in6_addr *address) {
3228 int r;
3229
3230 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3230, __PRETTY_FUNCTION__); } while (0)
;
3231
3232 log_link_info(link, "Gained IPv6LL")({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 3232, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Gained IPv6LL") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((6))), 0, "../src/network/networkd-link.c", 3232
, __func__, "Gained IPv6LL"); })
;
3233
3234 link->ipv6ll_address = *address;
3235 link_check_ready(link);
3236
3237 if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_UNMANAGED, LINK_STATE_FAILED)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_PENDING, LINK_STATE_UNMANAGED
, LINK_STATE_FAILED})/sizeof(int)]; switch(link->state) { case
LINK_STATE_PENDING: case LINK_STATE_UNMANAGED: case LINK_STATE_FAILED
: _found = 1; break; default: break; } _found; })
) {
3238 r = link_acquire_ipv6_conf(link);
3239 if (r < 0) {
3240 link_enter_failed(link);
3241 return r;
3242 }
3243 }
3244
3245 return 0;
3246}
3247
3248static int link_carrier_gained(Link *link) {
3249 int r;
3250
3251 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3251, __PRETTY_FUNCTION__); } while (0)
;
3252
3253 if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_UNMANAGED, LINK_STATE_FAILED)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_PENDING, LINK_STATE_UNMANAGED
, LINK_STATE_FAILED})/sizeof(int)]; switch(link->state) { case
LINK_STATE_PENDING: case LINK_STATE_UNMANAGED: case LINK_STATE_FAILED
: _found = 1; break; default: break; } _found; })
) {
3254 r = link_acquire_conf(link);
3255 if (r < 0) {
3256 link_enter_failed(link);
3257 return r;
3258 }
3259
3260 r = link_enter_set_addresses(link);
3261 if (r < 0)
3262 return r;
3263 }
3264
3265 r = link_handle_bound_by_list(link);
3266 if (r < 0)
3267 return r;
3268
3269 return 0;
3270}
3271
3272static int link_carrier_lost(Link *link) {
3273 int r;
3274
3275 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3275, __PRETTY_FUNCTION__); } while (0)
;
3276
3277 /* Some devices reset itself while setting the MTU. This causes the DHCP client fall into a loop.
3278 setting_mtu keep track whether the device got reset because of setting MTU and does not drop the
3279 configuration and stop the clients as well. */
3280 if (link->setting_mtu)
3281 return 0;
3282
3283 r = link_stop_clients(link);
3284 if (r < 0) {
3285 link_enter_failed(link);
3286 return r;
3287 }
3288
3289 if (link_dhcp4_server_enabled(link))
3290 (void) sd_dhcp_server_stop(link->dhcp_server);
3291
3292 r = link_drop_config(link);
3293 if (r < 0)
3294 return r;
3295
3296 if (!IN_SET(link->state, LINK_STATE_UNMANAGED, LINK_STATE_PENDING)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended
[20 - sizeof((int[]){LINK_STATE_UNMANAGED, LINK_STATE_PENDING
})/sizeof(int)]; switch(link->state) { case LINK_STATE_UNMANAGED
: case LINK_STATE_PENDING: _found = 1; break; default: break;
} _found; })
) {
3297 log_link_debug(link, "State is %s, dropping config", link_state_to_string(link->state))({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3297, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "State is %s, dropping config", link_state_to_string
(link->state)) : log_internal_realm(((LOG_REALM_SYSTEMD) <<
10 | ((7))), 0, "../src/network/networkd-link.c", 3297, __func__
, "State is %s, dropping config", link_state_to_string(link->
state)); })
;
3298 r = link_drop_foreign_config(link);
3299 if (r < 0)
3300 return r;
3301 }
3302
3303 r = link_handle_bound_by_list(link);
3304 if (r < 0)
3305 return r;
3306
3307 return 0;
3308}
3309
3310int link_carrier_reset(Link *link) {
3311 int r;
3312
3313 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3313, __PRETTY_FUNCTION__); } while (0)
;
3314
3315 if (link_has_carrier(link)) {
3316 r = link_carrier_lost(link);
3317 if (r < 0)
3318 return r;
3319
3320 r = link_carrier_gained(link);
3321 if (r < 0)
3322 return r;
3323
3324 log_link_info(link, "Reset carrier")({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 3324, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Reset carrier") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((6))), 0, "../src/network/networkd-link.c", 3324
, __func__, "Reset carrier"); })
;
3325 }
3326
3327 return 0;
3328}
3329
3330int link_update(Link *link, sd_netlink_message *m) {
3331 struct ether_addr mac;
3332 const char *ifname;
3333 uint32_t mtu;
3334 bool_Bool had_carrier, carrier_gained, carrier_lost;
3335 int r;
3336
3337 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3337, __PRETTY_FUNCTION__); } while (0)
;
1
Assuming 'link' is non-null
2
Taking false branch
3
Loop condition is false. Exiting loop
3338 assert(link->ifname)do { if ((__builtin_expect(!!(!(link->ifname)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->ifname"), "../src/network/networkd-link.c"
, 3338, __PRETTY_FUNCTION__); } while (0)
;
4
Assuming field 'ifname' is non-null
5
Taking false branch
6
Loop condition is false. Exiting loop
3339 assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("m"), "../src/network/networkd-link.c", 3339
, __PRETTY_FUNCTION__); } while (0)
;
7
Assuming 'm' is non-null
8
Taking false branch
9
Loop condition is false. Exiting loop
3340
3341 if (link->state == LINK_STATE_LINGER) {
10
Assuming field 'state' is not equal to LINK_STATE_LINGER
11
Taking false branch
3342 link_ref(link);
3343 log_link_info(link, "Link readded")({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 3343, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Link readded") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((6))), 0, "../src/network/networkd-link.c", 3343
, __func__, "Link readded"); })
;
3344 link_set_state(link, LINK_STATE_ENSLAVING);
3345
3346 r = link_new_carrier_maps(link);
3347 if (r < 0)
3348 return r;
3349 }
3350
3351 r = sd_netlink_message_read_string(m, IFLA_IFNAME, &ifname);
3352 if (r >= 0 && !streq(ifname, link->ifname)(strcmp((ifname),(link->ifname)) == 0)) {
12
Assuming 'r' is >= 0
13
Assuming the condition is false
14
Taking true branch
3353 log_link_info(link, "Interface name change detected, %s has been renamed to %s.", link->ifname, ifname)({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 3353, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Interface name change detected, %s has been renamed to %s."
, link->ifname, ifname) : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((6))), 0, "../src/network/networkd-link.c", 3353
, __func__, "Interface name change detected, %s has been renamed to %s."
, link->ifname, ifname); })
;
15
'?' condition is true
3354
3355 if (link->state == LINK_STATE_PENDING) {
16
Assuming field 'state' is not equal to LINK_STATE_PENDING
17
Taking false branch
3356 r = free_and_strdup(&link->ifname, ifname);
3357 if (r < 0)
3358 return r;
3359 } else {
3360 Manager *manager = link->manager;
3361
3362 link_drop(link);
3363 r = link_add(manager, m, &link);
18
Calling 'link_add'
3364 if (r < 0)
3365 return r;
3366 }
3367 }
3368
3369 r = sd_netlink_message_read_u32(m, IFLA_MTU, &mtu);
3370 if (r >= 0 && mtu > 0) {
3371 link->mtu = mtu;
3372 if (link->original_mtu == 0) {
3373 link->original_mtu = mtu;
3374 log_link_debug(link, "Saved original MTU: %" PRIu32, link->original_mtu)({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3374, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Saved original MTU: %" "u", link->original_mtu)
: log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((7)
)), 0, "../src/network/networkd-link.c", 3374, __func__, "Saved original MTU: %"
"u", link->original_mtu); })
;
3375 }
3376
3377 if (link->dhcp_client) {
3378 r = sd_dhcp_client_set_mtu(link->dhcp_client,
3379 link->mtu);
3380 if (r < 0) {
3381 log_link_warning_errno(link, r, "Could not update MTU in DHCP client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3381, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update MTU in DHCP client: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 3381, __func__, "Could not update MTU in DHCP client: %m");
})
;
3382 return r;
3383 }
3384 }
3385
3386 if (link->radv) {
3387 r = sd_radv_set_mtu(link->radv, link->mtu);
3388 if (r < 0)
3389 return log_link_warning_errno(link, r, "Could not set MTU for Router Advertisement: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3389, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not set MTU for Router Advertisement: %m") :
log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4)))
, r, "../src/network/networkd-link.c", 3389, __func__, "Could not set MTU for Router Advertisement: %m"
); })
;
3390 }
3391 }
3392
3393 /* The kernel may broadcast NEWLINK messages without the MAC address
3394 set, simply ignore them. */
3395 r = sd_netlink_message_read_ether_addr(m, IFLA_ADDRESS, &mac);
3396 if (r >= 0) {
3397 if (memcmp(link->mac.ether_addr_octet, mac.ether_addr_octet,
3398 ETH_ALEN6)) {
3399
3400 memcpy(link->mac.ether_addr_octet, mac.ether_addr_octet,
3401 ETH_ALEN6);
3402
3403 log_link_debug(link, "MAC address: "({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
3404 "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
3405 mac.ether_addr_octet[0],({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
3406 mac.ether_addr_octet[1],({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
3407 mac.ether_addr_octet[2],({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
3408 mac.ether_addr_octet[3],({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
3409 mac.ether_addr_octet[4],({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
3410 mac.ether_addr_octet[5])({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3410, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "MAC address: " "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
, mac.ether_addr_octet[0], mac.ether_addr_octet[1], mac.ether_addr_octet
[2], mac.ether_addr_octet[3], mac.ether_addr_octet[4], mac.ether_addr_octet
[5]) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | (
(7))), 0, "../src/network/networkd-link.c", 3410, __func__, "MAC address: "
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", mac.ether_addr_octet
[0], mac.ether_addr_octet[1], mac.ether_addr_octet[2], mac.ether_addr_octet
[3], mac.ether_addr_octet[4], mac.ether_addr_octet[5]); })
;
3411
3412 if (link->ipv4ll) {
3413 r = sd_ipv4ll_set_mac(link->ipv4ll, &link->mac);
3414 if (r < 0)
3415 return log_link_warning_errno(link, r, "Could not update MAC address in IPv4LL client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3415, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update MAC address in IPv4LL client: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 3415, __func__, "Could not update MAC address in IPv4LL client: %m"
); })
;
3416 }
3417
3418 if (link->dhcp_client) {
3419 r = sd_dhcp_client_set_mac(link->dhcp_client,
3420 (const uint8_t *) &link->mac,
3421 sizeof (link->mac),
3422 ARPHRD_ETHER1);
3423 if (r < 0)
3424 return log_link_warning_errno(link, r, "Could not update MAC address in DHCP client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3424, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update MAC address in DHCP client: %m") :
log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4)))
, r, "../src/network/networkd-link.c", 3424, __func__, "Could not update MAC address in DHCP client: %m"
); })
;
3425
3426 switch (link->network->dhcp_client_identifier) {
3427 case DHCP_CLIENT_ID_DUID: {
3428 const DUID *duid = link_duid(link);
3429
3430 r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
3431 link->network->iaid,
3432 duid->type,
3433 duid->raw_data_len > 0 ? duid->raw_data : NULL((void*)0),
3434 duid->raw_data_len);
3435 if (r < 0)
3436 return log_link_warning_errno(link, r, "Could not update DUID/IAID in DHCP client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3436, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update DUID/IAID in DHCP client: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 3436, __func__, "Could not update DUID/IAID in DHCP client: %m"
); })
;
3437 break;
3438 }
3439 case DHCP_CLIENT_ID_DUID_ONLY: {
3440 const DUID *duid = link_duid(link);
3441
3442 r = sd_dhcp_client_set_duid(link->dhcp_client,
3443 duid->type,
3444 duid->raw_data_len > 0 ? duid->raw_data : NULL((void*)0),
3445 duid->raw_data_len);
3446 if (r < 0)
3447 return log_link_warning_errno(link, r, "Could not update DUID in DHCP client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3447, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update DUID in DHCP client: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 3447, __func__, "Could not update DUID in DHCP client: %m")
; })
;
3448 break;
3449 }
3450 case DHCP_CLIENT_ID_MAC:
3451 r = sd_dhcp_client_set_client_id(link->dhcp_client,
3452 ARPHRD_ETHER1,
3453 (const uint8_t *)&link->mac,
3454 sizeof(link->mac));
3455 if (r < 0)
3456 return log_link_warning_errno(link, r, "Could not update MAC client id in DHCP client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3456, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update MAC client id in DHCP client: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 3456, __func__, "Could not update MAC client id in DHCP client: %m"
); })
;
3457 break;
3458 default:
3459 assert_not_reached("Unknown client identifier type.")do { log_assert_failed_unreachable_realm(LOG_REALM_SYSTEMD, (
"Unknown client identifier type."), "../src/network/networkd-link.c"
, 3459, __PRETTY_FUNCTION__); } while (0)
;
3460 }
3461 }
3462
3463 if (link->dhcp6_client) {
3464 const DUID* duid = link_duid(link);
3465
3466 r = sd_dhcp6_client_set_mac(link->dhcp6_client,
3467 (const uint8_t *) &link->mac,
3468 sizeof (link->mac),
3469 ARPHRD_ETHER1);
3470 if (r < 0)
3471 return log_link_warning_errno(link, r, "Could not update MAC address in DHCPv6 client: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3471, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update MAC address in DHCPv6 client: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 3471, __func__, "Could not update MAC address in DHCPv6 client: %m"
); })
;
3472
3473 r = sd_dhcp6_client_set_iaid(link->dhcp6_client,
3474 link->network->iaid);
3475 if (r < 0)
3476 return log_link_warning_errno(link, r, "Could not update DHCPv6 IAID: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3476, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update DHCPv6 IAID: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 3476, __func__, "Could not update DHCPv6 IAID: %m"); })
;
3477
3478 r = sd_dhcp6_client_set_duid(link->dhcp6_client,
3479 duid->type,
3480 duid->raw_data_len > 0 ? duid->raw_data : NULL((void*)0),
3481 duid->raw_data_len);
3482 if (r < 0)
3483 return log_link_warning_errno(link, r, "Could not update DHCPv6 DUID: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3483, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update DHCPv6 DUID: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 3483, __func__, "Could not update DHCPv6 DUID: %m"); })
;
3484 }
3485
3486 if (link->radv) {
3487 r = sd_radv_set_mac(link->radv, &link->mac);
3488 if (r < 0)
3489 return log_link_warning_errno(link, r, "Could not update MAC for Router Advertisement: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3489, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update MAC for Router Advertisement: %m"
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((4
))), r, "../src/network/networkd-link.c", 3489, __func__, "Could not update MAC for Router Advertisement: %m"
); })
;
3490 }
3491
3492 if (link->ndisc) {
3493 r = sd_ndisc_set_mac(link->ndisc, &link->mac);
3494 if (r < 0)
3495 return log_link_warning_errno(link, r, "Could not update MAC for ndisc: %m")({ const Link *_l = (link); _l ? log_object_internal(4, r, "../src/network/networkd-link.c"
, 3495, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Could not update MAC for ndisc: %m") : log_internal_realm
(((LOG_REALM_SYSTEMD) << 10 | ((4))), r, "../src/network/networkd-link.c"
, 3495, __func__, "Could not update MAC for ndisc: %m"); })
;
3496 }
3497 }
3498 }
3499
3500 had_carrier = link_has_carrier(link);
3501
3502 r = link_update_flags(link, m);
3503 if (r < 0)
3504 return r;
3505
3506 r = link_update_lldp(link);
3507 if (r < 0)
3508 return r;
3509
3510 carrier_gained = !had_carrier && link_has_carrier(link);
3511 carrier_lost = had_carrier && !link_has_carrier(link);
3512
3513 if (carrier_gained) {
3514 log_link_info(link, "Gained carrier")({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 3514, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Gained carrier") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((6))), 0, "../src/network/networkd-link.c", 3514
, __func__, "Gained carrier"); })
;
3515
3516 r = link_carrier_gained(link);
3517 if (r < 0)
3518 return r;
3519 } else if (carrier_lost) {
3520 log_link_info(link, "Lost carrier")({ const Link *_l = (link); _l ? log_object_internal(6, 0, "../src/network/networkd-link.c"
, 3520, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Lost carrier") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((6))), 0, "../src/network/networkd-link.c", 3520
, __func__, "Lost carrier"); })
;
3521
3522 r = link_carrier_lost(link);
3523 if (r < 0)
3524 return r;
3525 }
3526
3527 return 0;
3528}
3529
3530static void print_link_hashmap(FILE *f, const char *prefix, Hashmap* h) {
3531 bool_Bool space = false0;
3532 Iterator i;
3533 Link *link;
3534
3535 assert(f)do { if ((__builtin_expect(!!(!(f)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("f"), "../src/network/networkd-link.c", 3535
, __PRETTY_FUNCTION__); } while (0)
;
3536 assert(prefix)do { if ((__builtin_expect(!!(!(prefix)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("prefix"), "../src/network/networkd-link.c"
, 3536, __PRETTY_FUNCTION__); } while (0)
;
3537
3538 if (hashmap_isempty(h))
3539 return;
3540
3541 fputs(prefix, f);
3542 HASHMAP_FOREACH(link, h, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); hashmap_iterate((h), &(i), (void
**)&(link), ((void*)0)); )
{
3543 if (space)
3544 fputc(' ', f);
3545
3546 fprintf(f, "%i", link->ifindex);
3547 space = true1;
3548 }
3549
3550 fputc('\n', f);
3551}
3552
3553int link_save(Link *link) {
3554 _cleanup_free___attribute__((cleanup(freep))) char *temp_path = NULL((void*)0);
3555 _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0);
3556 const char *admin_state, *oper_state;
3557 Address *a;
3558 Route *route;
3559 Iterator i;
3560 int r;
3561
3562 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3562, __PRETTY_FUNCTION__); } while (0)
;
3563 assert(link->state_file)do { if ((__builtin_expect(!!(!(link->state_file)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->state_file"), "../src/network/networkd-link.c"
, 3563, __PRETTY_FUNCTION__); } while (0)
;
3564 assert(link->lease_file)do { if ((__builtin_expect(!!(!(link->lease_file)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->lease_file"), "../src/network/networkd-link.c"
, 3564, __PRETTY_FUNCTION__); } while (0)
;
3565 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 3565, __PRETTY_FUNCTION__); } while (0)
;
3566
3567 if (link->state == LINK_STATE_LINGER) {
3568 unlink(link->state_file);
3569 return 0;
3570 }
3571
3572 link_lldp_save(link);
3573
3574 admin_state = link_state_to_string(link->state);
3575 assert(admin_state)do { if ((__builtin_expect(!!(!(admin_state)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("admin_state"), "../src/network/networkd-link.c"
, 3575, __PRETTY_FUNCTION__); } while (0)
;
3576
3577 oper_state = link_operstate_to_string(link->operstate);
3578 assert(oper_state)do { if ((__builtin_expect(!!(!(oper_state)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("oper_state"), "../src/network/networkd-link.c"
, 3578, __PRETTY_FUNCTION__); } while (0)
;
3579
3580 r = fopen_temporary(link->state_file, &f, &temp_path);
3581 if (r < 0)
3582 goto fail;
3583
3584 (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER);
3585 (void) fchmod(fileno(f), 0644);
3586
3587 fprintf(f,
3588 "# This is private data. Do not parse.\n"
3589 "ADMIN_STATE=%s\n"
3590 "OPER_STATE=%s\n",
3591 admin_state, oper_state);
3592
3593 if (link->network) {
3594 bool_Bool space;
3595 sd_dhcp6_lease *dhcp6_lease = NULL((void*)0);
3596 const char *dhcp_domainname = NULL((void*)0);
3597 char **dhcp6_domains = NULL((void*)0);
3598 char **dhcp_domains = NULL((void*)0);
3599 unsigned j;
3600
3601 fprintf(f, "REQUIRED_FOR_ONLINE=%s\n",
3602 yes_no(link->network->required_for_online));
3603
3604 if (link->dhcp6_client) {
3605 r = sd_dhcp6_client_get_lease(link->dhcp6_client, &dhcp6_lease);
3606 if (r < 0 && r != -ENOMSG42)
3607 log_link_debug(link, "No DHCPv6 lease")({ const Link *_l = (link); _l ? log_object_internal(7, 0, "../src/network/networkd-link.c"
, 3607, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "No DHCPv6 lease") : log_internal_realm(((LOG_REALM_SYSTEMD
) << 10 | ((7))), 0, "../src/network/networkd-link.c", 3607
, __func__, "No DHCPv6 lease"); })
;
3608 }
3609
3610 fprintf(f, "NETWORK_FILE=%s\n", link->network->filename);
3611
3612 fputs("DNS=", f);
3613 space = false0;
3614
3615 for (j = 0; j < link->network->n_dns; j++) {
3616 _cleanup_free___attribute__((cleanup(freep))) char *b = NULL((void*)0);
3617
3618 r = in_addr_to_string(link->network->dns[j].family,
3619 &link->network->dns[j].address, &b);
3620 if (r < 0) {
3621 log_debug_errno(r, "Failed to format address, ignoring: %m")({ int _level = ((7)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD
); (log_get_max_level_realm(_realm) >= ((_level) & 0x07
)) ? log_internal_realm(((_realm) << 10 | (_level)), _e
, "../src/network/networkd-link.c", 3621, __func__, "Failed to format address, ignoring: %m"
) : -abs(_e); })
;
3622 continue;
3623 }
3624
3625 if (space)
3626 fputc(' ', f);
3627 fputs(b, f);
3628 space = true1;
3629 }
3630
3631 if (link->network->dhcp_use_dns &&
3632 link->dhcp_lease) {
3633 const struct in_addr *addresses;
3634
3635 r = sd_dhcp_lease_get_dns(link->dhcp_lease, &addresses);
3636 if (r > 0) {
3637 if (space)
3638 fputc(' ', f);
3639 serialize_in_addrs(f, addresses, r);
3640 space = true1;
3641 }
3642 }
3643
3644 if (link->network->dhcp_use_dns && dhcp6_lease) {
3645 struct in6_addr *in6_addrs;
3646
3647 r = sd_dhcp6_lease_get_dns(dhcp6_lease, &in6_addrs);
3648 if (r > 0) {
3649 if (space)
3650 fputc(' ', f);
3651 serialize_in6_addrs(f, in6_addrs, r);
3652 space = true1;
3653 }
3654 }
3655
3656 /* Make sure to flush out old entries before we use the NDISC data */
3657 ndisc_vacuum(link);
3658
3659 if (link->network->ipv6_accept_ra_use_dns && link->ndisc_rdnss) {
3660 NDiscRDNSS *dd;
3661
3662 SET_FOREACH(dd, link->ndisc_rdnss, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->ndisc_rdnss),
&(i), (void**)&(dd)); )
{
3663 if (space)
3664 fputc(' ', f);
3665
3666 serialize_in6_addrs(f, &dd->address, 1);
3667 space = true1;
3668 }
3669 }
3670
3671 fputc('\n', f);
3672
3673 fputs("NTP=", f);
3674 space = false0;
3675 fputstrv(f, link->network->ntp, NULL((void*)0), &space);
3676
3677 if (link->network->dhcp_use_ntp &&
3678 link->dhcp_lease) {
3679 const struct in_addr *addresses;
3680
3681 r = sd_dhcp_lease_get_ntp(link->dhcp_lease, &addresses);
3682 if (r > 0) {
3683 if (space)
3684 fputc(' ', f);
3685 serialize_in_addrs(f, addresses, r);
3686 space = true1;
3687 }
3688 }
3689
3690 if (link->network->dhcp_use_ntp && dhcp6_lease) {
3691 struct in6_addr *in6_addrs;
3692 char **hosts;
3693
3694 r = sd_dhcp6_lease_get_ntp_addrs(dhcp6_lease,
3695 &in6_addrs);
3696 if (r > 0) {
3697 if (space)
3698 fputc(' ', f);
3699 serialize_in6_addrs(f, in6_addrs, r);
3700 space = true1;
3701 }
3702
3703 r = sd_dhcp6_lease_get_ntp_fqdn(dhcp6_lease, &hosts);
3704 if (r > 0)
3705 fputstrv(f, hosts, NULL((void*)0), &space);
3706 }
3707
3708 fputc('\n', f);
3709
3710 if (link->network->dhcp_use_domains != DHCP_USE_DOMAINS_NO) {
3711 if (link->dhcp_lease) {
3712 (void) sd_dhcp_lease_get_domainname(link->dhcp_lease, &dhcp_domainname);
3713 (void) sd_dhcp_lease_get_search_domains(link->dhcp_lease, &dhcp_domains);
3714 }
3715 if (dhcp6_lease)
3716 (void) sd_dhcp6_lease_get_domains(dhcp6_lease, &dhcp6_domains);
3717 }
3718
3719 fputs("DOMAINS=", f);
3720 space = false0;
3721 fputstrv(f, link->network->search_domains, NULL((void*)0), &space);
3722
3723 if (link->network->dhcp_use_domains == DHCP_USE_DOMAINS_YES) {
3724 NDiscDNSSL *dd;
3725
3726 if (dhcp_domainname)
3727 fputs_with_space(f, dhcp_domainname, NULL((void*)0), &space);
3728 if (dhcp_domains)
3729 fputstrv(f, dhcp_domains, NULL((void*)0), &space);
3730 if (dhcp6_domains)
3731 fputstrv(f, dhcp6_domains, NULL((void*)0), &space);
3732
3733 SET_FOREACH(dd, link->ndisc_dnssl, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->ndisc_dnssl),
&(i), (void**)&(dd)); )
3734 fputs_with_space(f, NDISC_DNSSL_DOMAIN(dd), NULL((void*)0), &space);
3735 }
3736
3737 fputc('\n', f);
3738
3739 fputs("ROUTE_DOMAINS=", f);
3740 space = false0;
3741 fputstrv(f, link->network->route_domains, NULL((void*)0), &space);
3742
3743 if (link->network->dhcp_use_domains == DHCP_USE_DOMAINS_ROUTE) {
3744 NDiscDNSSL *dd;
3745
3746 if (dhcp_domainname)
3747 fputs_with_space(f, dhcp_domainname, NULL((void*)0), &space);
3748 if (dhcp_domains)
3749 fputstrv(f, dhcp_domains, NULL((void*)0), &space);
3750 if (dhcp6_domains)
3751 fputstrv(f, dhcp6_domains, NULL((void*)0), &space);
3752
3753 SET_FOREACH(dd, link->ndisc_dnssl, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->ndisc_dnssl),
&(i), (void**)&(dd)); )
3754 fputs_with_space(f, NDISC_DNSSL_DOMAIN(dd), NULL((void*)0), &space);
3755 }
3756
3757 fputc('\n', f);
3758
3759 fprintf(f, "LLMNR=%s\n",
3760 resolve_support_to_string(link->network->llmnr));
3761 fprintf(f, "MDNS=%s\n",
3762 resolve_support_to_string(link->network->mdns));
3763
3764 if (link->network->dns_over_tls_mode != _DNS_OVER_TLS_MODE_INVALID)
3765 fprintf(f, "DNS_OVER_TLS=%s\n",
3766 dns_over_tls_mode_to_string(link->network->dns_over_tls_mode));
3767
3768 if (link->network->dnssec_mode != _DNSSEC_MODE_INVALID)
3769 fprintf(f, "DNSSEC=%s\n",
3770 dnssec_mode_to_string(link->network->dnssec_mode));
3771
3772 if (!set_isempty(link->network->dnssec_negative_trust_anchors)) {
3773 const char *n;
3774
3775 fputs("DNSSEC_NTA=", f);
3776 space = false0;
3777 SET_FOREACH(n, link->network->dnssec_negative_trust_anchors, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->network->dnssec_negative_trust_anchors
), &(i), (void**)&(n)); )
3778 fputs_with_space(f, n, NULL((void*)0), &space);
3779 fputc('\n', f);
3780 }
3781
3782 fputs("ADDRESSES=", f);
3783 space = false0;
3784 SET_FOREACH(a, link->addresses, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->addresses), &
(i), (void**)&(a)); )
{
3785 _cleanup_free___attribute__((cleanup(freep))) char *address_str = NULL((void*)0);
3786
3787 r = in_addr_to_string(a->family, &a->in_addr, &address_str);
3788 if (r < 0)
3789 goto fail;
3790
3791 fprintf(f, "%s%s/%u", space ? " " : "", address_str, a->prefixlen);
3792 space = true1;
3793 }
3794 fputc('\n', f);
3795
3796 fputs("ROUTES=", f);
3797 space = false0;
3798 SET_FOREACH(route, link->routes, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), .
next_key = ((void*)0) }); set_iterate((link->routes), &
(i), (void**)&(route)); )
{
3799 _cleanup_free___attribute__((cleanup(freep))) char *route_str = NULL((void*)0);
3800
3801 r = in_addr_to_string(route->family, &route->dst, &route_str);
3802 if (r < 0)
3803 goto fail;
3804
3805 fprintf(f, "%s%s/%hhu/%hhu/%"PRIu32"u""/%"PRIu32"u""/"USEC_FMT"%" "l" "u",
3806 space ? " " : "", route_str,
3807 route->dst_prefixlen, route->tos, route->priority, route->table, route->lifetime);
3808 space = true1;
3809 }
3810
3811 fputc('\n', f);
3812 }
3813
3814 print_link_hashmap(f, "CARRIER_BOUND_TO=", link->bound_to_links);
3815 print_link_hashmap(f, "CARRIER_BOUND_BY=", link->bound_by_links);
3816
3817 if (link->dhcp_lease) {
3818 struct in_addr address;
3819 const char *tz = NULL((void*)0);
3820
3821 assert(link->network)do { if ((__builtin_expect(!!(!(link->network)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->network"), "../src/network/networkd-link.c"
, 3821, __PRETTY_FUNCTION__); } while (0)
;
3822
3823 r = sd_dhcp_lease_get_timezone(link->dhcp_lease, &tz);
3824 if (r >= 0)
3825 fprintf(f, "TIMEZONE=%s\n", tz);
3826
3827 r = sd_dhcp_lease_get_address(link->dhcp_lease, &address);
3828 if (r >= 0) {
3829 fputs("DHCP4_ADDRESS=", f);
3830 serialize_in_addrs(f, &address, 1);
3831 fputc('\n', f);
3832 }
3833
3834 r = dhcp_lease_save(link->dhcp_lease, link->lease_file);
3835 if (r < 0)
3836 goto fail;
3837
3838 fprintf(f,
3839 "DHCP_LEASE=%s\n",
3840 link->lease_file);
3841 } else
3842 unlink(link->lease_file);
3843
3844 if (link->ipv4ll) {
3845 struct in_addr address;
3846
3847 r = sd_ipv4ll_get_address(link->ipv4ll, &address);
3848 if (r >= 0) {
3849 fputs("IPV4LL_ADDRESS=", f);
3850 serialize_in_addrs(f, &address, 1);
3851 fputc('\n', f);
3852 }
3853 }
3854
3855 r = fflush_and_check(f);
3856 if (r < 0)
3857 goto fail;
3858
3859 if (rename(temp_path, link->state_file) < 0) {
3860 r = -errno(*__errno_location ());
3861 goto fail;
3862 }
3863
3864 return 0;
3865
3866fail:
3867 (void) unlink(link->state_file);
3868 if (temp_path)
3869 (void) unlink(temp_path);
3870
3871 return log_link_error_errno(link, r, "Failed to save link data to %s: %m", link->state_file)({ const Link *_l = (link); _l ? log_object_internal(3, r, "../src/network/networkd-link.c"
, 3871, __func__, "INTERFACE=", _l->ifname, ((void*)0), ((
void*)0), "Failed to save link data to %s: %m", link->state_file
) : log_internal_realm(((LOG_REALM_SYSTEMD) << 10 | ((3
))), r, "../src/network/networkd-link.c", 3871, __func__, "Failed to save link data to %s: %m"
, link->state_file); })
;
3872}
3873
3874/* The serialized state in /run is no longer up-to-date. */
3875void link_dirty(Link *link) {
3876 int r;
3877
3878 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3878, __PRETTY_FUNCTION__); } while (0)
;
3879
3880 /* mark manager dirty as link is dirty */
3881 manager_dirty(link->manager);
3882
3883 r = set_ensure_allocated(&link->manager->dirty_links, NULL)internal_set_ensure_allocated(&link->manager->dirty_links
, ((void*)0) )
;
3884 if (r < 0)
3885 /* allocation errors are ignored */
3886 return;
3887
3888 r = set_put(link->manager->dirty_links, link);
3889 if (r <= 0)
3890 /* don't take another ref if the link was already dirty */
3891 return;
3892
3893 link_ref(link);
3894}
3895
3896/* The serialized state in /run is up-to-date */
3897void link_clean(Link *link) {
3898 assert(link)do { if ((__builtin_expect(!!(!(link)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link"), "../src/network/networkd-link.c"
, 3898, __PRETTY_FUNCTION__); } while (0)
;
3899 assert(link->manager)do { if ((__builtin_expect(!!(!(link->manager)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("link->manager"), "../src/network/networkd-link.c"
, 3899, __PRETTY_FUNCTION__); } while (0)
;
3900
3901 set_remove(link->manager->dirty_links, link);
3902 link_unref(link);
3903}
3904
3905static const char* const link_state_table[_LINK_STATE_MAX] = {
3906 [LINK_STATE_PENDING] = "pending",
3907 [LINK_STATE_ENSLAVING] = "configuring",
3908 [LINK_STATE_SETTING_ADDRESSES] = "configuring",
3909 [LINK_STATE_SETTING_ROUTES] = "configuring",
3910 [LINK_STATE_CONFIGURED] = "configured",
3911 [LINK_STATE_UNMANAGED] = "unmanaged",
3912 [LINK_STATE_FAILED] = "failed",
3913 [LINK_STATE_LINGER] = "linger",
3914};
3915
3916DEFINE_STRING_TABLE_LOOKUP(link_state, LinkState)const char *link_state_to_string(LinkState i) { if (i < 0 ||
i >= (LinkState) __extension__ (__builtin_choose_expr( !__builtin_types_compatible_p
(typeof(link_state_table), typeof(&*(link_state_table))),
sizeof(link_state_table)/sizeof((link_state_table)[0]), ((void
)0)))) return ((void*)0); return link_state_table[i]; } LinkState
link_state_from_string(const char *s) { return (LinkState) string_table_lookup
(link_state_table, __extension__ (__builtin_choose_expr( !__builtin_types_compatible_p
(typeof(link_state_table), typeof(&*(link_state_table))),
sizeof(link_state_table)/sizeof((link_state_table)[0]), ((void
)0))), s); }
;
3917
3918static const char* const link_operstate_table[_LINK_OPERSTATE_MAX] = {
3919 [LINK_OPERSTATE_OFF] = "off",
3920 [LINK_OPERSTATE_NO_CARRIER] = "no-carrier",
3921 [LINK_OPERSTATE_DORMANT] = "dormant",
3922 [LINK_OPERSTATE_CARRIER] = "carrier",
3923 [LINK_OPERSTATE_DEGRADED] = "degraded",
3924 [LINK_OPERSTATE_ROUTABLE] = "routable",
3925};
3926
3927DEFINE_STRING_TABLE_LOOKUP(link_operstate, LinkOperationalState)const char *link_operstate_to_string(LinkOperationalState i) {
if (i < 0 || i >= (LinkOperationalState) __extension__
(__builtin_choose_expr( !__builtin_types_compatible_p(typeof
(link_operstate_table), typeof(&*(link_operstate_table)))
, sizeof(link_operstate_table)/sizeof((link_operstate_table)[
0]), ((void)0)))) return ((void*)0); return link_operstate_table
[i]; } LinkOperationalState link_operstate_from_string(const char
*s) { return (LinkOperationalState) string_table_lookup(link_operstate_table
, __extension__ (__builtin_choose_expr( !__builtin_types_compatible_p
(typeof(link_operstate_table), typeof(&*(link_operstate_table
))), sizeof(link_operstate_table)/sizeof((link_operstate_table
)[0]), ((void)0))), s); }
;