]> git.ipfire.org Git - location/libloc.git/log
location/libloc.git
4 weeks agoMakefile: Automatically add all tools/ to POTFILE.in master
Michael Tremer [Mon, 7 Apr 2025 09:19:14 +0000 (09:19 +0000)] 
Makefile: Automatically add all tools/ to POTFILE.in

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
4 weeks agojenkins: Fedora no longer seems to install awk by default
Michael Tremer [Mon, 7 Apr 2025 09:18:43 +0000 (09:18 +0000)] 
jenkins: Fedora no longer seems to install awk by default

This is needed to run the configure script.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
4 weeks agotests: Ensure loc_database_lookup finds a match
Valters Jansons [Mon, 7 Apr 2025 01:29:29 +0000 (04:29 +0300)] 
tests: Ensure loc_database_lookup finds a match

Commit 9e72b8a modified the lookup function to return 0 even if no
matches are found. As result, the test case could pass even if the
database lookup did not find any matches.

This commit restores the original intent of the test case, by adding
a failure condition when `network1` is NULL. This is similar to how
the subsequent test case was modified for the inverse condition.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 weeks agoRevert "jenkins: Build Debian packages for riscv64, too"
Michael Tremer [Fri, 21 Mar 2025 17:06:43 +0000 (17:06 +0000)] 
Revert "jenkins: Build Debian packages for riscv64, too"

This reverts commit 92bfc43af92eb19a5ed95ff04f2a71e56087a75b.

Well, this did not last very long...

+ apt-get install -y apt-utils build-essential crossbuild-essential-riscv64 devscripts qemu-user-static
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package crossbuild-essential-riscv64
script returned exit code 100

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
6 weeks agojenkins: Build Debian packages for riscv64, too
Michael Tremer [Fri, 21 Mar 2025 16:47:11 +0000 (16:47 +0000)] 
jenkins: Build Debian packages for riscv64, too

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agoconfigure: Fix passing custom LDFLAGS
Michael Tremer [Wed, 12 Mar 2025 10:36:50 +0000 (10:36 +0000)] 
configure: Fix passing custom LDFLAGS

Fixes: #13829 - Overlinking Lua and Python bindings
Reported-by: Petr Pisar <ppisar@redhat.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agoconfigure: Fix indentation
Michael Tremer [Wed, 12 Mar 2025 10:28:26 +0000 (10:28 +0000)] 
configure: Fix indentation

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agodebian: Update libloc1.symbols for version 0.9.18
Valters Jansons [Mon, 10 Mar 2025 20:47:07 +0000 (22:47 +0200)] 
debian: Update libloc1.symbols for version 0.9.18

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agojenkins: Okay, drop Alma Linux again
Michael Tremer [Mon, 10 Mar 2025 15:28:47 +0000 (15:28 +0000)] 
jenkins: Okay, drop Alma Linux again

This thing just seems to be too ancient and does not have packages for
Lua. Instead of creating too many if/else blocks to cover this, let's
remove it again. As far as I am aware, we don't have any known users on
this distribution.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agojenkins: Alma Linux does not seem to understand Code Ready
Michael Tremer [Mon, 10 Mar 2025 15:25:37 +0000 (15:25 +0000)] 
jenkins: Alma Linux does not seem to understand Code Ready

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agojenkins: Fix installing development tools on Alma Linux
Michael Tremer [Mon, 10 Mar 2025 15:22:18 +0000 (15:22 +0000)] 
jenkins: Fix installing development tools on Alma Linux

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agojenkins: Try building for Alma Linux 9
Michael Tremer [Mon, 10 Mar 2025 15:18:12 +0000 (15:18 +0000)] 
jenkins: Try building for Alma Linux 9

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agojenkins: Build for s390x again
Michael Tremer [Mon, 10 Mar 2025 15:15:54 +0000 (15:15 +0000)] 
jenkins: Build for s390x again

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agoaddress: Fix endianess problem when fetching octets in IPv4 addresses
Michael Tremer [Mon, 10 Mar 2025 15:13:07 +0000 (15:13 +0000)] 
address: Fix endianess problem when fetching octets in IPv4 addresses

