Merge pull request #15460 from elmarco/network-dhcp-resolve1
network: fallback on resolve1 DNS for DHCP
This commit is contained in:
@@ -362,3 +362,33 @@ int in_addr_ifindex_from_string_auto(const char *s, int *family, union in_addr_u
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int in_addr_ifindex_name_from_string_auto(const char *s, int *family, union in_addr_union *ret, int *ifindex, char **server_name) {
|
||||
_cleanup_free_ char *buf = NULL, *name = NULL;
|
||||
const char *m;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
||||
m = strchr(s, '#');
|
||||
if (m) {
|
||||
name = strdup(m+1);
|
||||
if (!name)
|
||||
return -ENOMEM;
|
||||
|
||||
buf = strndup(s, m - s);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
s = buf;
|
||||
}
|
||||
|
||||
r = in_addr_ifindex_from_string_auto(s, family, ret, ifindex);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (server_name)
|
||||
*server_name = TAKE_PTR(name);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -21,3 +21,4 @@ bool socket_address_is(const SocketAddress *a, const char *s, int type);
|
||||
bool socket_address_is_netlink(const SocketAddress *a, const char *s);
|
||||
|
||||
int in_addr_ifindex_from_string_auto(const char *s, int *family, union in_addr_union *ret, int *ifindex);
|
||||
int in_addr_ifindex_name_from_string_auto(const char *s, int *family, union in_addr_union *ret, int *ifindex, char **server_name);
|
||||
|
||||
Reference in New Issue
Block a user