From 8694f0e52bacc8899a349a8d01f88b3f14cf897b Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 1 Nov 2006 09:43:35 +0100 Subject: [PATCH] ntpd plugin: Pass a `struct sockaddr' to `getnameinfo', rather than a `struct in_addr'. Thanks to Lubos Stanek for pointing me in the right direction :) --- src/ntpd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ntpd.c b/src/ntpd.c index fc76a245..d65d1ed9 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -897,8 +897,15 @@ static void ntpd_read (void) if (ptr->v6_flag) { - status = getnameinfo ((const struct sockaddr *) &ptr->srcadr6, - sizeof (ptr->srcadr6), + struct sockaddr_in6 sa; + + memset (&sa, 0, sizeof (sa)); + sa.sin6_family = AF_INET6; + sa.sin6_port = htons (123); + memcpy (&sa.sin6_addr, &ptr->srcadr6, sizeof (struct in6_addr)); + + status = getnameinfo ((const struct sockaddr *) &sa, + sizeof (sa), peername, sizeof (peername), NULL, 0, 0 /* no flags */); if (status != 0) -- 2.11.0