]> git.ipfire.org Git - people/ms/libloc.git/log
people/ms/libloc.git
3 years agodebian: Add watch configuration for uscan
Valters Jansons [Fri, 16 Apr 2021 13:06:11 +0000 (16:06 +0300)] 
debian: Add watch configuration for uscan

Packages defined as '3.0 (quilt)' are expected to provide information
about how the latest upstream information can be obtained,
as a special d/watch file. This can then get used by uscan(1).

To see how the metadata is utilized, and how the network requests
are made behind the scenes, you can locally run:
$ uscan --no-download --verbose --debug

Resolves: lintian: debian-watch-file-is-missing

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Set 'Multi-Arch: foreign' hint for Python
Valters Jansons [Fri, 16 Apr 2021 13:06:07 +0000 (16:06 +0300)] 
debian: Set 'Multi-Arch: foreign' hint for Python

Due to the invocation of py3compile (via dh-python) in location-importer
and location-python packages, those packages have different bytecode for
varying architectures, and as a result are not 'Multi-Arch: same'.

Resolves: lintian: multi-arch-same-package-calls-pycompile

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Add examples/python/ to documentation
Valters Jansons [Fri, 16 Apr 2021 13:06:09 +0000 (16:06 +0300)] 
debian: Add examples/python/ to documentation

Resolves: lintian: package-does-not-install-examples

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Update copyright format link to use HTTPS
Valters Jansons [Fri, 16 Apr 2021 13:06:08 +0000 (16:06 +0300)] 
debian: Update copyright format link to use HTTPS

Resolves: lintian: insecure-copyright-format-uri

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Move libloc1 to 'libs' section
Valters Jansons [Fri, 16 Apr 2021 13:06:06 +0000 (16:06 +0300)] 
debian: Move libloc1 to 'libs' section

Resolves: lintian: wrong-section-according-to-package-name

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopo: Update translations
Valters Jansons [Thu, 15 Apr 2021 11:42:13 +0000 (14:42 +0300)] 
po: Update translations

POTFILES.in should not contain src/python/__init__.py file as it
is not present in the committed tree. It has its respective .in file
which is present instead.

This commit further ensures po/POTFILES.in generator avoids such
files that Git ignores (using git-check-ignore during find).

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Rework historical changelog
Valters Jansons [Mon, 12 Apr 2021 13:01:45 +0000 (16:01 +0300)] 
debian: Rework historical changelog

Rewriting history is generally considered a "not-so-good" thing,
however here the historical data does not align with best practises
and therefore it is beneficial to provide a better example going
forward.

There is only one initial release. Everything following that should
list some kind of release notes or changelog, or at the very least
just say something along the lines of "New version" rather than
"Initial release".

In this commit, the Git history is used for this task,
filtering out "Makefile" changes as to retain only changes
that are visible to users, excluding building tooling.

For Debian packages, upon release, the target distribution should be
updated to "unstable" (or "experimental" if preferred for any reason)
when a release is finalized. During development, an invalid
distribution name is expected to be there for tracking unreleased
changes. That is why "UNRELEASED" is the standard way of specifying
ongoing development, being an invalid distribution name itself.

The "(Closes: #XXXXXX)" tag is intended for linking to Debian bug
tracker, such as linking to the initial Intent to Package ticket,
or later update/bugfix tickets. There does not appear to be a bug
tracker in use for this task here, and the XXXXXX bug ticket number
does not take you anywhere. It's therefore better to just remove it.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Add missing '<' in copyright
Valters Jansons [Mon, 12 Apr 2021 12:57:24 +0000 (15:57 +0300)] 
debian: Add missing '<' in copyright

The email address information should be inside brackets. This
commit ensures the missing bracket character issue is remedied.
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Add intltoolize to dh_auto_configure
Valters Jansons [Tue, 6 Apr 2021 11:13:31 +0000 (14:13 +0300)] 
debian: Add intltoolize to dh_auto_configure

Debian has automated building tools that handle source trees directly.
It is expected that you can pick up a source tarball, and with the
appropriate debian/ subtree, a successful build can be produced using
the `debuild` tool. This depends on all the build steps having been
included as part of the debian/rules file (see: `man debuild`).

This commit ensures there is no need to manually run autogen.sh
on a locally extracted source tarball prior to building for Debian.
This is accomplished by adding the `intltoolize` command to the
override_dh_auto_configure step in d/rules.