Fixes: #13828
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agojenkins: Publish Debian packages for all supported architectures
Michael Tremer [Mon, 10 Mar 2025 14:33:30 +0000 (14:33 +0000)] 
jenkins: Publish Debian packages for all supported architectures

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agoconfigure: Bump version to 0.9.18 0.9.18
Michael Tremer [Mon, 10 Mar 2025 11:07:35 +0000 (11:07 +0000)] 
configure: Bump version to 0.9.18

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agojenkins: Remove broken architectures for now
Michael Tremer [Mon, 10 Mar 2025 11:07:07 +0000 (11:07 +0000)] 
jenkins: Remove broken architectures for now

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agodatabase: Correctly check return value of dup()
Michael Tremer [Mon, 10 Mar 2025 10:53:30 +0000 (10:53 +0000)] 
database: Correctly check return value of dup()

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agonetwork: Remove dead assignment
Michael Tremer [Mon, 10 Mar 2025 10:50:42 +0000 (10:50 +0000)] 
network: Remove dead assignment

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agoFix string formatting issues on 32 bit systems
Michael Tremer [Mon, 10 Mar 2025 10:43:59 +0000 (10:43 +0000)] 
Fix string formatting issues on 32 bit systems

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
8 weeks agodebian: Package Lua files
Michael Tremer [Mon, 10 Mar 2025 10:33:40 +0000 (10:33 +0000)] 
debian: Package Lua files

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agodebian: Update filelists
Michael Tremer [Thu, 6 Mar 2025 21:24:11 +0000 (21:24 +0000)] 
debian: Update filelists

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agodebian: Build against Lua again
Michael Tremer [Thu, 6 Mar 2025 21:15:21 +0000 (21:15 +0000)] 
debian: Build against Lua again

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agodebian: Don't build man pages
Michael Tremer [Thu, 6 Mar 2025 21:13:49 +0000 (21:13 +0000)] 
debian: Don't build man pages

This is not great, but I currently don't have any better option.
Installing asciidoc conflicts with python3-all-dev when cross-compiling.
Since asciidoc is optional and Python isn't this at least generates a
package at the end.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agopython: Fix unintended fallthrough
Michael Tremer [Thu, 6 Mar 2025 18:37:14 +0000 (18:37 +0000)] 
python: Fix unintended fallthrough

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agopython: Fix type for keyword lists
Michael Tremer [Thu, 6 Mar 2025 18:36:43 +0000 (18:36 +0000)] 
python: Fix type for keyword lists

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Fix syntax to install perl(Test::More)
Michael Tremer [Thu, 6 Mar 2025 18:34:47 +0000 (18:34 +0000)] 
jenkins: Fix syntax to install perl(Test::More)

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agolua: Perform formatting string sanitization
Michael Tremer [Thu, 6 Mar 2025 18:19:03 +0000 (18:19 +0000)] 
lua: Perform formatting string sanitization

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agotree: Replace bitfields with flags to mark deleted nodes
Michael Tremer [Thu, 6 Mar 2025 18:17:51 +0000 (18:17 +0000)] 
tree: Replace bitfields with flags to mark deleted nodes

clang does not seem to like these much.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agolog: Perform formatting string sanitation when logging to stderr
Michael Tremer [Thu, 6 Mar 2025 18:10:56 +0000 (18:10 +0000)] 
log: Perform formatting string sanitation when logging to stderr

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Install perl(Test::More) on Fedora
Michael Tremer [Thu, 6 Mar 2025 18:08:46 +0000 (18:08 +0000)] 
jenkins: Install perl(Test::More) on Fedora

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agotests: Constify path to open in database test
Michael Tremer [Thu, 6 Mar 2025 18:00:45 +0000 (18:00 +0000)] 
tests: Constify path to open in database test

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoaddress: Never pass zero to __builtin_ctz
Michael Tremer [Thu, 6 Mar 2025 17:59:03 +0000 (17:59 +0000)] 
address: Never pass zero to __builtin_ctz

