diff options
| author | Riccardo Spagni <ric@spagni.net> | 2015-04-02 11:16:18 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2015-04-02 11:16:18 +0200 |
| commit | 1f49833d4fc449d54c95c3235b5c18523e6f8d69 (patch) | |
| tree | ae027273609339b9b89e3e546552af7a7afb23e7 /external/unbound/pythonmod/pythonmod_utils.c | |
| parent | b0151de60144ddc1f56d253e7574bd6a9aefa28f (diff) | |
| download | monzero-core-1f49833d4fc449d54c95c3235b5c18523e6f8d69.tar.gz monzero-core-1f49833d4fc449d54c95c3235b5c18523e6f8d69.tar.xz monzero-core-1f49833d4fc449d54c95c3235b5c18523e6f8d69.zip | |
update unbound from upstream
Diffstat (limited to 'external/unbound/pythonmod/pythonmod_utils.c')
| -rw-r--r-- | external/unbound/pythonmod/pythonmod_utils.c | 17 |
1 files changed, 16 insertions, 1 deletions
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; +} |