There is no need to add the `autoreconf` command due to dh-autoreconf
always handling that prior to the dh_auto_configure step.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoBump version to 0.9.6 0.9.6
Michael Tremer [Wed, 31 Mar 2021 14:07:07 +0000 (14:07 +0000)] 
Bump version to 0.9.6

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoRevert "Makefile.am: Do not provide PREFIX value for perl build."
Michael Tremer [Wed, 31 Mar 2021 14:04:48 +0000 (14:04 +0000)] 
Revert "Makefile.am: Do not provide PREFIX value for perl build."

This reverts commit d39d928b4db79e9c32d68d49de47be8b55b3ca92.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agolocation-importer.in: skip networks with unknown country codes
Peter Müller [Tue, 30 Mar 2021 15:47:10 +0000 (17:47 +0200)] 
location-importer.in: skip networks with unknown country codes

There is no sense in parsing and storting networks whose country codes
cannot be found in the ISO-3166-x country code table. This avoids side
effects in applications using the location database, and introduces
another sanity check to compensate bogus RIR data.

On location02, this affects some networks from APNIC (country code: ZZ)
as well as a bunch of smaller allocations within the RIPE region still
tagged to CS or YU (Yugoslavia). To my surprise, no network tagged as SU
(Soviet Union) was found - while the NIC for .su TLD is still
operational. :-)

Applying this patch causes the countries to be processed before
update_whois() is called. In case no countries are present in the SQL
table, this check is silently omitted.

Fixes: #12510
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agolocation-importer.in: process unaligned IP ranges in RIR data files correctly
Peter Müller [Mon, 29 Mar 2021 20:24:36 +0000 (22:24 +0200)] 
location-importer.in: process unaligned IP ranges in RIR data files correctly

The IP range given in an inetnum object apparently not necessarily
matches distinct subnet boundaries. As a result, the current attempt to
calculate its CIDR mask resulted in faulty subnets not covering the
entire IP range.

This patch leaves the task of enumerating subnets to the ipaddress
module itself, which handles things much more robust. Since the output
may contain of several subnets, a list for the inetnum key is necessary
as well as a loop over them when conducting the SQL statements.

Fixes: #12595
Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Free mmapped countries section
Michael Tremer [Mon, 22 Mar 2021 11:42:43 +0000 (11:42 +0000)] 
database: Free mmapped countries section

This was a potential memory leak.

Reported-by: Gisle Vanem <gisle.vanem@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoMakefile.am: Honor DESTDIR when installing perl bindings
Stefan Schantl [Sat, 27 Feb 2021 19:21:10 +0000 (20:21 +0100)] 
Makefile.am: Honor DESTDIR when installing perl bindings

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoMakefile.am: Do not specify CC and LD when building perl module.
Stefan Schantl [Tue, 23 Feb 2021 20:15:57 +0000 (21:15 +0100)] 
Makefile.am: Do not specify CC and LD when building perl module.

Specifing the CC and LD flags is not required because perl MakeMaker
takes care of this.

Fixes #12574.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoMakefile.am: Do not provide PREFIX value for perl build.
Stefan Schantl [Mon, 22 Feb 2021 20:07:21 +0000 (21:07 +0100)] 
Makefile.am: Do not provide PREFIX value for perl build.

This caused to gain the following error when building:

Only one of PREFIX or INSTALL_BASE can be given. Not both.

Using INSTALLDIRS=vendor is the common way to get the modules installed
into the right directories.

Fixes #12573.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agolocation-importer.in: reduce log noise for unusable networks
Peter Müller [Sat, 16 Jan 2021 18:09:39 +0000 (19:09 +0100)] 
location-importer.in: reduce log noise for unusable networks

These are nothing to worry about, which is why debug log facility is
more suitable here than informational or warning.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agolocation-importer.in: delete 6to4 IPv6 space as well
Peter Müller [Sat, 16 Jan 2021 18:05:33 +0000 (19:05 +0100)] 
location-importer.in: delete 6to4 IPv6 space as well

2002::/16 is an anycast prefix for 6to4 scenarios, as specified in RFC
3068. We currently process an announcement from Hurricane Electric for
it, and since it is an anycast network, multiple entities across the
world announce it as well.