This is undefined behaviour which worked just fine in GCC, but in clang
the code is doing funny business.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoconfigure: Enable more compiler warnings
Michael Tremer [Thu, 6 Mar 2025 17:45:38 +0000 (17:45 +0000)] 
configure: Enable more compiler warnings

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoFix all sorts of string formatting issues
Michael Tremer [Thu, 6 Mar 2025 17:43:17 +0000 (17:43 +0000)] 
Fix all sorts of string formatting issues

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agotests: Make bit length mismatch message clearer
Michael Tremer [Thu, 6 Mar 2025 16:53:44 +0000 (16:53 +0000)] 
tests: Make bit length mismatch message clearer

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Upload logs from tests in src/, too
Michael Tremer [Thu, 6 Mar 2025 16:43:29 +0000 (16:43 +0000)] 
jenkins: Upload logs from tests in src/, too

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agotree: Try harder to merge networks
Michael Tremer [Thu, 6 Mar 2025 16:37:09 +0000 (16:37 +0000)] 
tree: Try harder to merge networks

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agotree: Add network to the stack after we have tried again
Michael Tremer [Thu, 6 Mar 2025 16:24:46 +0000 (16:24 +0000)] 
tree: Add network to the stack after we have tried again

If we add it before, we will try to merge the network with itself which
is not necessary as it will never result in anything good.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoconfigure: Make Lua check work on Fedora, too
Michael Tremer [Thu, 6 Mar 2025 15:48:55 +0000 (15:48 +0000)] 
configure: Make Lua check work on Fedora, too

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Install lua-unit wherever available
Michael Tremer [Thu, 6 Mar 2025 15:18:56 +0000 (15:18 +0000)] 
jenkins: Install lua-unit wherever available

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoconfigure: Don't run Lua tests if luaunit is not available
Michael Tremer [Thu, 6 Mar 2025 15:13:25 +0000 (15:13 +0000)] 
configure: Don't run Lua tests if luaunit is not available

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agodebian: Don't build packages against Lua
Michael Tremer [Thu, 6 Mar 2025 15:08:12 +0000 (15:08 +0000)] 
debian: Don't build packages against Lua

This is a little bit more complicated, because we probably want to build
against multiple versions and I don't know how to do this.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Actually install Lua when we want to build against it
Michael Tremer [Thu, 6 Mar 2025 15:07:00 +0000 (15:07 +0000)] 
jenkins: Actually install Lua when we want to build against it

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Add all supported Debian architectures
Michael Tremer [Thu, 6 Mar 2025 15:03:51 +0000 (15:03 +0000)] 
jenkins: Add all supported Debian architectures

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoconfigure: Fail if Lua was enabled, but not found
Michael Tremer [Thu, 6 Mar 2025 15:00:58 +0000 (15:00 +0000)] 
configure: Fail if Lua was enabled, but not found

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Remove extra tests we currently don't support
Michael Tremer [Thu, 6 Mar 2025 14:44:42 +0000 (14:44 +0000)] 
jenkins: Remove extra tests we currently don't support

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Don't expect any tests to fail
Michael Tremer [Thu, 6 Mar 2025 14:42:15 +0000 (14:42 +0000)] 
jenkins: Don't expect any tests to fail

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Always Lua extension, too
Michael Tremer [Thu, 6 Mar 2025 14:42:05 +0000 (14:42 +0000)] 
jenkins: Always Lua extension, too

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoconfigure: Check syntax of Lua check
Michael Tremer [Thu, 6 Mar 2025 14:39:01 +0000 (14:39 +0000)] 
configure: Check syntax of Lua check

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoconfigure: Don't automatically detect systemdunitdir
Michael Tremer [Thu, 6 Mar 2025 14:36:31 +0000 (14:36 +0000)] 
configure: Don't automatically detect systemdunitdir

This is no longer possible on newer versions of systemd where the
variable has been removed from pkg-config.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agojenkins: Initial import
Michael Tremer [Thu, 6 Mar 2025 11:42:50 +0000 (11:42 +0000)] 
jenkins: Initial import

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agodata: Import today's database
Michael Tremer [Sat, 28 Sep 2024 12:51:56 +0000 (12:51 +0000)] 
data: Import today's database

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agopo: Update POTFILES.in
Michael Tremer [Sat, 28 Sep 2024 12:48:20 +0000 (12:48 +0000)] 
po: Update POTFILES.in

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 months agoperl: Return nothing in case invalid data has been passed to libloc
Stefan Schantl [Sat, 28 Sep 2024 12:46:31 +0000 (14:46 +0200)] 
perl: Return nothing in case invalid data has been passed to libloc

