From 4713c21a1ac91081e50e474d11fcec002b43a562 Mon Sep 17 00:00:00 2001 From: Dag-Erling Smørgrav Date: Sun, 30 Jun 2019 14:56:56 +0000 Subject: Vendor import of Unbound 1.9.1. --- pythonmod/interface.i | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'pythonmod/interface.i') diff --git a/pythonmod/interface.i b/pythonmod/interface.i index 5f2559bacffa..f9fd07b513d6 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 + #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 +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; } -- cgit v1.3