155 Commits

Author SHA1 Message Date
Ties de Kock 4900445114 Use debug level logging for hash change 2024-03-01 12:18:08 +01:00
Ties de Kock 4c1c8fab66 Store hash before decoding, do not parse broken file twice 2024-03-01 10:50:24 +01:00
Ties de Kock b93d7a8477 Merge pull request #117 from cjeker/avoid_empty_deltas
Avoid adding empty deltas to the cache
2024-03-01 09:36:03 +01:00
Claudio Jeker a1c36d6450 Minor cleanup as suggested by @ties 2024-03-01 09:30:33 +01:00
Ties de Kock c3652d335c Merge pull request #115 from netixx/hash-slurm
[stayrtr] add hash check on slurm data
2024-02-29 20:21:26 +01:00
Ties de Kock 78a0c69abe Merge pull request #116 from cjeker/fix_count_in_processData
Don't count the wrong things
2024-02-29 16:05:35 +01:00
netixx 834eb645da [stayrtr] add hash check on slurm data
Hash was already performed on cache/vrp data
this performs it for slurm as well,
preventing uneeded refreshes when neither
file have changed.

Partial fix for https://github.com/bgp/stayrtr/issues/114.
2024-02-29 14:58:26 +01:00
Claudio Jeker 277cd1e584 Return true or false from AddData().
Returns false and aborts the data addition if there is no change in the delta.
Use this to shortcut applyUpdateFromNewState() which prevents sending out
notifications for empty deltas.
2024-02-29 14:20:58 +01:00
Claudio Jeker 48740ff8c7 Adjust processData() test after removing the count return value 2024-02-29 12:47:48 +01:00
Claudio Jeker ae6c463482 The count makes little sense as a return value. Especially since it does not include the vap and bgpsec keys.
As a result reloadFromCurrentState() gets utterly confused and creates new versions when there is no change.
Fix for #114
2024-02-29 11:51:23 +01:00
netixx bbf0f39107 [stayrtr] add a metric for current serial number 2024-02-22 17:53:35 +01:00
Job Snijders 2dfc26e226 Merge pull request #107 from cjeker/naming_is_hard
Naming is hard
2023-12-21 16:21:03 +01:00
Claudio Jeker b91a5a53e5 Use basic functions from netip.Prefix to get the prefixlen and the
address length. No need to go around the block to get these values.
2023-12-21 15:51:15 +01:00
Claudio Jeker d1f8fb2b00 Another badly named function. CountVRPs does not return the number
of VRPs but the number of objects in the cache.
2023-12-21 14:22:09 +01:00
Claudio Jeker a5294449cf Try to bring more consistency in naming things.
The toplevel JSON object is now RPKIList and it contains VRPJson, VAPJson
and BgpSecKeyJson objects.
2023-12-21 14:18:47 +01:00
Claudio Jeker e7fd4221b5 Refactor some code that has no need to be this complicated 2023-12-21 11:18:37 +01:00
Claudio Jeker d48fbc79f4 Remove the AFI dependency for ASPA
The AFI was removed from the ASPA profile so don't expect it anymore.
Now RTR is still using an old idea of ASPA profile so there just
duplicate the object once for IPv4 and once for IPv6. At some points
SIDROPS may finally fix this but for now this allows to export ASPA
objects that follow the rpki-client JSON (which no longer has the
AFI in the ASPA table).
2023-12-21 11:17:27 +01:00
Job Snijders 3289b5d9b7 Merge pull request #103 from floatingstatic/structoptimize
Optimize VRP struct sizes. Use netip.Prefix instead of net.IPNet.
2023-12-21 09:21:41 +01:00
Claudio Jeker b8a26d220b Use a int64 for Unix time to make this code 2038 proof. 2023-12-19 17:09:48 +01:00
Job Snijders 8ded2cb68a RPKI is more than ROAs, rename the third-party source accordingly 2023-12-19 14:35:52 +00:00
Jeremiah Millay 236c4bf0dd Optimize VRP struct sizes. Use netip.Prefix instead of net.IPNet. 2023-12-18 10:50:26 -05:00
Ties de Kock cc37823b9d Remove NumberOfBRKs 2023-05-09 18:00:45 +02:00
Ties de Kock 1f2ba2a371 Log the number of router keys/vaps on update 2023-05-03 08:37:00 +02:00
Ties de Kock f545915dcc Add rpki_objects metric that tracks all object types 2023-05-03 08:18:15 +02:00
Ben Cartwright-Cox 5a3782245c Fix (false positive) test failure caused by the prev commit 2023-03-01 14:20:53 +00:00
Ben Cartwright-Cox 62f5952776 Fix lock/slow sending due to a lock "moshpit"
Instead we now sort while processing, a much much safer place to
do it!
2023-03-01 14:15:18 +00:00
Ben Cartwright-Cox 28752753e0 Harden ^b2a79528c5d221f46bdd766ce9c448714f3b62d5
It appears that the sorting function can be prone to data races.
This commit puts a lock on that.

Tag: https://github.com/bgp/stayrtr/issues/92
2023-02-27 16:03:03 +00:00
Ben Cartwright-Cox 94ab410dfe Add E2E testing for Slurm parsing for ASPA and BGPsec 2023-02-23 21:14:56 +00:00
Ben Cartwright-Cox 1e32148e7b Implement draft-spaghetti-sidrops-aspa-slurm-0 2023-02-23 20:40:20 +00:00
Ben Cartwright-Cox fa548afcaf Rename BSK(s) (BGPsecKey) to BRK's to algin with rpki-client
And rename ASPA stuff to VAPs
2023-02-23 17:01:12 +00:00
Ben Cartwright-Cox c6ffc72060 Undo default cache endpoint change to Cloudflare
Was a mistake while testing. Since changing the defaults makes it
a lot easier to play with the debugger
2023-02-23 16:24:27 +00:00
Ben Cartwright-Cox 38feb049b4 Handle OctoRPKI's alternate build time metadata.
This fixes https://github.com/bgp/stayrtr/issues/44, otherwise
default settings means that OctoRPKI does not load correctly with
StayRTR.