Thereof, it does not make sense to include it in the database - as of
today, we do not have a country for it, either.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agolocation-importer.in: fix typo
Peter Müller [Wed, 23 Dec 2020 14:10:52 +0000 (15:10 +0100)] 
location-importer.in: fix typo

Fixes: #12549
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agolocation: Fix list-networks-by-as
Michael Tremer [Mon, 21 Dec 2020 16:25:46 +0000 (16:25 +0000)] 
location: Fix list-networks-by-as

Fixes: #12554
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodebian: Sync version 0.9.5
Michael Tremer [Wed, 2 Dec 2020 17:40:30 +0000 (17:40 +0000)] 
debian: Sync version

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Restart flatten algorithm from the top when a network was dropped
Michael Tremer [Tue, 1 Dec 2020 16:58:29 +0000 (16:58 +0000)] 
database: Restart flatten algorithm from the top when a network was dropped

We used to simply take the first element from the stack after we have
split a network. That is wrong because it is not passing through any
filters and no further subnet checks. It could have therefore been
that the tree was not entirely flat.

Reported-by: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Exit find operation early when the list is empty
Michael Tremer [Fri, 27 Nov 2020 15:40:20 +0000 (15:40 +0000)] 
network-list: Exit find operation early when the list is empty

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopython: Do not check whether an integer is larger than 32 bit on 32 bit arches
Michael Tremer [Fri, 27 Nov 2020 15:37:22 +0000 (15:37 +0000)] 
python: Do not check whether an integer is larger than 32 bit on 32 bit arches

This cannot happen and generated a compiler warning

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopython: PyList_Size returns ssize_t which is signed
Michael Tremer [Fri, 27 Nov 2020 15:33:06 +0000 (15:33 +0000)] 
python: PyList_Size returns ssize_t which is signed

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoSilence compiler formatting warnings for size_t
Michael Tremer [Fri, 27 Nov 2020 15:31:39 +0000 (15:31 +0000)] 
Silence compiler formatting warnings for size_t

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoconfigure: Adjust man-pages switch with documentation
Michael Tremer [Fri, 27 Nov 2020 15:27:08 +0000 (15:27 +0000)] 
configure: Adjust man-pages switch with documentation

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoas-list/country-list: Set elements list to zero after freeing it
Michael Tremer [Thu, 26 Nov 2020 10:19:26 +0000 (10:19 +0000)] 
as-list/country-list: Set elements list to zero after freeing it

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Add greater elements after the current one
Michael Tremer [Thu, 26 Nov 2020 10:14:18 +0000 (10:14 +0000)] 
network-list: Add greater elements after the current one

The list was otherwise not sorted

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Add more networks to test
Michael Tremer [Thu, 26 Nov 2020 10:14:08 +0000 (10:14 +0000)] 
network-list: Add more networks to test

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Copy flags when split into subnets
Michael Tremer [Thu, 26 Nov 2020 09:54:07 +0000 (09:54 +0000)] 
network: Copy flags when split into subnets

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoconfigure: Bump version to 0.9.5
Michael Tremer [Wed, 25 Nov 2020 20:00:46 +0000 (20:00 +0000)] 
configure: Bump version to 0.9.5

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Use clear function to tidy up
Michael Tremer [Wed, 25 Nov 2020 15:24:43 +0000 (15:24 +0000)] 
network-list: Use clear function to tidy up

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Include network header
Michael Tremer [Wed, 25 Nov 2020 15:17:42 +0000 (15:17 +0000)] 
network-list: Include network header

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Remove deprecated sort call
Michael Tremer [Wed, 25 Nov 2020 15:17:21 +0000 (15:17 +0000)] 
network: Remove deprecated sort call

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Massively improve performance on exclude
Michael Tremer [Wed, 25 Nov 2020 15:16:06 +0000 (15:16 +0000)] 
network: Massively improve performance on exclude

When we check the result for any overlaps, we can cut this short
by walking through both lists from start to end and remember the
last network that we checked.

