Lines Matching refs:link
26 #include "networkd-link.h"
28 static int dhcp6_lease_address_acquired(sd_dhcp6_client *client, Link *link);
31 Link *link) {
37 _cleanup_link_unref_ Link *link = userdata;
40 assert(link);
44 if (link->rtnl_extended_attrs) {
45 log_link_warning(link, "Could not set extended netlink attributes, reverting to fallback mechanism");
47 link->rtnl_extended_attrs = false;
48 dhcp6_lease_address_acquired(link->dhcp6_client, link);
53 log_link_error_errno(link, r, "Could not set DHCPv6 address: %m");
55 link_enter_failed(link);
58 manager_rtnl_process_address(rtnl, m, link->manager);
63 static int dhcp6_address_change(Link *link, struct in6_addr *ip6_addr,
81 log_link_info(link,
86 r = address_configure(addr, link, dhcp6_address_handler, true);
88 log_link_warning_errno(link, r, "Could not assign DHCPv6 address: %m");
93 static int dhcp6_lease_address_acquired(sd_dhcp6_client *client, Link *link) {
109 r = dhcp6_address_change(link, &ip6_addr, lifetime_preferred, lifetime_valid);
119 Link *link = userdata;
121 assert(link);
122 assert(link->network);
123 assert(link->manager);
125 if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
133 log_link_warning(link, "DHCPv6 lease lost");
135 link->dhcp6_configured = false;
139 r = dhcp6_lease_address_acquired(client, link);
141 link_enter_failed(link);
147 r = dhcp6_lease_information_acquired(client, link);
149 link_enter_failed(link);
153 link->dhcp6_configured = true;
158 log_link_warning_errno(link, event, "DHCPv6 error: %m");
160 log_link_warning(link, "DHCPv6 unknown event: %d", event);
164 link_check_ready(link);
167 int dhcp6_request_address(Link *link) {
171 assert(link);
172 assert(link->dhcp6_client);
174 r = sd_dhcp6_client_get_information_request(link->dhcp6_client, &inf_req);
181 r = sd_dhcp6_client_is_running(link->dhcp6_client);
188 r = sd_dhcp6_client_stop(link->dhcp6_client);
193 r = sd_dhcp6_client_set_information_request(link->dhcp6_client, false);
198 r = sd_dhcp6_client_start(link->dhcp6_client);
206 int dhcp6_configure(Link *link) {
210 assert(link);
212 if (link->dhcp6_client)
228 (const uint8_t *) &link->mac,
229 sizeof (link->mac), ARPHRD_ETHER);
233 r = sd_dhcp6_client_set_index(client, link->ifindex);
237 r = sd_dhcp6_client_set_callback(client, dhcp6_handler, link);
241 link->dhcp6_client = client;