Lines Matching refs:link

14 static int address_new_from_ipv4ll(Link *link, Address **ret) {  in address_new_from_ipv4ll()  argument
19 assert(link); in address_new_from_ipv4ll()
20 assert(link->ipv4ll); in address_new_from_ipv4ll()
23 r = sd_ipv4ll_get_address(link->ipv4ll, &addr); in address_new_from_ipv4ll()
37 address_set_broadcast(address, link); in address_new_from_ipv4ll()
43 static int ipv4ll_address_lost(Link *link) { in ipv4ll_address_lost() argument
48 assert(link); in ipv4ll_address_lost()
50 link->ipv4ll_address_configured = false; in ipv4ll_address_lost()
52 r = address_new_from_ipv4ll(link, &address); in ipv4ll_address_lost()
58 if (address_get(link, address, &existing) < 0) in ipv4ll_address_lost()
67 log_link_debug(link, "IPv4 link-local release "IPV4_ADDRESS_FMT_STR, in ipv4ll_address_lost()
73 static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Request *req, Link *link in ipv4ll_address_handler() argument
76 assert(link); in ipv4ll_address_handler()
77 assert(!link->ipv4ll_address_configured); in ipv4ll_address_handler()
79 r = address_configure_handler_internal(rtnl, m, link, "Could not set ipv4ll address"); in ipv4ll_address_handler()
83 link->ipv4ll_address_configured = true; in ipv4ll_address_handler()
84 link_check_ready(link); in ipv4ll_address_handler()
89 static int ipv4ll_address_claimed(sd_ipv4ll *ll, Link *link) { in ipv4ll_address_claimed() argument
94 assert(link); in ipv4ll_address_claimed()
96 link->ipv4ll_address_configured = false; in ipv4ll_address_claimed()
98 r = address_new_from_ipv4ll(link, &address); in ipv4ll_address_claimed()
104 log_link_debug(link, "IPv4 link-local claim "IPV4_ADDRESS_FMT_STR, in ipv4ll_address_claimed()
107 … return link_request_address(link, TAKE_PTR(address), true, NULL, ipv4ll_address_handler, NULL); in ipv4ll_address_claimed()
111 Link *link = userdata; in ipv4ll_handler() local
114 assert(link); in ipv4ll_handler()
115 assert(link->network); in ipv4ll_handler()
117 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER)) in ipv4ll_handler()
122 r = ipv4ll_address_lost(link); in ipv4ll_handler()
124 link_enter_failed(link); in ipv4ll_handler()
129 r = ipv4ll_address_lost(link); in ipv4ll_handler()
131 link_enter_failed(link); in ipv4ll_handler()
137 … log_link_warning_errno(link, r, "Could not acquire IPv4 link-local address: %m"); in ipv4ll_handler()
138 link_enter_failed(link); in ipv4ll_handler()
142 r = ipv4ll_address_claimed(ll, link); in ipv4ll_handler()
144 log_link_error(link, "Failed to configure ipv4ll address: %m"); in ipv4ll_handler()
145 link_enter_failed(link); in ipv4ll_handler()
150 log_link_warning(link, "IPv4 link-local unknown event: %d", event); in ipv4ll_handler()
170 int ipv4ll_configure(Link *link) { in ipv4ll_configure() argument
174 assert(link); in ipv4ll_configure()
176 if (!link_ipv4ll_enabled(link)) in ipv4ll_configure()
179 if (link->ipv4ll) in ipv4ll_configure()
182 r = sd_ipv4ll_new(&link->ipv4ll); in ipv4ll_configure()
186 r = sd_ipv4ll_attach_event(link->ipv4ll, link->manager->event, 0); in ipv4ll_configure()
190 if (link->sd_device && in ipv4ll_configure()
191 net_get_unique_predictable_data(link->sd_device, true, &seed) >= 0) { in ipv4ll_configure()
192 r = sd_ipv4ll_set_address_seed(link->ipv4ll, seed); in ipv4ll_configure()
197 r = sd_ipv4ll_set_mac(link->ipv4ll, &link->hw_addr.ether); in ipv4ll_configure()
201 r = sd_ipv4ll_set_ifindex(link->ipv4ll, link->ifindex); in ipv4ll_configure()
205 r = sd_ipv4ll_set_callback(link->ipv4ll, ipv4ll_handler, link); in ipv4ll_configure()
209 return sd_ipv4ll_set_check_mac_callback(link->ipv4ll, ipv4ll_check_mac, link->manager); in ipv4ll_configure()
212 int ipv4ll_update_mac(Link *link) { in ipv4ll_update_mac() argument
213 assert(link); in ipv4ll_update_mac()
215 if (link->hw_addr.length != ETH_ALEN) in ipv4ll_update_mac()
217 if (ether_addr_is_null(&link->hw_addr.ether)) in ipv4ll_update_mac()
219 if (!link->ipv4ll) in ipv4ll_update_mac()
222 return sd_ipv4ll_set_mac(link->ipv4ll, &link->hw_addr.ether); in ipv4ll_update_mac()