The next one will by definition be strictly greater and therefore
we do not need to check anything before this any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Call subnet function with the correct order of arguments
Michael Tremer [Wed, 25 Nov 2020 15:15:33 +0000 (15:15 +0000)] 
network: Call subnet function with the correct order of arguments

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Add more excluded networks straight to the to_check list
Michael Tremer [Wed, 25 Nov 2020 15:14:31 +0000 (15:14 +0000)] 
network: Add more excluded networks straight to the to_check list

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Do not execute with an error when the excluded result will be empty
Michael Tremer [Wed, 25 Nov 2020 15:13:08 +0000 (15:13 +0000)] 
network: Do not execute with an error when the excluded result will be empty

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetworks: Remove comparing family
Michael Tremer [Wed, 25 Nov 2020 15:11:21 +0000 (15:11 +0000)] 
networks: Remove comparing family

Everything is encoded in IPv6 anyways...

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetworks: Add tests for overlaps function
Michael Tremer [Wed, 25 Nov 2020 14:44:56 +0000 (14:44 +0000)] 
networks: Add tests for overlaps function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Remove useless comment
Michael Tremer [Wed, 25 Nov 2020 14:44:23 +0000 (14:44 +0000)] 
network-list: Remove useless comment

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Show index when listing networks
Michael Tremer [Wed, 25 Nov 2020 14:43:58 +0000 (14:43 +0000)] 
network-list: Show index when listing networks

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Do not half list when popping the first element
Michael Tremer [Wed, 25 Nov 2020 14:42:26 +0000 (14:42 +0000)] 
network-list: Do not half list when popping the first element

The list was unfortunately halved in size every time an element
was taken from it, which was great for performance, but shortened
the result substantially.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Set elements pointer to NULL so that we know it is empty
Michael Tremer [Wed, 25 Nov 2020 14:41:39 +0000 (14:41 +0000)] 
network-list: Set elements pointer to NULL so that we know it is empty

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Check last element before doing binary search
Michael Tremer [Tue, 24 Nov 2020 19:39:35 +0000 (19:39 +0000)] 
network-list: Check last element before doing binary search

This is helpful because very often we walk through a list in
order and are most interested in the last element.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Use binary search to find if a network is a subnet
Michael Tremer [Tue, 24 Nov 2020 16:57:28 +0000 (16:57 +0000)] 
network-list: Use binary search to find if a network is a subnet

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Adjust return codes of loc_network_match_address and add test
Michael Tremer [Tue, 24 Nov 2020 16:50:17 +0000 (16:50 +0000)] 
network: Adjust return codes of loc_network_match_address and add test

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoDrop loc_network_gt which is now unused
Michael Tremer [Tue, 24 Nov 2020 15:50:39 +0000 (15:50 +0000)] 
Drop loc_network_gt which is now unused

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoDrop loc_network_eq in favour of loc_network_cmp
Michael Tremer [Tue, 24 Nov 2020 15:48:55 +0000 (15:48 +0000)] 
Drop loc_network_eq in favour of loc_network_cmp

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agotest: Add more networks to list to see the algorithm work
Michael Tremer [Tue, 24 Nov 2020 15:42:54 +0000 (15:42 +0000)] 
test: Add more networks to list to see the algorithm work

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Add excluded networks to to_check list
Michael Tremer [Tue, 24 Nov 2020 15:41:53 +0000 (15:41 +0000)] 
network: Add excluded networks to to_check list

This is now being done immediately instead of creating a new
list which is being merged later.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Read the first element from the list
Michael Tremer [Tue, 24 Nov 2020 15:22:02 +0000 (15:22 +0000)] 
database: Read the first element from the list

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Avoid merging the same data twice
Michael Tremer [Tue, 24 Nov 2020 15:15:59 +0000 (15:15 +0000)] 
database: Avoid merging the same data twice

When finish splitting networks into many parts, we have
a list of subnets with the excluded subnets and merge them
together first and put them on the stack again.

This is slower than pushing it all onto the stack first
and then popping the first element.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Drop sorting functions
Michael Tremer [Tue, 24 Nov 2020 15:04:03 +0000 (15:04 +0000)] 
network-list: Drop sorting functions

Since the list is always sorted, there is no point in
sorting it again...

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Make this a sorted list
Michael Tremer [Tue, 24 Nov 2020 14:55:08 +0000 (14:55 +0000)] 
network-list: Make this a sorted list

The list is now organised so that it is always ordered.

This allows us to find if a network is on the list a lot
quicker using binary search as well as inserting a new
network at the right place.

