summaryrefslogtreecommitdiff
path: root/sysdep/unix/krt.c
AgeCommit message (Collapse)Author
2023-04-24Resource pools are now bound with domains.Maria Matejka
Memory allocation is a fragile part of BIRD and we need checking that everybody is using the resource pools in an appropriate way. To assure this, all the resource pools are associated with locking domains and every resource manipulation is thoroughly checked whether the appropriate locking domain is locked. With transitive resource manipulation like resource dumping or mass free operations, domains are locked and unlocked on the go, thus we require pool domains to have higher order than their parent to allow for this transitive operations. Adding pool locking revealed some cases of insecure memory manipulation and this commit fixes that as well.
2023-04-04Propagated const through route feed routinesMaria Matejka
2023-02-07Merge commit '0bb04d5390f21b0c96fc4894ba5d5510c541f0ef' into HEADMaria Matejka
2023-02-02Interface updates are asynchronousMaria Matejka
Instead of propagating interface updates as they are loaded from kernel, they are enqueued and all the notifications are called from a protocol-specific event. This change allows to break the locking loop between protocols and interfaces. Anyway, this change is based on v2 branch to keep the changes between v2 and v3 smaller.
2023-02-02Moved interface list flush to device protocol cleanup hook.Maria Matejka
The interface list must be flushed when device protocol is stopped. This was done in a hardcoded specific hook inside generic protocol routines. The cleanup hook was originally used for table reference counting late cleanup, yet it can be also simply used for prettier interface list flush.
2023-01-20Fixed various build problems on FreeBSD and/or CLangMaria Matejka
2022-11-30BSD: Fix krt socket code w.r.t. rte/rta changesOndrej Zajicek
2022-11-07Merge commit '0f2be469' into thread-nextMaria Matejka
2022-10-04Merge commit 'fb7fb674' into HEADMaria Matejka
2022-10-04Merge commit 'a32cee78' into HEADMaria Matejka
2022-10-04Merge commit '71b434a9' into HEADMaria Matejka
2022-10-04Merge commit '0072d11f' into tmp-learnMaria Matejka
2022-09-29Merge commit '9efaf6ba' into tmp-bad-learnMaria Matejka
Also fixed forgotten best route selection among alien routes.
2022-09-27Merge commit '4364ee' into tmp-bad-learnMaria Matejka
2022-09-27Merge commit 'cae5979871ee7aa341334f8b1af6bafc60ee9692' into tmp-bad-learnMaria Matejka
2022-09-27KRT: Fix route learningMaria Matejka
This is a reimplementation of commit 0f2be469f897b6d9f925563bbf522438c83522ea by Alexander Zubkov. In the master branch, changes in commit eb937358 broke setting of channel preference for alien routes learned during scan. The preference was set only for async routes. The original solution is extended here to accomodate for v3 specifics.
2022-09-27KRT: Fix setting default preferenceAlexander Zubkov
Changes in commit eb937358 broke setting of channel preference for alien routes learned during scan. The preference was set only for async routes. Move common attribute processing part of functions krt_learn_async() and krt_learn_async() to a separate function to have only one place for such changes.
2022-09-08Table access is now locked.Maria Matejka
2022-08-05Merge commit '534d0a4b' into thread-nextMaria Matejka
2022-08-02Merge commit 'f0507f05ce57398e135651896dace4cb68eeed54' into thread-nextMaria Matejka
2022-07-27Merge branch 'master' into backportOndrej Zajicek
2022-07-24KRT: Scan routing tables separetely on linux to avoid congestionOndrej Zajicek
Remove compile-time sysdep option CONFIG_ALL_TABLES_AT_ONCE, replace it with runtime ability to run either separate table scans or shared scan. On Linux, use separate table scans by default when the netlink socket option NETLINK_GET_STRICT_CHK is available, but retreat to shared scan when it fails. Running separate table scans has advantages where some routing tables are managed independently, e.g. when multiple routing daemons are running on the same machine, as kernel routing table modification performance is significantly reduced when the table is modified while it is being scanned. Thanks Daniel Gröber for the original patch and Toke Høiland-Jørgensen for suggestions.
2022-07-13Merge commit 'd429bc5c841a8e9d4c81786973edfa56d20a407e' into thread-nextMaria Matejka
2022-07-11Dropped the internal kernel protocol table for learnt routes.Maria Matejka
The learnt routes are now pushed all into the connected table, not only the best one. This shouldn't do any damage in well managed setups, yet it should be noted that it is a change of behavior. If anybody misses a feature which they implemented by misusing this internal learn table, let us know, we'll consider implementing it in a better way.
2022-07-11Merge commit 'beb5f78a' into backportMaria Matejka
2022-06-27Preexport callback now takes the channel instead of protocol as argumentMaria Matejka
Passing protocol to preexport was in fact a historical relic from the old times when channels weren't a thing. Refactoring that to match current extensibility needs.
2022-06-08Merge commit '938742decc6e1d6d3a0375dd012b75172e747bbc' into haugesundMaria Matejka
2022-06-08Merge commit '950775f6fa3d569a9d7cd05e33538d35e895d688' into haugesundMaria Matejka
There were quite a lot of conflicts in flowspec validation code which ultimately led to some code being a bit rewritten, not only adapted from this or that branch, yet it is still in a limit of a merge.
2022-05-30Merge commit 'f15f2fcee7eeb5a100bd204a0e67018e25953420' into haugesundMaria Matejka
2022-05-30Merge commit '337c04c45e1472d6d9b531a3c55f1f2d30ebf308' into haugesundMaria Matejka
2022-05-30Merge commit '17f91f9e6e70f7e3f29502e854823c0d48571eaa' into haugesundMaria Matejka
2022-05-30Merge commit 'f2f3163f6c3fba7f9ef03640d7b2f6323873d2cc' into haugesundMaria Matejka
2022-05-30Merge commit 'ef6a903e6f44b467f9606018446095521ad01ef1' into haugesundMaria Matejka
2022-05-30Merge commit '4a23ede2b056a41456790cc20a0c3d92a7137693' into haugesundMaria Matejka
2022-05-30Merge commit 'ebd807c0b8eb0b7a3dc3371cd4c87ae886c00885' into haugesundMaria Matejka
2022-05-30Squashing the route attribute structure into one level.Maria Matejka
For now, all route attributes are stored as eattrs in ea_list. This should make route manipulation easier and it also allows for a layered approach of route attributes where updates from filters will be stored as an overlay over the previous version.
2022-05-30Route destination field merged with nexthop attribute; splitting flowspec ↵Maria Matejka
validation result out. As there is either a nexthop or another destination specification (or othing in case of ROAs and Flowspec), it may be merged together. This code is somehow quirky and should be replaced in future by better implementation of nexthop. Also flowspec validation result has its own attribute now as it doesn't have anything to do with route nexthop.
2022-05-26Moved nexthop from struct rta to extended attribute.Maria Matejka
This doesn't do anything more than to put the whole structure inside adata. The overall performance is certainly going downhill; we'll optimize this later. Anyway, this is one of the latest items inside rta and in several commits we may drop rta completely and move to eattrs-only routes.
2022-05-04Moved route preference to eattrsMaria Matejka
2022-05-04Explicit definition structures of route attributesMaria Matejka
Changes in internal API: * Every route attribute must be defined as struct ea_class somewhere. * Registration of route attributes known at startup must be done by ea_register_init() from protocol build functions. * Every attribute has now its symbol registered in a global symbol table defined as SYM_ATTRIBUTE * All attribute ID's are dynamically allocated. * Attribute value custom formatting hook is defined in the ea_class. * Attribute names are the same for display and filters, always prefixed by protocol name. Also added some unit testing code for filters with route attributes.
2022-05-04Filters always allocate from tmp_linpoolMaria Matejka
2022-05-04Splitting route data structures out to libMaria Matejka
2022-04-06Protocols have their own explicit init routinesMaria Matejka
2021-11-22Route sources have an explicit ownerMaria Matejka
This commit prevents use-after-free of routes belonging to protocols which have been already destroyed, delaying also all the protocols' shutdown until all of their routes have been finally propagated through all the pipes down to the appropriate exports. The use-after-free was somehow hypothetic yet theoretically possible in rare conditions, when one BGP protocol authors a lot of routes and the user deletes that protocol by reconfiguring in the same time as next hop update is requested, causing rte_better() to be called on a not-yet-pruned network prefix while the owner protocol has been already freed. In parallel execution environments, this would happen an inter-thread use-after-free, causing possible heisenbugs or other nasty problems.
2021-11-22Special table hooks rectified.Maria Matejka
* internal tables are now more standalone, having their own import and export hooks * route refresh/reload uses stale counter instead of stale flag, allowing to drop walking the table at the beginning * route modify (by BGP LLGR) is now done by a special refeed hook, reimporting the modified routes directly without filters
2021-11-22Table import and export are now explicit hooks.Maria Matejka
Channels have now included rt_import_req and rt_export_req to hook into the table instead of just one list node. This will (in future) allow for: * channel import and export bound to different tables * more efficient pipe code (dropping most of the channel code) * conversion of 'show route' to a special kind of export * temporary static routes from CLI The import / export states are also updated to the new algorithms.
2021-11-09Split route data structure to storage (ro) / manipulation (rw) structures.Maria Matejka
Routes are now allocated only when they are just to be inserted to the table. Updating a route needs a locally allocated route structure. Ownership of the attributes is also now not transfered from protocols to tables and vice versa but just borrowed which should be easier to handle in a multithreaded environment.
2021-11-09Kernel routes are flushed on shutdown by kernel scan, not by table scanMaria Matejka
2021-11-09Secondary and merged exports get a whole feed instead of traversing the ↵Maria Matejka
table structures directly
2021-10-13RIP fixup + dropping the tmp_attrs mechanism as obsoleteMaria Matejka