]>
git.ipfire.org Git - location/libloc.git/log
Stefan Schantl [Wed, 25 Sep 2019 13:59:48 +0000 (15:59 +0200)]
perl: Add perl bindings for libloc.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 16:20:35 +0000 (16:20 +0000)]
python: Avoid declaring loc_ctx multiple times
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 16:10:04 +0000 (16:10 +0000)]
Pass right variable to IN6_IN_ADDR_* functions
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 16:09:35 +0000 (16:09 +0000)]
Fix evaluation that always is true
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 12 Jan 2019 16:02:57 +0000 (16:02 +0000)]
python: Do not use any GNU-style initialisers for structs
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 14:22:36 +0000 (14:22 +0000)]
location-query: Use print to print errors, too
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 14:19:30 +0000 (14:19 +0000)]
Fix searching for ASes
The name of the AS has not been converted to lowercase
before which causes that we didn't find all ASes.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 14:18:15 +0000 (14:18 +0000)]
location-query: Implement searching for an AS that matches a string
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 14:14:19 +0000 (14:14 +0000)]
i18n: Ignore compiled translation files
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 14:13:48 +0000 (14:13 +0000)]
location-query: Implement getting information about an AS
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 14:06:36 +0000 (14:06 +0000)]
i18n: Add German translation
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 14:04:25 +0000 (14:04 +0000)]
Add internationalisation with intltool and gettext
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 13:39:27 +0000 (13:39 +0000)]
python: Raise proper error when database does not exist
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 13:33:38 +0000 (13:33 +0000)]
python: Expose version of the module
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 13:20:06 +0000 (13:20 +0000)]
Makefile: Configure database directory
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 13:00:44 +0000 (13:00 +0000)]
python: Add script to lookup database from command line
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 1 Feb 2018 11:54:01 +0000 (11:54 +0000)]
python: Add function to set log level
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Wed, 31 Jan 2018 21:45:21 +0000 (21:45 +0000)]
Fix getting wrong bits in IP addresses
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Wed, 31 Jan 2018 00:31:41 +0000 (00:31 +0000)]
test: Fix network test for non-existant address
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Wed, 31 Jan 2018 00:28:33 +0000 (00:28 +0000)]
database: Remove inexact match
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 23:29:52 +0000 (23:29 +0000)]
database: Walk down into the tree as much as possible first
Instead of stopping when we find the largest network that
matches, we will have to go as deep as we can and then
check all networks on the way from the bottom up.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 23:29:28 +0000 (23:29 +0000)]
network: Fix checking upper bound when matching IP addresses
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 23:28:21 +0000 (23:28 +0000)]
Refactor compating IP addresses
memcmp does not seem to be the best choice here.
This function is a naive implementation
but does the job very well.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 22:33:55 +0000 (22:33 +0000)]
database: Improve error logging when da network could not be loaded
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 22:30:46 +0000 (22:30 +0000)]
database: Encode prefix length into tree
To keep the tree smaller and to not have too many sparse
nodes in it that waste a lot of memory, we encode the
prefix now into the tree as depth.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 22:29:45 +0000 (22:29 +0000)]
network: Allow setting an empty country code
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 16:02:24 +0000 (16:02 +0000)]
python: Show country code that was invalid
Makes debugging easier
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 15:37:40 +0000 (15:37 +0000)]
python: Raise IndexError when adding the same network twice
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 15:24:45 +0000 (15:24 +0000)]
writer: Throw better exception when network address was invalid
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 30 Jan 2018 15:16:15 +0000 (15:16 +0000)]
network: Fix underflow in for loop when generating bitmask
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 19:00:19 +0000 (19:00 +0000)]
Fix another typo
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 25 Jan 2018 22:02:52 +0000 (22:02 +0000)]
python: Implement searching for ASes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 25 Jan 2018 21:26:48 +0000 (21:26 +0000)]
database: Implement searching for ASes that match a string
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 25 Jan 2018 20:44:45 +0000 (20:44 +0000)]
Add database enumerator interface to perform iterative searches
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 18:58:00 +0000 (18:58 +0000)]
When formatting an IP address only pass the actual IP address
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 18:56:00 +0000 (18:56 +0000)]
network: Fix calculating the last IP address of a network
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 18:42:21 +0000 (18:42 +0000)]
Correctly handle invalid IP addresses
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 18:36:49 +0000 (18:36 +0000)]
database: Make level variable unsigned (as used in log messages)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 18:29:29 +0000 (18:29 +0000)]
Fix typo in comparison function
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 18:25:28 +0000 (18:25 +0000)]
Fix typo
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 18:06:13 +0000 (18:06 +0000)]
database: Stop walking down the tree when we hit a leaf node
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:57:46 +0000 (17:57 +0000)]
Add license attribute to the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:46:17 +0000 (17:46 +0000)]
python: Save path when opening the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:41:47 +0000 (17:41 +0000)]
Remove test.db when running "make clean"
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:39:55 +0000 (17:39 +0000)]
Add a few examples that show how to use the python module
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:33:23 +0000 (17:33 +0000)]
python: Handle error codes when searching for an AS
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:25:37 +0000 (17:25 +0000)]
Install python module into correct location
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:14:53 +0000 (17:14 +0000)]
Drop loc_load function
We don't need this any more
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:11:33 +0000 (17:11 +0000)]
Hide all functions that we don't want to make public
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:03:05 +0000 (17:03 +0000)]
Remove loc_database_write which no longer exists from header
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 17:01:08 +0000 (17:01 +0000)]
writer: Move alignment into each section writer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 16:59:30 +0000 (16:59 +0000)]
python: Implement adding networks to Writer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 16:52:01 +0000 (16:52 +0000)]
database: Unmap all mapped sections when freeing database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 16:42:46 +0000 (16:42 +0000)]
python: Make lookup function available
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 16:30:24 +0000 (16:30 +0000)]
configure: Check for the existance of some headers
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 15:56:28 +0000 (15:56 +0000)]
database: Implement lookup
This allows to pass an IP address to the database and
to return the result
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Mon, 8 Jan 2018 11:55:58 +0000 (11:55 +0000)]
database: Implement reading a network from the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 7 Jan 2018 20:21:16 +0000 (20:21 +0000)]
database: Load networks from database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 7 Jan 2018 20:12:25 +0000 (20:12 +0000)]
database: Pass header to functions loading database sections
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 7 Jan 2018 20:09:44 +0000 (20:09 +0000)]
database: Map network nodes section when opening the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sun, 7 Jan 2018 13:32:51 +0000 (13:32 +0000)]
writer: Write out the network tree
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 5 Jan 2018 16:44:56 +0000 (16:44 +0000)]
network: Fix walking through the tree in order
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 5 Jan 2018 16:41:32 +0000 (16:41 +0000)]
test: Write a ASN to the network database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 5 Jan 2018 16:40:21 +0000 (16:40 +0000)]
One byte doesn't have to be converted to big endian
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 5 Jan 2018 16:35:46 +0000 (16:35 +0000)]
test: Write two test networks to the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 5 Jan 2018 16:30:46 +0000 (16:30 +0000)]
Declare a static function as static
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 5 Jan 2018 16:30:01 +0000 (16:30 +0000)]
test: Add a second network to a tree
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 5 Jan 2018 16:25:46 +0000 (16:25 +0000)]
network: Implement function to count all nodes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 2 Jan 2018 17:38:21 +0000 (17:38 +0000)]
network: Always use the first address of a network
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 2 Jan 2018 17:26:02 +0000 (17:26 +0000)]
Map prefix to IPv6 as well for IPv4 addresses
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 2 Jan 2018 17:17:57 +0000 (17:17 +0000)]
Validate the prefix to be within range
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Tue, 2 Jan 2018 17:07:03 +0000 (17:07 +0000)]
Prevent segmentation fault when no prefix is present
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 30 Dec 2017 16:35:56 +0000 (16:35 +0000)]
network: Support parsing IPv4 addresses and map them to IPv6
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Sat, 30 Dec 2017 15:26:14 +0000 (15:26 +0000)]
Make AS independent from stringpool
Strings are written to the string pool when a AS is written to
disk.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 20:39:04 +0000 (20:39 +0000)]
network: Add asn and remove reference to struct loc_as
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 20:21:45 +0000 (20:21 +0000)]
python: Implement Network class
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 19:52:17 +0000 (19:52 +0000)]
python: Implement setting description to the writer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 19:48:49 +0000 (19:48 +0000)]
python: Fix setters
Setters however expected a tuple instead of the value directly
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 19:47:38 +0000 (19:47 +0000)]
python: Implement adding an AS to the writer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 15:13:49 +0000 (15:13 +0000)]
python: Add write method to Writer
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:57:52 +0000 (14:57 +0000)]
python: Add Writer class
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:41:35 +0000 (14:41 +0000)]
writer: Correctly increase offset when writing ASes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:29:50 +0000 (14:29 +0000)]
python: Impement setting the name of an AS
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:25:34 +0000 (14:25 +0000)]
python: Implement comparison of ASes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:17:56 +0000 (14:17 +0000)]
python: Show better repr for AS classes
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:17:39 +0000 (14:17 +0000)]
as: Return NULL if name is not set
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:07:42 +0000 (14:07 +0000)]
python: Remove reference to context from database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:06:00 +0000 (14:06 +0000)]
python: Remove local stringpool and ctx from AS class
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 14:03:41 +0000 (14:03 +0000)]
python: Access ASes from database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 13:00:24 +0000 (13:00 +0000)]
python: Only use global loc context
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 12:02:21 +0000 (12:02 +0000)]
python: Create a global loc_ctx* context
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 11:53:02 +0000 (11:53 +0000)]
python: Add AS class
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 11:32:56 +0000 (11:32 +0000)]
python: Expose database creation time
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 11:27:30 +0000 (11:27 +0000)]
python: Expose database description and vendor
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 11:22:22 +0000 (11:22 +0000)]
headers: Don't make private structures public
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 11:20:30 +0000 (11:20 +0000)]
Move all header files into src/loc and install them
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Fri, 29 Dec 2017 11:10:01 +0000 (11:10 +0000)]
python: Add Database class
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 28 Dec 2017 18:32:45 +0000 (18:32 +0000)]
Start a Python module
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 28 Dec 2017 18:07:11 +0000 (18:07 +0000)]
Write networks to the database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Michael Tremer [Thu, 28 Dec 2017 16:55:33 +0000 (16:55 +0000)]
Allow creating networks in memory
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>