Am 17.09.2019 um 16:40 schrieb Pat Suwalski:
> Package: geoip-bin
> Version: 1.6.12-4
>
> I was trying out the fix for another issue, generating a fresh
> geoip-database package using the latest version of the tools (and lib
> and -dev).
sick, just uploaded a new version..
>
> It fails on interpreting the new (unofficial?) XK country code for
> Kosovo:
>
> # Building geoip v4 country database.
> /usr/lib/geoip/geoip-generator -v -4 \
>     --info="$(date -u +'GEO-106FREE %Y%m%d Build' -d 'Tue Sep 17
> 10:14:06 EDT 2019')" \
>     -o /tmp/geoip-database-20190917/tmp/GeoIP.dat GeoIPCountryWhois.csv
> /usr/lib/geoip/geoip-generator: Reading CSV and building the trie
> /usr/lib/geoip/geoip-generator:GeoIPCountryWhois.csv:30816:
> Unrecognized country code: XK
> make[1]: *** [debian/rules:16: override_dh_install] Error 65
> make[1]: Leaving directory '/tmp/geoip-database-20190917'
> make: *** [debian/rules:8: binary] Error 2
>
> This seems odd to me, as the "Country-Locations" files do have the entry:
>
> 831053,en,EU,Europe,XK,Kosovo,0
>
> /usr/share/geoip/countryInfo.txt from geoip-bin also contains the XK
> entry.

This is only for the v2 => v1 conversion

>
> I assume geoip-csv-to-dat.cpp uses some other source for the country
> data that does not include it.
Yes, the geoip API itself
>
> grepping out the handful of "831053" lines from
> GeoLite2-Country-Blocks-IPv4.csv allows the package to build.

Could you test the patch below? It should restore the behaviour for
those IPs. then they are (again) listed as "serbia":


Index: src/geoip-csv-to-dat.cpp
===================================================================
--- src/geoip-csv-to-dat.cpp    (Revision 8838)
+++ src/geoip-csv-to-dat.cpp    (Arbeitskopie)
@@ -873,11 +873,18 @@

        // Country ID
        int country_id;
-       if (info[1] != "AN")
+
+       if (info[1] == "AN") {
+               country_id = GeoIP_id_by_code("CW");
+       }
+       else if (info[1] == "XK") {
+               country_id = GeoIP_id_by_code("RS");
+       }
+       else {
                country_id = GeoIP_id_by_code(info[1].c_str());
-       else
-               country_id = GeoIP_id_by_code("CW");
+       }

+
        if (country_id == 0) {
                error(EX_DATAERR, 1, dat_file_name.c_str(),
input_line_number,
                      "Unrecognized country code: %s", info[1].c_str());

-- 
/*
Mit freundlichem Gruß / With kind regards,
 Patrick Matthäi
 GNU/Linux Debian Developer

  Blog: http://www.linux-dev.org/
E-Mail: [email protected]
        [email protected]
*/

Reply via email to