]>
git.ipfire.org Git - location/libloc.git/log
Michael Tremer [Mon, 25 Nov 2019 16:56:26 +0000 (16:56 +0000)]
Bump version to 0.9.0
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 25 Nov 2019 16:55:08 +0000 (16:55 +0000)]
configure: Fix platform detection
Checking for GNU platforms now instead of just Linux.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Thu, 21 Nov 2019 14:51:51 +0000 (15:51 +0100)]
perl: Provide library location when running the testsuite
Otherwise the perl testsuite could not locate libloc and will fail.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 24 Nov 2019 21:05:23 +0000 (21:05 +0000)]
libresolv: Check different functions on different platforms
I could not find a function that is both present on Linux and
Mac OS X, so we now have to test differently.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 24 Nov 2019 20:58:03 +0000 (20:58 +0000)]
Make library build on Mac OS X
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 19 Oct 2019 11:10:26 +0000 (12:10 +0100)]
Fix building man pages on Mac OS X
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 24 Nov 2019 19:20:00 +0000 (19:20 +0000)]
downloader: Check DNS for most recent version
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 22 Nov 2019 14:08:22 +0000 (14:08 +0000)]
po: Update German translation
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 22 Nov 2019 14:07:49 +0000 (14:07 +0000)]
Makefile: Do not indent variable assignments
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 21 Nov 2019 12:48:18 +0000 (12:48 +0000)]
perl: Remove RPATH
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 17 Nov 2019 14:55:31 +0000 (14:55 +0000)]
location-downloader: Add man page
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 17 Nov 2019 14:52:24 +0000 (14:52 +0000)]
Add systemd unit files for location-downloader
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 17 Nov 2019 13:57:40 +0000 (13:57 +0000)]
location-downloader: Add proper logging infrastructure
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 17 Nov 2019 13:45:39 +0000 (13:45 +0000)]
Add download script to automatically update the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 15:58:59 +0000 (15:58 +0000)]
location-query: Add listing networks by flags
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 15:26:22 +0000 (15:26 +0000)]
Fix names of flags
They belong to the networks, so that should be reflected in the name.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 14:22:35 +0000 (14:22 +0000)]
location-query: Add output for ipset
Fixes: #12202
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 14:18:59 +0000 (14:18 +0000)]
location-query: Allow exporting data for nftables
Fixes: #12201
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 13:53:02 +0000 (13:53 +0000)]
location-query: Support listing networks for xt_geoip
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 11:22:56 +0000 (11:22 +0000)]
network: Initialize country code with nothing
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 11:20:08 +0000 (11:20 +0000)]
Improve error reporting when a network could not be read from the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 15 Nov 2019 11:14:39 +0000 (11:14 +0000)]
python: Raise error when a network/AS could not be read
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 22 Oct 2019 08:42:41 +0000 (08:42 +0000)]
test-stringpool: Include stdint.h on Linux
This is required to have intmax_t declared.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 19 Oct 2019 10:54:52 +0000 (11:54 +0100)]
Fix off_t casting in tests
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 19 Oct 2019 10:53:34 +0000 (11:53 +0100)]
database: Fix checking pointer
This always evaluated to true which is not what was intended here.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 19 Oct 2019 10:51:59 +0000 (11:51 +0100)]
Correct cast off_t to intmax_t before printing it
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 18 Oct 2019 18:43:59 +0000 (19:43 +0100)]
Merge branch 'apple'
Michael Tremer [Fri, 18 Oct 2019 18:43:27 +0000 (19:43 +0100)]
perl: Do not insist on Perl 5.28 or higher
We have no special requirements here.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 18 Oct 2019 18:36:21 +0000 (19:36 +0100)]
linker: Do not use --gc-sections on non-GNU platforms
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 18 Oct 2019 18:22:51 +0000 (19:22 +0100)]
country: Include compat.h to build on other arches
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 17 Oct 2019 15:45:19 +0000 (15:45 +0000)]
country: Fix comparison function
This return value was incorrect which caused that sorting
countries did not work and therefore could not been found
in the database any more.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 17 Oct 2019 15:45:06 +0000 (15:45 +0000)]
test: Add another country for test
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 16:18:26 +0000 (16:18 +0000)]
Detect if linker supports --version-script=
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 16:07:31 +0000 (16:07 +0000)]
Format off_t data types properly for printing
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 15:57:29 +0000 (15:57 +0000)]
Make package compile on Mac OS X
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 15:25:54 +0000 (15:25 +0000)]
Fall back to getenv() when secure_getenv() is not available
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 15:21:21 +0000 (15:21 +0000)]
python: Implement lookup function for countries
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 15:10:26 +0000 (15:10 +0000)]
python: Extend bindings for countries
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 15:06:31 +0000 (15:06 +0000)]
writer: Write countries before pool is being written
Otherwise the names will obviously not be written
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 14:44:36 +0000 (14:44 +0000)]
country: Fix segmentation fault when continent code is not set
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 14:01:30 +0000 (14:01 +0000)]
country: Remove string termination
This should not be necessary and overwrites the buffer
in some cases.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 13:58:07 +0000 (13:58 +0000)]
database format: Add some padding to header
This can be used to add things later without
incrementing the database version.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 13:56:14 +0000 (13:56 +0000)]
Fix re-ordering flags which are now only 16 bits
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 13:54:42 +0000 (13:54 +0000)]
country: Use one function to copy country codes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 13:40:02 +0000 (13:40 +0000)]
country: Add simple function to test if a country code is valid
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 13:30:05 +0000 (13:30 +0000)]
country: Fix SEGV when accessing the string pool
This was caused because I am too stupid to count to two.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 13:23:19 +0000 (13:23 +0000)]
database format: Reduce number of flags to 16
32 is very excessive and I hope we will never need that many.
Hence we reserve the remaining space.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 15 Oct 2019 13:20:20 +0000 (13:20 +0000)]
Add a dictionary with countries to the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 13 Oct 2019 17:41:34 +0000 (17:41 +0000)]
python: Use shorthand function to export __version__
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 13 Oct 2019 17:38:53 +0000 (17:38 +0000)]
python: Expose flags
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 13 Oct 2019 17:24:17 +0000 (17:24 +0000)]
Handle A1, A2, A3 as special cases when searching for countries
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 13 Oct 2019 17:02:51 +0000 (17:02 +0000)]
Implement searching for networks with a certain flag
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 13 Oct 2019 16:57:33 +0000 (16:57 +0000)]
Add flags for A1, A2 and A3
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 13 Oct 2019 16:49:57 +0000 (16:49 +0000)]
Add flags to network objects
This changes the database format on disk.
Flags can be used to mark networks in order to add more information
later than only ASN and CC.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 20:03:07 +0000 (20:03 +0000)]
man: Add location-query.8
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 19:14:47 +0000 (19:14 +0000)]
database: Print timings in milliseconds
We are so fast that seconds do not make any sense.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:47:37 +0000 (18:47 +0000)]
test: Fix compiling AS test after header change
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:44:49 +0000 (18:44 +0000)]
Merge branch 'perl'
Stefan Schantl [Wed, 2 Oct 2019 17:25:51 +0000 (19:25 +0200)]
perl: Testsuite: Add tests for lookup_asn()
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Wed, 2 Oct 2019 17:10:21 +0000 (19:10 +0200)]
perl: Add function to perform AS number lookups.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Wed, 2 Oct 2019 17:07:53 +0000 (19:07 +0200)]
perl: Testsuite: Add tests for invalid address and address not in the database.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Wed, 2 Oct 2019 17:07:52 +0000 (19:07 +0200)]
perl: Fix lookup if given address is invalid or not in DB.
In this case now undef will be returned.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:42:17 +0000 (18:42 +0000)]
location-query: Fix wrong variable name
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:41:38 +0000 (18:41 +0000)]
Implement listing all IP addresses in an AS
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:38:14 +0000 (18:38 +0000)]
database: Fix use-after-free error after last iteration of search
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:22:39 +0000 (18:22 +0000)]
Change how errors are handled by iterators
Instead of returning a pointer, we are returning an
exit code and a pointer is being set to the object.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:07:31 +0000 (18:07 +0000)]
location-query: Print usage when no action was given
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 18:02:07 +0000 (18:02 +0000)]
Implement listing networks in Python
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 15:47:48 +0000 (15:47 +0000)]
Implement filtering networks for the ASN they belong to
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 15:36:18 +0000 (15:36 +0000)]
Remove some dead code and add some comments
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 15:30:53 +0000 (15:30 +0000)]
Mark all nodes as non-visited after walk through tree has completed
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 15:20:09 +0000 (15:20 +0000)]
Free visited network nodes when enumerator is deallocated, too
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 3 Oct 2019 15:13:03 +0000 (15:13 +0000)]
Implement search through the network tree
This could not be implemented as a usual DFS since we cannot simply
have a recursive solution here and need to be able to break the
search at any time.
However, it needs to be tracked where in the graph we are when we
are walking through it to extract the informaton encoded into the
edges.
This is now solved by using a stack that keeps that information
as we walk through the graph.
This solution uses O(1) in memory since the stack can not be larger
than 256 nodes (the maximum path length should be 128).
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Wed, 2 Oct 2019 14:07:13 +0000 (14:07 +0000)]
libloc: Add function to set country code to database enumerator
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Wed, 2 Oct 2019 13:55:33 +0000 (13:55 +0000)]
location-query: Allow passing the database path
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 1 Oct 2019 12:24:04 +0000 (12:24 +0000)]
test: Generate database dynamically
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 1 Oct 2019 12:10:14 +0000 (12:10 +0000)]
perl: Use absolute paths for opening database
This makes distcheck happy which runs the build in a different
directory from the source directory.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 1 Oct 2019 12:09:43 +0000 (12:09 +0000)]
test: Include test database in tarball
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Tue, 1 Oct 2019 06:15:54 +0000 (08:15 +0200)]
perl: Add tests to testsuite.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Tue, 1 Oct 2019 06:02:03 +0000 (08:02 +0200)]
Add example database for testing purposes.
This example database and it's content can be used for
various testing purposes.
The testsuite of the perl bindings depends on it.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Tue, 1 Oct 2019 05:59:50 +0000 (07:59 +0200)]
examples: python/create-database.py: Add license to database
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 29 Sep 2019 14:21:48 +0000 (14:21 +0000)]
perl: Automatically build modules
Fixes: #12192
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 29 Sep 2019 13:08:54 +0000 (13:08 +0000)]
perl: Move perl module to src/perl
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Sun, 29 Sep 2019 09:55:56 +0000 (11:55 +0200)]
perl: Add function to gather the license of a database.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Sun, 29 Sep 2019 09:55:12 +0000 (11:55 +0200)]
perl: Add function to get the description of the database.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Stefan Schantl [Sun, 29 Sep 2019 09:53:46 +0000 (11:53 +0200)]
perl: Fix comments outside of a C code block.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 28 Sep 2019 16:30:02 +0000 (16:30 +0000)]
perl: Move database functions up and lookup functions down
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 28 Sep 2019 16:25:26 +0000 (16:25 +0000)]
perl: Rename lookup function to be more consistent with the Python bindings
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 28 Sep 2019 16:23:50 +0000 (16:23 +0000)]
perl: Rename database_get_vendor() to get_vendor(9
This function is being called on the database object, so it makes
sense to call it this as it is shorter.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 28 Sep 2019 16:23:04 +0000 (16:23 +0000)]
perl: MANIFEST: Drop ppport.h
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 28 Sep 2019 16:21:10 +0000 (16:21 +0000)]
perl: Remove another useless initialisation
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 28 Sep 2019 16:20:56 +0000 (16:20 +0000)]
perl: Return NULL when no country code was found
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 18:08:20 +0000 (18:08 +0000)]
perl: No need to copy vendor onto the heap
This is already and will be allocated as long as the database is
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 18:02:43 +0000 (18:02 +0000)]
perl: Mode code re-formatting
No functional changes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 17:55:54 +0000 (17:55 +0000)]
perl: Close database file after it has been read
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 17:55:35 +0000 (17:55 +0000)]
perl: perl does not allow to initialise the variables
They will always be NULL.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 17:45:16 +0000 (17:45 +0000)]
database: Free stringpool only after it has been initialised
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 17:39:38 +0000 (17:39 +0000)]
perl: Release location context when opening the database fails
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 17:26:05 +0000 (17:26 +0000)]
perl: Add some basic comments
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 26 Sep 2019 17:23:43 +0000 (17:23 +0000)]
perl: Improve error messages
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>