This will benefit loc_network_exclude with very large networks.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Remove deprecated loc_network_is_subnet_of function
Michael Tremer [Fri, 20 Nov 2020 18:44:42 +0000 (18:44 +0000)] 
network: Remove deprecated loc_network_is_subnet_of function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Speed up subnet check
Michael Tremer [Fri, 20 Nov 2020 18:39:13 +0000 (18:39 +0000)] 
network: Speed up subnet check

There is no point in checking different address families
with each other and we do not need to compare addresses
when the prefix of the subnet does not fit into the
network to check.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Add function to return the prefix
Michael Tremer [Fri, 20 Nov 2020 18:38:47 +0000 (18:38 +0000)] 
network: Add function to return the prefix

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Optimise _subnet function
Michael Tremer [Fri, 20 Nov 2020 18:36:48 +0000 (18:36 +0000)] 
network: Optimise _subnet function

This function used to create a network list which always
had exactly two elements. Since splitting a network in half
always returns two parts, we can simply return them as a
pointer.

This improves returning the network tree by about 17%.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork-list: Implement merging in reverse in one step
Michael Tremer [Fri, 20 Nov 2020 16:42:55 +0000 (16:42 +0000)] 
network-list: Implement merging in reverse in one step

This will save us some time because we do not need to
change the list in place first and then merge it.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Flatten out code due to compiler errors
Michael Tremer [Fri, 20 Nov 2020 16:25:56 +0000 (16:25 +0000)] 
database: Flatten out code due to compiler errors

It looks like GCC could not follow the code as it was
written. Therefore I clean up more often now instead
of having a GOTO block where I do that in.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Remove debugging output
Michael Tremer [Fri, 20 Nov 2020 16:25:27 +0000 (16:25 +0000)] 
network: Remove debugging output

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Fix loc_network_is_subnet()
Michael Tremer [Fri, 20 Nov 2020 16:24:40 +0000 (16:24 +0000)] 
network: Fix loc_network_is_subnet()

This function always returned false.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agotest: Add tests to network-lists
Michael Tremer [Fri, 20 Nov 2020 14:43:31 +0000 (14:43 +0000)] 
test: Add tests to network-lists

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Disable some useless code when not running in debug mode
Michael Tremer [Thu, 19 Nov 2020 12:48:46 +0000 (12:48 +0000)] 
database: Disable some useless code when not running in debug mode

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoexport: Speed-up export in xt_geoip format
Michael Tremer [Thu, 19 Nov 2020 12:41:19 +0000 (12:41 +0000)] 
export: Speed-up export in xt_geoip format

Removing the loop avoids creating a tuple and then iterating over it

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoexport: Remove old flattening feature
Michael Tremer [Thu, 19 Nov 2020 12:40:01 +0000 (12:40 +0000)] 
export: Remove old flattening feature

The database enumerator now only returns networks that will
never overlap.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopython: Add property to return IP addresses as bytes
Michael Tremer [Thu, 19 Nov 2020 12:34:11 +0000 (12:34 +0000)] 
python: Add property to return IP addresses as bytes

This avoids calling inet_pton to parse IP addresses from string

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopython: Fix download of database
Michael Tremer [Thu, 19 Nov 2020 12:03:33 +0000 (12:03 +0000)] 
python: Fix download of database

This was all messed up in 0c74f6b1a3bdce5ebdc2ee452b9baf3e421dd3d1
when the change of type for the timestamp wasn't changed everywhere
else.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agolocation: End lookup after an invalid IP address was passed
Michael Tremer [Wed, 18 Nov 2020 13:34:50 +0000 (13:34 +0000)] 
location: End lookup after an invalid IP address was passed

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopython: Remove unnecessary db object from writers
Michael Tremer [Wed, 18 Nov 2020 13:33:45 +0000 (13:33 +0000)] 
python: Remove unnecessary db object from writers

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoexport: Remove filtering for flags
Michael Tremer [Wed, 18 Nov 2020 13:19:04 +0000 (13:19 +0000)] 
export: Remove filtering for flags

