From: Evan Hunt Date: Fri, 28 Jun 2019 19:45:26 +0000 (-0700) Subject: fix broken windows build X-Git-Tag: v9.11.9~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f81020a748ee9e3072db3d1e9afbe71acba4973c;p=thirdparty%2Fbind9.git fix broken windows build 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. (cherry picked from commit 81fcde595305b6ba7b466fb9a1b2498163b0e912) --- diff --git a/lib/dns/include/dns/geoip.h b/lib/dns/include/dns/geoip.h index c560dbba639..c41a2c21f75 100644 --- a/lib/dns/include/dns/geoip.h +++ b/lib/dns/include/dns/geoip.h @@ -16,11 +16,13 @@ ***** 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 ***/ @@ -83,8 +85,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 */ @@ -92,21 +94,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 @@ -123,4 +125,7 @@ void dns_geoip_shutdown(void); ISC_LANG_ENDDECLS + +#endif /* HAVE_GEOIP | HAVE_GEOIP2 */ + #endif /* DNS_GEOIP_H */ diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index 6754d168467..567e8a879e4 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -90,6 +90,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; diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index 132e651bc34..a2f2d0f0b02 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -832,6 +832,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.