return 0;
}
-static int link_update_dhcp_dns_servers(Link *l) {
- _cleanup_dhcp_lease_unref_ sd_dhcp_lease *lease = NULL;
- const struct in_addr *nameservers = NULL;
- DnsServer *s, *nx;
- int r, n, i;
-
- assert(l);
-
- r = sd_network_dhcp_use_dns(l->ifindex);
- if (r <= 0)
- goto clear;
-
- r = sd_network_get_dhcp_lease(l->ifindex, &lease);
- if (r < 0)
- goto clear;
-
- LIST_FOREACH(servers, s, l->dhcp_dns_servers)
- s->marked = true;
-
- n = sd_dhcp_lease_get_dns(lease, &nameservers);
- if (n < 0) {
- r = n;
- goto clear;
- }
-
- for (i = 0; i < n; i++) {
- union in_addr_union a = { .in = nameservers[i] };
-
- s = link_find_dns_server(l, DNS_SERVER_DHCP, AF_INET, &a);
- if (s)
- s->marked = false;
- else {
- r = dns_server_new(l->manager, NULL, DNS_SERVER_DHCP, l, AF_INET, &a);
- if (r < 0)
- goto clear;
- }
- }
-
- LIST_FOREACH_SAFE(servers, s, nx, l->dhcp_dns_servers)
- if (s->marked)
- dns_server_free(s);
-
- return 0;
-
-clear:
- while (l->dhcp_dns_servers)
- dns_server_free(l->dhcp_dns_servers);
-
- return r;
-}
-
static int link_update_link_dns_servers(Link *l) {
_cleanup_free_ struct in_addr *nameservers = NULL;
_cleanup_free_ struct in6_addr *nameservers6 = NULL;
int link_update_monitor(Link *l) {
assert(l);
- link_update_dhcp_dns_servers(l);
link_update_link_dns_servers(l);
link_allocate_scopes(l);
return 0;
}
-bool link_relevant(Link *l, unsigned char family) {
+bool link_relevant(Link *l, int family) {
_cleanup_free_ char *state = NULL;
LinkAddress *a;
return false;
}
-LinkAddress *link_find_address(Link *l, unsigned char family, union in_addr_union *in_addr) {
+LinkAddress *link_find_address(Link *l, int family, union in_addr_union *in_addr) {
LinkAddress *a;
assert(l);
return NULL;
}
-DnsServer* link_find_dns_server(Link *l, DnsServerSource source, unsigned char family, union in_addr_union *in_addr) {
+DnsServer* link_find_dns_server(Link *l, DnsServerSource source, int family, union in_addr_union *in_addr) {
DnsServer *first, *s;
assert(l);
}
}
-int link_address_new(Link *l, LinkAddress **ret, unsigned char family, union in_addr_union *in_addr) {
+int link_address_new(Link *l, LinkAddress **ret, int family, union in_addr_union *in_addr) {
LinkAddress *a;
assert(l);