The old croach approch instantly will stop the script if invalid data
will be passed to libloc and also will fail to proper execute the
testsuite.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
3 months agoimporter: Don't import /4 or /10 networks from the routing table
Michael Tremer [Fri, 10 Jan 2025 13:38:35 +0000 (13:38 +0000)] 
importer: Don't import /4 or /10 networks from the routing table

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
4 months agoimporter: Ignore any sudden disconnects when we fetch a Geofeed
Michael Tremer [Mon, 6 Jan 2025 11:00:10 +0000 (11:00 +0000)] 
importer: Ignore any sudden disconnects when we fetch a Geofeed

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
7 months agoimporter: Update a few AWS locations
Michael Tremer [Wed, 2 Oct 2024 18:33:24 +0000 (18:33 +0000)] 
importer: Update a few AWS locations

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
7 months agoperl: Fix a couple of NULL-pointer derefences in the module
Michael Tremer [Thu, 26 Sep 2024 20:25:57 +0000 (20:25 +0000)] 
perl: Fix a couple of NULL-pointer derefences in the module

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
7 months agolibloc: Refactor summarizing IP address ranges
Michael Tremer [Thu, 26 Sep 2024 19:48:03 +0000 (19:48 +0000)] 
libloc: Refactor summarizing IP address ranges

The algorithm seems to have had some bugs where it generated too many
unnecessary subnets which caused the system to run out of memory very
quickly when determining bogons.

This version of the algorithm is now a little bit smarter and should be
significantly faster as well.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
7 months agotests: lua: Set a variable to true if we are checking for a boolean later
Michael Tremer [Thu, 26 Sep 2024 16:45:52 +0000 (16:45 +0000)] 
tests: lua: Set a variable to true if we are checking for a boolean later

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
7 months agolua: Ensure that the testsuite is being executed with the correct version
Michael Tremer [Thu, 26 Sep 2024 14:52:38 +0000 (14:52 +0000)] 
lua: Ensure that the testsuite is being executed with the correct version

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
7 months agolua: Check if we got returned something on some tests
Michael Tremer [Thu, 26 Sep 2024 14:37:22 +0000 (14:37 +0000)] 
lua: Check if we got returned something on some tests

Since Lua does not know about exceptions, functions usually return nil
instead of some value.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
10 months agoimporter: Ensure that we set timestamps in the announcements table
Michael Tremer [Wed, 19 Jun 2024 09:36:26 +0000 (09:36 +0000)] 
importer: Ensure that we set timestamps in the announcements table

Otherwise aging out older announcements does not work.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agolua: Fix raising an exception if no network was found
Michael Tremer [Wed, 22 May 2024 18:12:04 +0000 (18:12 +0000)] 
lua: Fix raising an exception if no network was found

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agodatabase: Have the lookup function return 0 even if nothing was found
Michael Tremer [Wed, 22 May 2024 16:39:57 +0000 (16:39 +0000)] 
database: Have the lookup function return 0 even if nothing was found

This is a potentially breaking change, but I think we need to do this as
the previous return code was not very descriptive.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agolua: Implement setting a log callback function
Michael Tremer [Wed, 22 May 2024 15:35:28 +0000 (15:35 +0000)] 
lua: Implement setting a log callback function

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agolibloc: Allow passing a pointer to the log callback
Michael Tremer [Wed, 22 May 2024 15:30:31 +0000 (15:30 +0000)] 
libloc: Allow passing a pointer to the log callback

This is basically re-implemnting the logic to pass log settings as the
previous functions were inappropriately named.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agoRevert "database: Re-open the file handle in r+ mode"
Michael Tremer [Tue, 21 May 2024 15:46:31 +0000 (15:46 +0000)] 
Revert "database: Re-open the file handle in r+ mode"

