]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix pythonmod include and sockaddr_un ifdefs for compile on
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 20 Feb 2019 15:19:58 +0000 (15:19 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 20 Feb 2019 15:19:58 +0000 (15:19 +0000)
  Windows, and for libunbound.

git-svn-id: file:///svn/unbound/trunk@5118 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
libunbound/python/libunbound.i
pythonmod/interface.i
pythonmod/pythonmod.c

index bd2e0a6022d0c71fd8c81d611d81ca1247fcf9b5..9fb1edd6b853dbf66d4f5c586b4dfc7bbe30c1ba 100644 (file)
@@ -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.
index 84a536929421df9a3ba1d2adfb0c4e5bbe91429b..4af75637c4f5ebe1992e8f080f5b8a7193f6e209 100644 (file)
 %module unbound
 %{
    #include <sys/types.h>
+   #ifdef HAVE_SYS_SOCKET_H
    #include <sys/socket.h>
+   #endif
+   #ifdef HAVE_NETINET_IN_H
    #include <netinet/in.h>
+   #endif
+   #ifdef HAVE_ARPA_INET_H
    #include <arpa/inet.h>
+   #endif
    #include "libunbound/unbound.h"
 %}
 
 
 %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);
   }
 %} 
index 5f2559bacffa80e3c78033fac5cbef696a56326a..9b5e15a4a78d6bbad04ea47189d7a82064454dc6 100644 (file)
@@ -9,11 +9,21 @@
  * called to perform operations on queries.
  */
    #include <sys/types.h>
+   #ifdef HAVE_SYS_SOCKET_H
    #include <sys/socket.h>
+   #endif
+   #ifdef HAVE_NETINET_IN_H
    #include <netinet/in.h>
+   #endif
+   #ifdef HAVE_ARPA_INET_H
    #include <arpa/inet.h>
+   #endif
+   #ifdef HAVE_NETDB_H
    #include <netdb.h>
+   #endif
+   #ifdef HAVE_SYS_UN_H
    #include <sys/un.h>
+   #endif
    #include <stdarg.h>
    #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;
     }
index a668ecc23cc70da904078e116dc6198315f3e3fb..2f5bdf3b7b906cabc3adc08bc859a47ac006bc73 100644 (file)
@@ -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);