From 1f49833d4fc449d54c95c3235b5c18523e6f8d69 Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Thu, 2 Apr 2015 11:16:18 +0200 Subject: update unbound from upstream --- external/unbound/pythonmod/pythonmod_utils.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'external/unbound/pythonmod/pythonmod_utils.c') diff --git a/external/unbound/pythonmod/pythonmod_utils.c b/external/unbound/pythonmod/pythonmod_utils.c index 1091dcf10..5120074e8 100644 --- a/external/unbound/pythonmod/pythonmod_utils.c +++ b/external/unbound/pythonmod/pythonmod_utils.c @@ -48,7 +48,8 @@ #include "util/data/msgreply.h" #include "util/storage/slabhash.h" #include "util/regional.h" -#include "ldns/sbuffer.h" +#include "iterator/iter_delegpt.h" +#include "sldns/sbuffer.h" #undef _POSIX_C_SOURCE #undef _XOPEN_SOURCE @@ -176,3 +177,17 @@ void reply_addr2str(struct comm_reply* reply, char* dest, int maxlen) return; dest[maxlen-1] = 0; } + +/* Convert target->addr to string */ +void delegpt_addr_addr2str(struct delegpt_addr* target, char *dest, int maxlen) +{ + int af = (int)((struct sockaddr_in*) &(target->addr))->sin_family; + void* sinaddr = &((struct sockaddr_in*) &(target->addr))->sin_addr; + + if(af == AF_INET6) + sinaddr = &((struct sockaddr_in6*)&(target->addr))->sin6_addr; + dest[0] = 0; + if (inet_ntop(af, sinaddr, dest, (socklen_t)maxlen) == 0) + return; + dest[maxlen-1] = 0; +} -- cgit v1.2.3