This reverts commit 7654a5beb9b46758af613f15e01f8e0d0b3bd730.

This change breaks the library on Linux.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agolua: Initialize the database object pointer
Michael Tremer [Tue, 21 May 2024 15:34:57 +0000 (15:34 +0000)] 
lua: Initialize the database object pointer

Unfortunately Lua does not initialize any new user data. Therefore it
could happen that the cleanup function will try to tidy up after a new
Database object could not be set up correctly and cause a segmentation
fault.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agoconfigure: Scan for multiple Lua versions
Michael Tremer [Tue, 21 May 2024 15:11:23 +0000 (15:11 +0000)] 
configure: Scan for multiple Lua versions

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agodatabase: Re-open the file handle in r+ mode
Michael Tremer [Sat, 11 May 2024 11:10:06 +0000 (12:10 +0100)] 
database: Re-open the file handle in r+ mode

On Mac OS, we cannot re-read our temporary file from the testsuite unless we re-open in r+ mode.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agowriter: Move the cursor back to end when finished writing
Michael Tremer [Sat, 11 May 2024 10:56:26 +0000 (11:56 +0100)] 
writer: Move the cursor back to end when finished writing

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agowriter: Fail if the header could not be written successfully
Michael Tremer [Sat, 11 May 2024 10:55:46 +0000 (11:55 +0100)] 
writer: Fail if the header could not be written successfully

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agoMakefile: Don't try to use -export-symbols if --version-script= isn't available
Michael Tremer [Fri, 10 May 2024 17:51:45 +0000 (18:51 +0100)] 
Makefile: Don't try to use -export-symbols if --version-script= isn't available

libtool seems to mess up our symbol table by prepending an underscore character
to all lines which renders the file unparsable.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
11 months agoconfigure: Use pkg-config to find OpenSSL
Michael Tremer [Fri, 10 May 2024 17:23:57 +0000 (18:23 +0100)] 
configure: Use pkg-config to find OpenSSL

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
12 months agoimporter: Drop EDROP as it has been merged into DROP
Michael Tremer [Thu, 11 Apr 2024 17:45:18 +0000 (17:45 +0000)] 
importer: Drop EDROP as it has been merged into DROP

http://www.spamhaus.org/resource-hub/network-security/spamhaus-drop-and-edrop-to-become-a-single-list/

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
12 months agolua: Add method to access database creation time
Michael Tremer [Mon, 8 Apr 2024 10:24:21 +0000 (10:24 +0000)] 
lua: Add method to access database creation time

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agolua: Add function that returns subnets of a network
Michael Tremer [Sat, 6 Apr 2024 11:11:28 +0000 (11:11 +0000)] 
lua: Add function that returns subnets of a network

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agonetwork: Add function to return a reverse pointer for networks
Michael Tremer [Sat, 6 Apr 2024 10:49:41 +0000 (10:49 +0000)] 
network: Add function to return a reverse pointer for networks

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agotests: Set LD_LIBRARY_PATH
Michael Tremer [Sat, 6 Apr 2024 10:33:33 +0000 (10:33 +0000)] 
tests: Set LD_LIBRARY_PATH

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoaddress: Add functions to access a specific byte/nibble in an address
Michael Tremer [Sat, 6 Apr 2024 10:33:06 +0000 (10:33 +0000)] 
address: Add functions to access a specific byte/nibble in an address

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agolua: Cleanup any database iterators
Michael Tremer [Fri, 5 Apr 2024 15:58:53 +0000 (15:58 +0000)] 
lua: Cleanup any database iterators

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agolua: Create a simple iterator for all networks
Michael Tremer [Fri, 5 Apr 2024 15:36:14 +0000 (15:36 +0000)] 
lua: Create a simple iterator for all networks

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agotests: Fix bit length tests
Michael Tremer [Fri, 5 Apr 2024 15:31:31 +0000 (15:31 +0000)] 
tests: Fix bit length tests

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agolua: Don't raise an error if a network cannot be found
Michael Tremer [Sun, 31 Mar 2024 16:33:34 +0000 (16:33 +0000)] 
lua: Don't raise an error if a network cannot be found