The filter is an AND filter and if we set the flags from
the special country codes, we won't get back much.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Add debug output to filtering
Michael Tremer [Wed, 18 Nov 2020 13:18:52 +0000 (13:18 +0000)] 
database: Add debug output to filtering

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Free filter lists in enumerator
Michael Tremer [Tue, 17 Nov 2020 19:01:04 +0000 (19:01 +0000)] 
database: Free filter lists in enumerator

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Do not clean up python list
Michael Tremer [Tue, 17 Nov 2020 18:34:51 +0000 (18:34 +0000)] 
database: Do not clean up python list

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoActually clear all lists
Michael Tremer [Tue, 17 Nov 2020 18:14:15 +0000 (18:14 +0000)] 
Actually clear all lists

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoexport: Change back to use Network objects
Michael Tremer [Tue, 17 Nov 2020 18:13:49 +0000 (18:13 +0000)] 
export: Change back to use Network objects

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoas: Make lists grow dynamically
Michael Tremer [Tue, 17 Nov 2020 17:57:55 +0000 (17:57 +0000)] 
as: Make lists grow dynamically

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetworks: Make list grow dynamically
Michael Tremer [Tue, 17 Nov 2020 17:55:51 +0000 (17:55 +0000)] 
networks: Make list grow dynamically

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agocountries: Make list grow dynamically
Michael Tremer [Tue, 17 Nov 2020 17:50:17 +0000 (17:50 +0000)] 
countries: Make list grow dynamically

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Simplify AS matching code
Michael Tremer [Tue, 17 Nov 2020 16:58:55 +0000 (16:58 +0000)] 
database: Simplify AS matching code

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Simplify network matching code
Michael Tremer [Tue, 17 Nov 2020 16:56:43 +0000 (16:56 +0000)] 
database: Simplify network matching code

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoas: Add list for easier processing
Michael Tremer [Tue, 17 Nov 2020 16:46:48 +0000 (16:46 +0000)] 
as: Add list for easier processing

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Filter flags in C
Michael Tremer [Mon, 16 Nov 2020 15:25:15 +0000 (15:25 +0000)] 
database: Filter flags in C

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopython: Only return country codes we want
Michael Tremer [Mon, 16 Nov 2020 15:20:50 +0000 (15:20 +0000)] 
python: Only return country codes we want

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoImplement filtering for multiple countries in the enumerator
Michael Tremer [Mon, 16 Nov 2020 15:13:28 +0000 (15:13 +0000)] 
Implement filtering for multiple countries in the enumerator

This will allow us to speed up the export of the database
if only a few countries should be returned.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agoMove network lists into an own file
Michael Tremer [Sun, 15 Nov 2020 15:02:28 +0000 (15:02 +0000)] 
Move network lists into an own file

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agopython: Move tree flattening into C
Michael Tremer [Fri, 13 Nov 2020 12:09:03 +0000 (12:09 +0000)] 
python: Move tree flattening into C

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Unexport all tree functions
Michael Tremer [Fri, 13 Nov 2020 11:43:53 +0000 (11:43 +0000)] 
network: Unexport all tree functions

These should not be exported

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Add function to pop first element from stack
Michael Tremer [Fri, 13 Nov 2020 11:38:15 +0000 (11:38 +0000)] 
network: Add function to pop first element from stack

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Sort result of excluded lists
Michael Tremer [Fri, 13 Nov 2020 11:29:15 +0000 (11:29 +0000)] 
network: Sort result of excluded lists

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Filter results coming from stack
Michael Tremer [Fri, 13 Nov 2020 11:29:02 +0000 (11:29 +0000)] 
database: Filter results coming from stack

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Move network filtering into a separate function
Michael Tremer [Fri, 13 Nov 2020 11:23:33 +0000 (11:23 +0000)] 
database: Move network filtering into a separate function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetworks: Copy all attributes when splitting networks
Michael Tremer [Thu, 12 Nov 2020 20:09:37 +0000 (20:09 +0000)] 
networks: Copy all attributes when splitting networks

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agotest: Update API
Michael Tremer [Thu, 12 Nov 2020 20:09:20 +0000 (20:09 +0000)] 
test: Update API

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agodatabase: Add option to return networks flattened
Michael Tremer [Thu, 12 Nov 2020 20:02:03 +0000 (20:02 +0000)] 
database: Add option to return networks flattened

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Add function to exclude multiple networks at once
Michael Tremer [Thu, 12 Nov 2020 20:01:17 +0000 (20:01 +0000)] 
network: Add function to exclude multiple networks at once

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 years agonetwork: Add new subnet function
Michael Tremer [Thu, 12 Nov 2020 20:00:09 +0000 (20:00 +0000)] 
network: Add new subnet function

The old one is too difficult to use in terms of order
of input parameters and return value.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>