RPKI: Fix handling of IPv6 cache addresses
The old code used just sizeof(struct sockaddr) bytes of IP address.
This commit is contained in:
parent
b000a94275
commit
4e23b49969
1 changed files with 3 additions and 6 deletions
|
@ -26,7 +26,6 @@
|
||||||
static ip_addr
|
static ip_addr
|
||||||
rpki_hostname_autoresolv(const char *host)
|
rpki_hostname_autoresolv(const char *host)
|
||||||
{
|
{
|
||||||
ip_addr addr = {};
|
|
||||||
struct addrinfo *res;
|
struct addrinfo *res;
|
||||||
struct addrinfo hints = {
|
struct addrinfo hints = {
|
||||||
.ai_family = AF_UNSPEC,
|
.ai_family = AF_UNSPEC,
|
||||||
|
@ -44,12 +43,10 @@ rpki_hostname_autoresolv(const char *host)
|
||||||
return IPA_NONE;
|
return IPA_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sockaddr sa = {
|
ip_addr addr = IPA_NONE;
|
||||||
.sa = *res->ai_addr,
|
|
||||||
};
|
|
||||||
|
|
||||||
uint unused;
|
uint unused;
|
||||||
sockaddr_read(&sa, res->ai_family, &addr, NULL, &unused);
|
|
||||||
|
sockaddr_read((sockaddr *) res->ai_addr, res->ai_family, &addr, NULL, &unused);
|
||||||
|
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
return addr;
|
return addr;
|
||||||
|
|
Loading…
Reference in a new issue