summaryrefslogtreecommitdiff
path: root/pythonmod/interface.i
diff options
context:
space:
mode:
Diffstat (limited to 'pythonmod/interface.i')
-rw-r--r--pythonmod/interface.i22
1 files changed, 22 insertions, 0 deletions
diff --git a/pythonmod/interface.i b/pythonmod/interface.i
index 5f2559bacffa8..f9fd07b513d65 100644
--- a/pythonmod/interface.i
+++ b/pythonmod/interface.i
@@ -1,19 +1,37 @@
/*
* interface.i: unbound python module
*/
+%begin %{
+/* store state of warning output, restored at later pop */
+#pragma GCC diagnostic push
+/* ignore gcc8 METH_NOARGS function cast warnings for swig function pointers */
+#pragma GCC diagnostic ignored "-Wcast-function-type"
+%}
%module unboundmodule
%{
+/* restore state of warning output, remove the functioncast ignore */
+#pragma GCC diagnostic pop
/**
* \file
* This is the interface between the unbound server and a python module
* 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 +467,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 +535,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;
}