Me and Job figure that its not worth supporting FORT files since
they have their own RTR-er.
2023-02-23 16:20:43 +00:00
Ben Cartwright-Cox c007dea967 Handle RTR version 2 hangups by suggesting the user manually downgrade
This currently happens with rtr.rpki.cloudflare.com:8282
2023-02-23 16:05:11 +00:00
Ben Cartwright-Cox b09f0e27f0 Set default StayRTR version to v2 (With ASPA support) 2023-02-23 15:56:30 +00:00
Ben Cartwright-Cox 0753777f1f Revert "Set default StayRTR version to 2"
This reverts commit f40e9ccf4e.

Cannot do this, Cloudflare's RTR server cannot deal with this
2023-02-23 12:21:03 +00:00
Ben Cartwright-Cox f40e9ccf4e Set default StayRTR version to 2
Addresses: https://github.com/bgp/stayrtr/pull/88#issuecomment-1440565663
2023-02-23 12:16:26 +00:00
Ben Cartwright-Cox 187410d9b6 Implment ASPA as defined in draft-ietf-sidrops-8210bis-10
Tag: https://github.com/bgp/stayrtr/issues/79
2023-02-22 17:18:46 +00:00
Ben Cartwright-Cox 9edbfb3ba1 Add basic BGPsec support to RTRMon
It is not pretty, I didnt really want to overhaul the whole tool
since I also use this tool to test my own releases of stayrtr.

So instead bgpsec router keys are injected as "special" VRPs.

Since RTRMon is not complying to a standard, I feel we can be more
flexible here.

Tag: https://github.com/bgp/stayrtr/issues/57
2023-02-22 11:40:15 +00:00
Ben Cartwright-Cox 539a99d76c More cleanup of unused functions and/or struct contents 2023-02-21 22:16:26 +00:00
Ben Cartwright-Cox 19ca7b27e9 Add BGPsec Router Key support to rtrdump
Tag: https://github.com/bgp/stayrtr/issues/57
2023-02-21 22:05:50 +00:00
Ben Cartwright-Cox 513bda0e5f Implement BGPsec support
This imports and exports BGPsec router key data, and exports router
key data out over RTR to supporting clients (any version higher than 1)

Since it's obvious that at some point there will be clients that will
have issues seeing a RouterKey PDU for the first time ever, I've
included a -disable.bgpsec flag to prevent them from being sent.

That way if someone is caught off guard during an upgrade, they can
disable it and keep upgrading.

Tag: https://github.com/bgp/stayrtr/issues/57
2023-02-21 21:55:50 +00:00
Ben Cartwright-Cox 925ac75c42 Move all []VRP's to []SendableData in prep to support non VRP things
This does a bunch of work (and it's not fully done, since VRP needs
to be converted into *VRP across the codebase to ensure that SetFlag()
works) to let what was the VRPManager diffing/dispatch system support
things that are not VRPs. We need to do this since we are looking
to support BGPsec Router Keys and ASPA objects soon. And a previous
attempt to write such support resulted in a unaccptable amount of
duplicate code.

Doing it this way will also make it a lot easier to extend StayRTR
to support whatever is after ASPA.
2023-02-21 20:40:00 +00:00
Ben Cox f8b0c87ec8 Merge pull request #83 from bgp/pledge
On OpenBSD restrict access to system calls with pledge()
2023-02-06 11:15:30 +00:00
Job Snijders bd5a54d54d Always automatically generate a RTR Session ID 2023-02-06 11:10:07 +00:00
Job Snijders d9b3679d0a On OpenBSD restrict access to system calls with pledge() 2023-01-30 21:25:21 +00:00
Ben Cartwright-Cox ba724ad290 Make slurm and vrp-json updates happen in parallel
Tag: https://github.com/bgp/stayrtr/issues/53
2023-01-25 23:57:38 +00:00
Ben Cartwright-Cox 52a52e1895 Update loop now updates on a predictable basis
Previously if you had a very slow backend, the refresh timer for a reload
would only start after the current refresh has finished.

Now the timer will run after the timer fires for the last one.

This helps avoid the client being torpedod by very slow backends

Tag: https://github.com/bgp/stayrtr/issues/53
2023-01-25 12:06:42 +00:00
Ben Cartwright-Cox 13659dd27e Filter VRPs if they have expired. Prevent stale JSON files from lingering
First, VRPs that have expiry times are now checked, and they are
filtered out at import time.

Second, If a VRP JSON file is too old, and the "current state"
(in the case of a update) is too old, the state will empty to avoid
routing on old data.

Third, Every time a refresh cycle now happens, the file is reprocessed
to check for expiry, if the resulting VRPs from that procesing changes
then a new update+serial is pushed

Tag: https://github.com/bgp/stayrtr/issues/15
2023-01-24 17:50:15 +00:00
Ben Cartwright-Cox 13186622bd Improve internal error messaging to match standard convention 2023-01-19 12:17:23 +00:00
Ben Cartwright-Cox 15503e8347 Use IP.Equal rather than bytes.compare
IP.Equal handles some edge cases inside how IP addresses are represented
rather than just flat out comparing some byte arrays blindly.
2023-01-19 12:15:41 +00:00