Lines Matching defs:link

26 #include "networkd-link.h"
29 _cleanup_link_unref_ Link *link = userdata;
32 assert(link);
33 assert(link->ndisc_messages > 0);
35 link->ndisc_messages --;
39 log_link_error_errno(link, r, "Could not set NDisc route or address: %m");
40 link_enter_failed(link);
43 if (link->ndisc_messages == 0) {
44 link->ndisc_configured = true;
45 link_check_ready(link);
54 Link *link = userdata;
59 assert(link);
60 assert(link->network);
62 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
67 log_link_error_errno(link, r, "Could not allocate address: %m");
71 assert_se(sd_event_now(link->manager->event, clock_boottime_or_monotonic(), &time_now) >= 0);
75 if (in_addr_is_null(AF_INET6, (const union in_addr_union *) &link->network->ipv6_token) == 0)
76 memcpy(((char *)&address->in_addr.in6) + 8, ((char *)&link->network->ipv6_token) + 8, 8);
79 address->in_addr.in6.__in6_u.__u6_addr8[8] = link->mac.ether_addr_octet[0];
81 address->in_addr.in6.__in6_u.__u6_addr8[9] = link->mac.ether_addr_octet[1];
82 address->in_addr.in6.__in6_u.__u6_addr8[10] = link->mac.ether_addr_octet[2];
85 address->in_addr.in6.__in6_u.__u6_addr8[13] = link->mac.ether_addr_octet[3];
86 address->in_addr.in6.__in6_u.__u6_addr8[14] = link->mac.ether_addr_octet[4];
87 address->in_addr.in6.__in6_u.__u6_addr8[15] = link->mac.ether_addr_octet[5];
94 r = address_configure(address, link, ndisc_netlink_handler, true);
96 log_link_warning_errno(link, r, "Could not set SLAAC address: %m");
97 link_enter_failed(link);
101 link->ndisc_messages ++;
106 Link *link = userdata;
111 assert(link);
113 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
118 log_link_error_errno(link, r, "Could not allocate route: %m");
122 assert_se(sd_event_now(link->manager->event, clock_boottime_or_monotonic(), &time_now) >= 0);
132 r = route_configure(route, link, ndisc_netlink_handler);
134 log_link_warning_errno(link, r, "Could not set prefix route: %m");
135 link_enter_failed(link);
139 link->ndisc_messages ++;
144 Link *link = userdata;
148 assert(link);
149 assert(link->network);
150 assert(link->manager);
152 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
157 dhcp6_request_address(link);
159 r = sd_dhcp6_client_start(link->dhcp6_client);
161 log_link_warning_errno(link, r, "Starting DHCPv6 client on NDisc request failed: %m");
169 log_link_error_errno(link, r, "Could not allocate route: %m");
173 assert_se(sd_event_now(link->manager->event, clock_boottime_or_monotonic(), &time_now) >= 0);
182 r = route_configure(route, link, ndisc_netlink_handler);
184 log_link_warning_errno(link, r, "Could not set default route: %m");
185 link_enter_failed(link);
189 link->ndisc_messages ++;
193 Link *link = userdata;
196 assert(link);
198 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
203 dhcp6_request_address(link);
205 r = sd_dhcp6_client_start(link->dhcp6_client);
207 log_link_warning_errno(link, r, "Starting DHCPv6 client after NDisc timeout failed: %m");
209 link->ndisc_configured = true;
210 link_check_ready(link);
216 log_link_warning(link, "IPv6 Neighbor Discovery unknown event: %d", event);
220 int ndisc_configure(Link *link) {
223 assert_return(link, -EINVAL);
225 r = sd_ndisc_new(&link->ndisc_router_discovery);
229 r = sd_ndisc_attach_event(link->ndisc_router_discovery, NULL, 0);
233 r = sd_ndisc_set_mac(link->ndisc_router_discovery, &link->mac);
237 r = sd_ndisc_set_index(link->ndisc_router_discovery, link->ifindex);
241 r = sd_ndisc_set_callback(link->ndisc_router_discovery,
246 link);