]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix broken windows build
authorEvan Hunt <each@isc.org>
Fri, 28 Jun 2019 19:45:26 +0000 (12:45 -0700)
committerEvan Hunt <each@isc.org>
Wed, 3 Jul 2019 16:17:27 +0000 (12:17 -0400)
The MSVS C compiler requires every struct to have at least one member.
The dns_geoip_databases_t structure had one set of members for
HAVE_GEOIP and a different set for HAVE_GEOIP2, and none when neither
API is in use.

This commit silences the compiler error by moving the declaration of
dns_geoip_databases_t to types.h as an opaque reference, and commenting
out the contents of geoip.h when neither version of GeoIP is enabled.

bin/named/server.c
lib/dns/include/dns/geoip.h
lib/dns/include/dns/types.h
lib/isccfg/aclconf.c

index 2944a5b6779dab1f99b09eaaa80f08232380004d..6332b0541155e6f1323fe74601e857b44cefa037 100644 (file)
@@ -9481,6 +9481,7 @@ static void
 run_server(isc_task_t *task, isc_event_t *event) {
        isc_result_t result;
        named_server_t *server = (named_server_t *)event->ev_arg;
+       dns_geoip_databases_t *geoip;
 
        INSIST(task == server->task);
 
@@ -9491,16 +9492,17 @@ run_server(isc_task_t *task, isc_event_t *event) {
 
        dns_dispatchmgr_setstats(named_g_dispatchmgr, server->resolverstats);
 
+#if defined(HAVE_GEOIP) || defined(HAVE_GEOIP2)
+       geoip = named_g_geoip;
+#else
+       geoip = NULL;
+#endif
+
        CHECKFATAL(ns_interfacemgr_create(named_g_mctx, server->sctx,
                                          named_g_taskmgr, named_g_timermgr,
                                          named_g_socketmgr,
                                          named_g_dispatchmgr,
-                                         server->task, named_g_udpdisp,
-#if defined(HAVE_GEOIP) || defined(HAVE_GEOIP2)
-                                         named_g_geoip,
-#else
-                                         NULL,
-#endif
+                                         server->task, named_g_udpdisp, geoip,
                                          &server->interfacemgr),
                   "creating interface manager");
 
index e06bf9e2ac238acb1a32250e67e07f72ddc481ed..d79a85c9fdf75c420ebf041acfe0c02366da6e53 100644 (file)
  ***** Module Info
  *****/
 
-/*! \file dns/acl.h
+/*! \file dns/geoip.h
  * \brief
- * Address match list handling.
+ * GeoIP/GeoIP2 data types and function prototypes.
  */
 
+#if defined(HAVE_GEOIP) || defined(HAVE_GEOIP2)
+
 /***
  *** Imports
  ***/
@@ -84,8 +86,8 @@ typedef struct dns_geoip_elem {
        };
 } dns_geoip_elem_t;
 
-typedef struct dns_geoip_databases {
-#if defined(HAVE_GEOIP2)
+struct dns_geoip_databases {
+#ifdef HAVE_GEOIP2
        void *country;          /* GeoIP2-Country or GeoLite2-Country */
        void *city;             /* GeoIP2-CIty or GeoLite2-City */
        void *domain;           /* GeoIP2-Domain */
@@ -93,21 +95,21 @@ typedef struct dns_geoip_databases {
        void *as;               /* GeoIP2-ASN or GeoLite2-ASN */
 #define DNS_GEOIP_DATABASE_INIT \
        { NULL, NULL, NULL, NULL, NULL }
-#elif defined(HAVE_GEOIP)
-       void *country_v4;       /* DB 1        */
-       void *city_v4;          /* DB 2 or 6   */
-       void *region;           /* DB 3 or 7   */
-       void *isp;              /* DB 4        */
-       void *org;              /* DB 5        */
-       void *as;               /* DB 9        */
-       void *netspeed;         /* DB 10       */
-       void *domain;           /* DB 11       */
-       void *country_v6;       /* DB 12       */
-       void *city_v6;          /* DB 30 or 31 */
+#else /* HAVE_GEOIP */
+       void *country_v4;       /* GeoIP DB 1 */
+       void *city_v4;          /* GeoIP DB 2 or 6 */
+       void *region;           /* GeoIP DB 3 or 7 */
+       void *isp;              /* GeoIP DB 4 */
+       void *org;              /* GeoIP DB 5 */
+       void *as;               /* GeoIP DB 9 */
+       void *netspeed;         /* GeoIP DB 10 */
+       void *domain;           /* GeoIP DB 11 */
+       void *country_v6;       /* GeoIP DB 12 */
+       void *city_v6;          /* GeoIP DB 30 or 31 */
 #define DNS_GEOIP_DATABASE_INIT \
        { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
-#endif
-} dns_geoip_databases_t;
+#endif /* HAVE_GEOIP */
+};
 
 /***
  *** Functions
@@ -124,4 +126,7 @@ void
 dns_geoip_shutdown(void);
 
 ISC_LANG_ENDDECLS
+
+#endif /* HAVE_GEOIP | HAVE_GEOIP2 */
+
 #endif /* DNS_GEOIP_H */
index 17c605e69a513ecb61d6398b922b0b4d1c2e2508..329ee7d277706c9177ad44816e17e7450f792bbb 100644 (file)
@@ -88,6 +88,7 @@ typedef struct dns_fixedname                  dns_fixedname_t;
 typedef struct dns_forwarders                  dns_forwarders_t;
 typedef struct dns_forwarder                   dns_forwarder_t;
 typedef struct dns_fwdtable                    dns_fwdtable_t;
+typedef struct dns_geoip_databases             dns_geoip_databases_t;
 typedef struct dns_iptable                     dns_iptable_t;
 typedef uint32_t                               dns_iterations_t;
 typedef uint16_t                               dns_keyflags_t;
index 691145d54a3dd0155ace6098c087e3117a22c4b5..7b26c68471d5285a426660c4f90c732d72adc771 100644 (file)
@@ -818,6 +818,7 @@ geoip_can_answer(dns_aclelement_t *elt, cfg_aclconfctx_t *ctx) {
        case dns_geoip_netspeed_id:
                if (ctx->geoip->netspeed != NULL)
                        return (true);
+               /* FALLTHROUGH */
        /*
         * The following enums are only valid with GeoIP2,
         * not legacy GeoIP.