diff --git a/lib/dns/geoip.c b/lib/dns/geoip.c index 23ee524e0d..291b0d05e9 100644 --- a/lib/dns/geoip.c +++ b/lib/dns/geoip.c @@ -615,7 +615,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, GeoIPRegion *region; dns_geoip_subtype_t subtype; isc_uint32_t ipnum = 0; - int maxlen = 0, id; + int maxlen = 0, id, family; const char *cs; char *s; #ifdef HAVE_GEOIP_V6 @@ -626,7 +626,8 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, INSIST(geoip != NULL); - switch (reqaddr->family) { + family = reqaddr->family; + switch (family) { case AF_INET: ipnum = ntohl(reqaddr->type.in.s_addr); break; @@ -661,8 +662,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, INSIST(elt->as_string != NULL); - cs = country_lookup(db, subtype, reqaddr->family, - ipnum, ipnum6); + cs = country_lookup(db, subtype, family, ipnum, ipnum6); if (cs != NULL && strncasecmp(elt->as_string, cs, maxlen) == 0) return (ISC_TRUE); break; @@ -682,8 +682,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, if (db == NULL) return (ISC_FALSE); - record = city_lookup(db, subtype, - reqaddr->family, ipnum, ipnum6); + record = city_lookup(db, subtype, family, ipnum, ipnum6); if (record == NULL) break; @@ -698,8 +697,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, if (db == NULL) return (ISC_FALSE); - record = city_lookup(db, subtype, - reqaddr->family, ipnum, ipnum6); + record = city_lookup(db, subtype, family, ipnum, ipnum6); if (record == NULL) break; @@ -712,8 +710,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, if (db == NULL) return (ISC_FALSE); - record = city_lookup(db, subtype, - reqaddr->family, ipnum, ipnum6); + record = city_lookup(db, subtype, family, ipnum, ipnum6); if (record == NULL) break; @@ -731,7 +728,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, INSIST(elt->as_string != NULL); /* Region DB is not supported for IPv6 */ - if (reqaddr->family == AF_INET6) + if (family == AF_INET6) return (ISC_FALSE); region = region_lookup(geoip->region, subtype, ipnum); @@ -765,7 +762,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, INSIST(elt->as_string != NULL); /* ISP, Org, AS, and Domain are not supported for IPv6 */ - if (reqaddr->family == AF_INET6) + if (family == AF_INET6) return (ISC_FALSE); s = name_lookup(db, subtype, ipnum); @@ -777,7 +774,7 @@ dns_geoip_match(const isc_netaddr_t *reqaddr, INSIST(geoip->netspeed != NULL); /* Netspeed DB is not supported for IPv6 */ - if (reqaddr->family == AF_INET6) + if (family == AF_INET6) return (ISC_FALSE); id = netspeed_lookup(geoip->netspeed, subtype, ipnum);