diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-05-28 10:20:10 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-05-28 10:20:10 +0300 |
commit | 0425feadb3965f05b8ed48edb0af3e1c76256b5c (patch) | |
tree | cf9aa24d546ccc58f6dc5d0950f871ee8cb2fccd /main/gdnsd/geoip-autodc.patch | |
parent | 939241b58edee52d1dd308d78a23c00ae3550409 (diff) | |
download | aports-0425feadb3965f05b8ed48edb0af3e1c76256b5c.tar.bz2 aports-0425feadb3965f05b8ed48edb0af3e1c76256b5c.tar.xz |
main/gdnsd: cherry pick some improvements from bug tracker
* faster startup time with cities geodb
* more flexible autodc support
Diffstat (limited to 'main/gdnsd/geoip-autodc.patch')
-rw-r--r-- | main/gdnsd/geoip-autodc.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/main/gdnsd/geoip-autodc.patch b/main/gdnsd/geoip-autodc.patch new file mode 100644 index 0000000000..ec88491a15 --- /dev/null +++ b/main/gdnsd/geoip-autodc.patch @@ -0,0 +1,45 @@ +From: Timo TerÃs <timo.teras@iki.fi> + +plugin_geoip: allow datacenters to be omitted from auto_dc_coords + +sometimes we might need a datacenter to be accessible only via +overrides of map (via specific territory) or via nets (only +specific nets). this makes those datacenters to be sorted always +last. + +http://code.google.com/p/gdnsd/issues/detail?id=17 + +diff --git a/plugins/meta/libgdmaps/gdmaps.c b/plugins/meta/libgdmaps/gdmaps.c +index b49bfa5..9d20351 100644 +--- a/plugins/meta/libgdmaps/gdmaps.c ++++ b/plugins/meta/libgdmaps/gdmaps.c +@@ -180,13 +180,13 @@ static dcinfo_t* dcinfo_new(const vscf_data_t* dc_cfg, const vscf_data_t* dc_aut + if(!vscf_is_hash(dc_auto_cfg)) + log_fatal("plugin_geoip: map '%s': auto_dc_coords must be a key-value hash", map_name); + const unsigned num_auto = vscf_hash_get_len(dc_auto_cfg); +- if(num_auto != num_dcs) +- log_fatal("plugin_geoip: map '%s': auto_dc_coords hash must contain one entry for each datacenter in 'datacenters'", map_name); +- info->coords = malloc(num_auto * 2 * sizeof(double)); ++ info->coords = malloc(num_dcs * 2 * sizeof(double)); ++ for(unsigned i = 0; i < 2*num_dcs; i++) ++ info->coords[i] = NAN; + for(unsigned i = 0; i < num_auto; i++) { + const char* dcname = vscf_hash_get_key_byindex(dc_auto_cfg, i, NULL); + unsigned dcidx; +- for(dcidx = 0; dcidx < info->num_dcs; dcidx++) { ++ for(dcidx = 0; dcidx < num_dcs; dcidx++) { + if(!strcmp(dcname, info->names[dcidx])) + break; + } +@@ -438,7 +438,10 @@ static unsigned dclists_city_auto_map(dclists_t* lists, const char* map_name, co + double dists[store_len]; + for(unsigned i = 0; i < num_dcs; i++) { + const unsigned c_offs = i * 2; +- dists[i + 1] = haversine(lat_rad, lon_rad, coords[c_offs], coords[c_offs + 1]); ++ if (coords[c_offs] != NAN) ++ dists[i + 1] = haversine(lat_rad, lon_rad, coords[c_offs], coords[c_offs + 1]); ++ else ++ dists[i + 1] = +INFINITY; + } + + // Given the relatively small num_dcs of most configs, |