summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-10-19 03:37:43 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-10-19 03:39:07 +0200
commit4e23b499696da81acf0ed5ad181573b94ccdb9a3 (patch)
tree79aaa2bc01abc1996db2805f5fac7045eb3121ba
parentb000a94275d7bb81868b9d6ad7582e5a3939532a (diff)
RPKI: Fix handling of IPv6 cache addresses
The old code used just sizeof(struct sockaddr) bytes of IP address.
-rw-r--r--proto/rpki/transport.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/proto/rpki/transport.c b/proto/rpki/transport.c
index 182667be..9dcb7c5c 100644
--- a/proto/rpki/transport.c
+++ b/proto/rpki/transport.c
@@ -26,7 +26,6 @@
static ip_addr
rpki_hostname_autoresolv(const char *host)
{
- ip_addr addr = {};
struct addrinfo *res;
struct addrinfo hints = {
.ai_family = AF_UNSPEC,
@@ -44,12 +43,10 @@ rpki_hostname_autoresolv(const char *host)
return IPA_NONE;
}
- sockaddr sa = {
- .sa = *res->ai_addr,
- };
-
+ ip_addr addr = IPA_NONE;
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);
return addr;