Lines Matching refs:link
24 #include "networkd-link.h"
26 static int ipv4ll_address_lost(Link *link) {
32 assert(link);
34 link->ipv4ll_route = false;
35 link->ipv4ll_address = false;
37 r = sd_ipv4ll_get_address(link->ipv4ll, &addr);
41 log_link_debug(link, "IPv4 link-local release %u.%u.%u.%u", ADDRESS_FMT_VAL(addr));
45 log_link_error_errno(link, r, "Could not allocate address: %m");
54 address_remove(address, link, &link_address_remove_handler);
58 log_link_error_errno(link, r, "Could not allocate route: %m");
66 route_remove(route, link, &link_route_remove_handler);
68 link_check_ready(link);
74 _cleanup_link_unref_ Link *link = userdata;
77 assert(link);
78 assert(!link->ipv4ll_route);
82 log_link_error_errno(link, r, "could not set ipv4ll route: %m");
83 link_enter_failed(link);
86 link->ipv4ll_route = true;
88 if (link->ipv4ll_address == true)
89 link_check_ready(link);
95 _cleanup_link_unref_ Link *link = userdata;
98 assert(link);
99 assert(!link->ipv4ll_address);
103 log_link_error_errno(link, r, "could not set ipv4ll address: %m");
104 link_enter_failed(link);
106 manager_rtnl_process_address(rtnl, m, link->manager);
108 link->ipv4ll_address = true;
110 if (link->ipv4ll_route == true)
111 link_check_ready(link);
116 static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) {
123 assert(link);
131 log_link_debug(link, "IPv4 link-local claim %u.%u.%u.%u",
144 r = address_configure(ll_addr, link, ipv4ll_address_handler, false);
148 link->ipv4ll_address = false;
159 r = route_configure(route, link, ipv4ll_route_handler);
163 link->ipv4ll_route = false;
169 Link *link = userdata;
172 assert(link);
173 assert(link->network);
174 assert(link->manager);
176 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
182 r = ipv4ll_address_lost(link);
184 link_enter_failed(link);
189 r = ipv4ll_address_claimed(ll, link);
191 link_enter_failed(link);
196 log_link_warning(link, "IPv4 link-local unknown event: %d", event);
201 int ipv4ll_configure(Link *link) {
205 assert(link);
206 assert(link->network);
207 assert(link->network->link_local & ADDRESS_FAMILY_IPV4);
209 if (!link->ipv4ll) {
210 r = sd_ipv4ll_new(&link->ipv4ll);
215 if (link->udev_device) {
216 r = net_get_unique_predictable_data(link->udev_device, &seed);
220 r = sd_ipv4ll_set_address_seed(link->ipv4ll, (unsigned)seed);
226 r = sd_ipv4ll_attach_event(link->ipv4ll, NULL, 0);
230 r = sd_ipv4ll_set_mac(link->ipv4ll, &link->mac);
234 r = sd_ipv4ll_set_index(link->ipv4ll, link->ifindex);
238 r = sd_ipv4ll_set_callback(link->ipv4ll, ipv4ll_handler, link);