From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: location@lists.ipfire.org Subject: Re: [PATCH] location-importer.in: treat AQ and BV as invalid countries Date: Wed, 14 Apr 2021 09:58:44 +0100 Message-ID: <32E9519B-895B-4514-A14B-5A9307A5907D@ipfire.org> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7381816721153294267==" List-Id: --===============7381816721153294267== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, > On 12 Apr 2021, at 18:26, Peter M=C3=BCller wr= ote: >=20 > Hello Michael, >=20 > thanks for your reply. >=20 > I believe you are mixing up two distinct scenarios here: I am trying not to. I just added the name because I struggle to remember some= country codes. > (a) Historic ISO-3166-X abbreviations for countries no longer existing anym= ore, such as YU. They technically do. They are still reserved in the ISO 3166 database and they show up (in this ca= se) in the RIPE database. So we will have to handle them no matter what. YU does not have a succeeding national body (like Eastern Germany would have = the Federal Republic of Germany) so we cannot automatically rewrite them. > (b) Country codes for existing nations, where we believe with a high level = of confidence no > IP networks are located in any way, either physically or legally. AQ and= BV are the most > notable examples known to me at the time of writing. >=20 > Since it does not make sense to add historic country codes, I would suggest= to leave networks > assigned to (a) countries as they are, manually creating overrides for them= , as I did before. >=20 > For (b), simply scrubbing out the country or region they belong to seems to= be too harsh to > me, as we use this information for several things, and should not abuse it = for our own purposes. (I assume) we still have AS information about those networks and we should ke= ep at least that. > Therefore, I rather suggest adding an additional column to countries.txt fo= r indicating whether > this country code is acceptable to us or not. Okay. What would you suggest? -Michael >=20 > Thanks, and best regards, > Peter M=C3=BCller >=20 >> Hello, >>=20 >> How about we add the country to the list and mark the continent with a =E2= =80=9C-=E2=80=9C: >>=20 >> AF AS Afghanistan >> YU - Yugoslavia >>=20 >> -Michael >>=20 >>> On 10 Apr 2021, at 13:32, Peter M=C3=BCller = wrote: >>>=20 >>> Hello Michael, >>>=20 >>> thanks for your reply. >>>=20 >>> Yes, having this configurable in countries.txt would be nice indeed. Do y= ou propose a certain syntax for this? >>>=20 >>> And yes, a tuple is a better idea here. I will wait for your reply and su= bmit a second version of this patch then. >>>=20 >>> Thanks, and best regards, >>> Peter M=C3=BCller >>>=20 >>>=20 >>>> Hello, >>>>=20 >>>> * would we not want this to be configurable in countries.txt? >>>>=20 >>>> * The list should probably be a tuple. >>>>=20 >>>> -Michael >>>>=20 >>>>> On 1 Apr 2021, at 20:57, Peter M=C3=BCller = wrote: >>>>>=20 >>>>> Both the Bouvet Island (BV) and Antarctica (AQ) are unpopulated at the >>>>> time of writing. Network owners/operators putting these countries into >>>>> their RIR data objects are either completely braindead or doing so for >>>>> hostile reasons. >>>>>=20 >>>>> While we might correct these locations to something useful by manually >>>>> creating overrides for them, the rationale behind this patch is not to >>>>> let these countries appear on productive systems in the first place, as >>>>> we know they _cannot_ be true. >>>>>=20 >>>>> Therefore, this patch skips any network object that has either AQ or BV >>>>> country code set. >>>>>=20 >>>>> See also: https://lists.ipfire.org/pipermail/location/2020-October/0001= 99.html >>>>>=20 >>>>> Signed-off-by: Peter M=C3=BCller >>>>> --- >>>>> src/python/location-importer.in | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>=20 >>>>> diff --git a/src/python/location-importer.in b/src/python/location-impo= rter.in >>>>> index 1e08458..ac678dc 100644 >>>>> --- a/src/python/location-importer.in >>>>> +++ b/src/python/location-importer.in >>>>> @@ -624,7 +624,7 @@ class CLI(object): >>>>> return >>>>>=20 >>>>> # Skip objects with unknown country codes >>>>> - if validcountries and inetnum.get("country") not in validcountries: >>>>> + if validcountries and (inetnum.get("country") not in validcountries = or inetnum.get("country") in ["AQ", "BV"]): >>>>> log.warning("Skipping network with bogus country '%s': %s" % \ >>>>> (inetnum.get("country"), inetnum.get("inet6num") or inetnum.get("in= etnum"))) >>>>> return >>>>> --=20 >>>>> 2.26.2 >>>>=20 >>=20 --===============7381816721153294267==--