The lookup function now returns nil which is easier to handle than
catching a Lua error.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agolua: Add compatibility function to compile with Lua >= 5.1
Michael Tremer [Sun, 31 Mar 2024 14:16:14 +0000 (14:16 +0000)] 
lua: Add compatibility function to compile with Lua >= 5.1

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agotests: Add tests for #13236
Michael Tremer [Fri, 22 Mar 2024 14:45:41 +0000 (14:45 +0000)] 
tests: Add tests for #13236

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agonetwork: Fix handling bit length on merge
Michael Tremer [Fri, 22 Mar 2024 14:42:30 +0000 (14:42 +0000)] 
network: Fix handling bit length on merge

The check was kind of useless because of incorrect values from the bit
length function.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoaddress: Fix bit length calculation
Michael Tremer [Fri, 22 Mar 2024 14:41:44 +0000 (14:41 +0000)] 
address: Fix bit length calculation

I have no idea what the previous version computed, but it wasn't the
right thing.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Permit Geofeeds for everything instead of ignoring
Michael Tremer [Tue, 19 Mar 2024 10:45:41 +0000 (10:45 +0000)] 
importer: Permit Geofeeds for everything instead of ignoring

This seems to become the default and so we should avoid making the
overrides file too verbose.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Drop even more indexes
Michael Tremer [Mon, 18 Mar 2024 17:12:57 +0000 (17:12 +0000)] 
importer: Drop even more indexes

We have gone a little bit wild on this but should not need them.

This patch also migrates any GIST indexes to SP-GIST.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Drop any indexes we no longer need
Michael Tremer [Mon, 18 Mar 2024 17:05:36 +0000 (17:05 +0000)] 
importer: Drop any indexes we no longer need

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Make the export 200x faster
Michael Tremer [Mon, 18 Mar 2024 16:56:50 +0000 (16:56 +0000)] 
importer: Make the export 200x faster

The export became a huge problem here as it was very slow. One large
query produced one very large output which was difficult to test and
validate as the total export could easily take 17-20 hrs.

This patch fixes this so that the export now takes around ~5min. Sadly
we are still not using more than one processor core, because PostgreSQL
thinks its faster with just the one, but we trade a lot of CPU time for
a little bit of extra memory instead.

We create a new temporary table that holds all networks that we are
interested in. We then run a couple of broken down queries that perform
one thing instead of multiple at the same time.

First, we add all AS numbers, then all countries which are the longest
queries taking now around 20-30s. Then we apply any data from the
external feeds and our own overrides.

The final export requires about 1.7 GiB of memory because we don't
perform any deduplication in the database any more. That has been a lot
better implemented in our own code and I don't think that < 2 GiB is a
reason for concern.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Replace all GIST indexes with SP-GIST
Michael Tremer [Mon, 18 Mar 2024 16:56:08 +0000 (16:56 +0000)] 
importer: Replace all GIST indexes with SP-GIST

They are a lot faster for our application.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: ANALYZE all tables before we are running the export
Michael Tremer [Mon, 18 Mar 2024 16:52:26 +0000 (16:52 +0000)] 
importer: ANALYZE all tables before we are running the export

This should help the query planner to make better decisions when
planning the large queries.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Remove more traces of the Geofeed overrides table
Michael Tremer [Sat, 16 Mar 2024 11:34:21 +0000 (11:34 +0000)] 
importer: Remove more traces of the Geofeed overrides table

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Convert networks back to string
Michael Tremer [Tue, 12 Mar 2024 11:24:47 +0000 (11:24 +0000)] 
importer: Convert networks back to string

psycopg3 returns inet types as IP networks.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Allow storing multiple Geofeeds for the same network
Michael Tremer [Tue, 12 Mar 2024 11:17:50 +0000 (11:17 +0000)] 
importer: Allow storing multiple Geofeeds for the same network

This is very likely not required except for a couple of overrides.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 months agoimporter: Currently update the source when encountering a conflict
Michael Tremer [Tue, 12 Mar 2024 11:14:13 +0000 (11:14 +0000)] 
importer: Currently update the source when encountering a conflict

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