From: Wouter Wijngaards Date: Wed, 20 Feb 2019 15:19:58 +0000 (+0000) Subject: - Fix pythonmod include and sockaddr_un ifdefs for compile on X-Git-Tag: release-1.9.1rc1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=079253670eed87776ba6fa26f3e2d7a993d79439;p=thirdparty%2Funbound.git - Fix pythonmod include and sockaddr_un ifdefs for compile on Windows, and for libunbound. git-svn-id: file:///svn/unbound/trunk@5118 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index bd2e0a602..9fb1edd6b 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +20 February 2019: Wouter + - Fix pythonmod include and sockaddr_un ifdefs for compile on + Windows, and for libunbound. + 18 February 2019: Wouter - Print query name with ip_ratelimit exceeded log lines. - Spaces instead of tabs in that log message. diff --git a/libunbound/python/libunbound.i b/libunbound/python/libunbound.i index 84a536929..4af75637c 100644 --- a/libunbound/python/libunbound.i +++ b/libunbound/python/libunbound.i @@ -36,9 +36,15 @@ %module unbound %{ #include + #ifdef HAVE_SYS_SOCKET_H #include + #endif + #ifdef HAVE_NETINET_IN_H #include + #endif + #ifdef HAVE_ARPA_INET_H #include + #endif #include "libunbound/unbound.h" %} @@ -108,7 +114,7 @@ %inline %{ void ub_ctx_free_dbg (struct ub_ctx* c) { - printf("******** UB_CTX free 0x%lX ************\n", (long unsigned int)c); + printf("******** UB_CTX free 0x%p ************\n", c); ub_ctx_delete(c); } @@ -648,7 +654,7 @@ Result: ['74.125.43.147', '74.125.43.99', '74.125.43.103', '74.125.43.104'] %inline %{ void ub_resolve_free_dbg (struct ub_result* r) { - printf("******** UB_RESOLVE free 0x%lX ************\n", (long unsigned int)r); + printf("******** UB_RESOLVE free 0x%p ************\n", r); ub_resolve_free(r); } %} diff --git a/pythonmod/interface.i b/pythonmod/interface.i index 5f2559bac..9b5e15a4a 100644 --- a/pythonmod/interface.i +++ b/pythonmod/interface.i @@ -9,11 +9,21 @@ * called to perform operations on queries. */ #include + #ifdef HAVE_SYS_SOCKET_H #include + #endif + #ifdef HAVE_NETINET_IN_H #include + #endif + #ifdef HAVE_ARPA_INET_H #include + #endif + #ifdef HAVE_NETDB_H #include + #endif + #ifdef HAVE_SYS_UN_H #include + #endif #include #include "config.h" #include "util/log.h" @@ -449,7 +459,9 @@ struct sockaddr_storage {}; switch (ss->ss_family) { case AF_INET: return sizeof(struct sockaddr_in); case AF_INET6: return sizeof(struct sockaddr_in6); +#ifdef HAVE_SYS_UN_H case AF_UNIX: return sizeof(struct sockaddr_un); +#endif default: return 0; } @@ -515,10 +527,12 @@ struct sockaddr_storage {}; return PyBytes_FromStringAndSize((const char *)raw, sizeof(*raw)); } +#ifdef HAVE_SYS_UN_H if (ss->ss_family == AF_UNIX) { const struct sockaddr_un *sa = (struct sockaddr_un *)ss; return PyBytes_FromString(sa->sun_path); } +#endif return Py_None; } diff --git a/pythonmod/pythonmod.c b/pythonmod/pythonmod.c index a668ecc23..2f5bdf3b7 100644 --- a/pythonmod/pythonmod.c +++ b/pythonmod/pythonmod.c @@ -517,8 +517,7 @@ void pythonmod_clear(struct module_qstate* qstate, int id) return; pq = (struct pythonmod_qstate*)qstate->minfo[id]; - verbose(VERB_ALGO, "pythonmod: clear, id: %d, pq:%lX", id, - (unsigned long int)pq); + verbose(VERB_ALGO, "pythonmod: clear, id: %d, pq:%p", id, pq); if(pq != NULL) { PyGILState_STATE gil = PyGILState_Ensure(); @@ -534,8 +533,7 @@ void pythonmod_clear(struct module_qstate* qstate, int id) size_t pythonmod_get_mem(struct module_env* env, int id) { struct pythonmod_env* pe = (struct pythonmod_env*)env->modinfo[id]; - verbose(VERB_ALGO, "pythonmod: get_mem, id: %d, pe:%lX", id, - (unsigned long int)pe); + verbose(VERB_ALGO, "pythonmod: get_mem, id: %d, pe:%p", id, pe); if(!pe) return 0; return sizeof(*pe);