summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-13Increase tests timeoutJakub Ružička
Tests may take longer than 5 s to complete on slow/virtual machines.
2023-04-04BGP: Fix bgp_med handlingOndrej Zajicek
Missing translation from BGP attribute ID to eattr ID in bgp_unset_attr() broke automatic removal of bgp_med during export to EBGP peers. Thanks to Edward Sun for the bugreport.
2023-03-18Add missing references to "show route in" in the cli-help and doc.Johannes Moos
The feature of showing all prefixes inside the given one has been added in v2.0.9 but not well documented. Fixing it by this update. Text in doc and commit message added by commiter.
2023-03-16BGP: Free bind applies also to outbound connectionsMaria Matejka
Even though the free bind option is primarily meant to alleviate problems with addresses assigned too late, it's also possible to use BIRD with AnyIP configuration, assigning whole ranges to the machine. Therefore free bind allows also to create an outbound connection from specific address even though such address is not assigned.
2023-03-06Net: Replace runtime checks with STATIC_ASSERT()Ondrej Zajicek
2023-03-06Printf test suite fails on systems with musl libc because tests for "%m"Petr Vaněk
and "%M" formats expect "Input/output error" message but musl returns "I/O error". Proposed change compares the printf output with string returned from strerror function for EIO constant. See-also: https://bugs.gentoo.org/836713 Minor change from committer.
2023-02-22Config: Dropping filter instruction trees after linearizationMaria Matejka
2023-02-22Linpool flush drops all the allocated pages but oneMaria Matejka
When a linpool is used to allocate a one-off big load of memory, it makes no sense to keep that amount of memory for future use inside the linpool. Contrary to previous implementations where the memory was directly free()d, we now use the page allocator which has an internal cache which keeps the released pages for us and subsequent allocations simply get these released pages back. And even if the page cleanup routine kicks in inbetween, the pages get only madvise()d, not munmap()ed so performance aspects are negligible. This may fix some memory usage peaks in extreme cases.
2023-02-19BGP: Update RFC referencesOndrej Zajicek
2023-02-19Babel: Update RFC referencesOndrej Zajicek
2023-02-19Conf: Fix too early free of old configurationOndrej Zajicek
The change 371eb49043d225d2bab8149187b813a14b4b86d2 introduced early free of old_config. Unfortunately, it did not properly check whether it is not still in use (blocked by obstacle during reconfiguration). Fix that. It also means that we still could have a short peak when three configs are in use (when a new reconfig is requeste while the previous one is still active).
2023-02-14Babel: Keep separate auth PC counters for unicast and multicastToke Høiland-Jørgensen
The babel protocol normally sends all its messages as multicast packets, but the protocol specification allows most messages to be sent as either unicast or multicast, and the two can be mixed freely. In particular, the babeld implementation can be configured to unicast updates to all peers instead of sending them as unicast. Daniel discovered that this can cause problems with the packet counter checks in the MAC extension due to packet reordering. This happens on WiFi networks where clients have power save enabled (which is quite common in infrastructure networks): in this case, the access point will buffer all multicast traffic and only send it out along with its beacons, leading to a maximum buffering in default Linux-based access point configuration of up to 200 ms. This means that a Babel sender that mixes unicast and multicast messages can have the unicast messages overtake the multicast messages because of this buffering; when authentication is enabled, this causes the receiver to discard the multicast message when it does arrive because it now has a packet counter value less than the unicast message that arrived before it. Daniel observed that this happens frequently enough that Babel ceases to work entirely when runner over a WiFi network. The issue has been described in draft-ietf-babel-mac-relaxed, which is currently pending RFC publication. That also describes two mitigation mechanisms: Keeping separate PC counters for unicast and multicast, and using a reorder window for PC values. This patch implements the former as that is the simplest, and resolves the particular issue seen on WiFi. Thanks to Daniel Gröber for the bugreport. Minor changes from committer.
2023-02-14Babel: Implement IPv4 via IPv6 extension (RFC 9229)Andreas Rammhold
The patch implements an IPv4 via IPv6 extension (RFC 9229) to the Babel routing protocol (RFC 8966) that allows annoncing routes to an IPv4 prefix with an IPv6 next hop, which makes it possible for IPv4 traffic to flow through interfaces that have not been assigned an IPv4 address. The implementation is compatible with the current Babeld version. Thanks to Toke Høiland-Jørgensen for early review on this work. Minor changes from committer.
2023-02-03Documentation: Adding roadmap as decided in January 2023Maria Matejka
2023-02-01Build: Partial revert of one of previous changesOndrej Zajicek
There are many compatibility issues with echo -e, scratch that.
2023-02-01Build: Minor improvement to build outputOndrej Zajicek
2023-02-01Nest: Minor cleanup in buildsystemOndrej Zajicek
There ware missing dependencies for proto-build.c generation, which sometimes lead to failed builds, and ignores changes in the set of built protocols. Fix that, and also improve formatting of proto-build.c
2023-01-31Babel: Initialise source seqno from incoming messageToke Høiland-Jørgensen
When creating a new babel_source object we initialise the seqno to 0. The caller will update the source object with the right metric and seqno value, for both newly created and old source objects. However if we initialise the source object seqno to 0 that may actually turn out to be a valid (higher) seqno than the one in the routing table, because of seqno wrapping. In this case the source metric will not be set properly, which breaks feasibility tracking for subsequent updates. To fix this, add a new initial_seqno argument to babel_get_source() which is used when allocating a new object, and set that to the seqno value of the update we're sending. Thanks to Juliusz Chroboczek for the bugreport.
2023-01-30Babel: Improve clarity of unfeasible update handling.Ondrej Zajicek
Add a comment and (unnecessary) check to make correctness obvious.
2023-01-30Babel: Fix missing modulo comparison of seqnosToke Høiland-Jørgensen
Juliusz noticed there were a couple of places we were doing straight inequality comparisons of seqnos in Babel. This is wrong because seqnos can wrap: so we need to use the modulo-64k comparison function for these cases as well. Introduce a strict-inequality version of the modulo-comparison for this purpose.
2023-01-23Small fix of indentingAlexander Zubkov
2023-01-23NEWS and version updatev2.0.12Ondrej Zajicek
2023-01-22BFD: Improve incoming packet matchingOndrej Zajicek
For active sessions, ignore received packets with zero local id and mismatched remote id. That forces a session timeout instead of an immediate session restart. It makes BFD sessions more resilient to packet spoofing. Thanks to André Grüneberg for the suggestion.
2023-01-22VRF: Fix issues with reconfigurationOndrej Zajicek
Protocols receive if_notify() announcements that are filtered according to their VRF setting, but during reconfiguration, they access iface_list directly and forgot to check VRF setting here, which leads to all interfaces be addedd. Fix this issue for Babel, OSPF, RAdv and RIP protocols. Thanks to Marcel Menzel for the bugreport.
2023-01-22Added test case for switch bug fixed in e20bef69ccc4a85ef62359ee539c9db2dbe09127Maria Matejka
2023-01-20BGP: Add received role value to role mismatch log messageOndrej Zajicek
2023-01-18Alloc: Minor cleanupsOndrej Zajicek
- Fix THP disable on old systems - Failed syscalls should use die() instead of bug() - Our printf uses %ld for s64 instead of long
2023-01-18Merge branch 'master' of https://gitlab.nic.cz/labs/birdMaria Matejka
2023-01-18Fix memory pre-allocationMaria Matejka
When BIRD has no free memory mapped, it allocates several pages in advance just to be sure that there is some memory available if needed. This hysteresis tactics works quite well to reduce memory ping-ping with kernel. Yet it had a subtle bug: this pre-allocation didn't take a memory coldlist into account, therefore requesting new pages from kernel even in cases when there were other pages available. This led to slow memory bloating. To demonstrate this behavior fast enough to be seen well, you may: * temporarily set the values in sysdep/unix/alloc.c as follows to exacerbate the issue: #define KEEP_PAGES_MAIN_MAX 4096 #define KEEP_PAGES_MAIN_MIN 1000 #define CLEANUP_PAGES_BULK 4096 * create a config file with several millions of static routes * periodically disable all static protocols and then reload config * log memory consumption This should give you a steady growth rate of about 16kB per cycle. If you don't set the values this high, the issue happens much more slowly, yet after 14 days of running, you are going to see an OOM kill. After this fix, pre-allocation uses the memory coldlist to get some hot pages and the same test as described here gets you a perfectly stable constant memory consumption (after some initial wobbling). Thanks to NIX-CZ for reporting and helping to investigate this issue. Thanks to Santiago for finding the cause in the code.
2023-01-17Filter: Allow setting the 'onlink' route attribute in filtersRadu Carpa
Add static route attribute to set onlink flag for route next hop. Can be used to build a dynamically routed IP-in-IP overlay network. Usage: ifname = "tunl0"; onlink = true; gw = bgp_next_hop;
2023-01-17Alloc: Disable transparent huge pagesOndrej Zajicek
The usage pattern implemented in allocator seems to be incompatible with transparent huge pages, as memory released using madvise(MADV_DONTNEED) with regular page size and alignment does not seem to trigger demotion of huge pages back to regular pages, even when significant number of pages is released. Even if demotion is triggered when system memory is low, it still breaks memory accounting.
2023-01-13Build: Fix cleanup of nest/proto-build.cOndrej Zajicek
2023-01-13Minor cleanupsOndrej Zajicek
2023-01-13BSD: Add support for kernel route metricOndrej Zajicek
Add support for kernel route metric/priority, exported as krt_metric attribute, like in Linux. This should also fix issues with overwriting or removing system routes.
2023-01-12Log message before abortingMike Crute
Log message before aborting due to watchdog timeout. We have to use async-safe write to debug log, as it is done in signal handler. Minor changes from committer.
2023-01-07Filter: Change linearization of branches in switch instructionOndrej Zajicek
Most branching instructions (FI_CONDITION, FI_AND, FI_OR) linearize its branches in a recursive way, while FI_SWITCH branches are linearized from parser even before the switch instruction is allocated. Change linearization of FI_SWITCH branches to make it similar to other branching instructions. This also fixes an issue with constant switch evaluation, where linearized branch is mistaken for non-linearized during switch construction. Thanks to Jiten Kumar Pathy for the bugreport.
2023-01-03BGP: Allow role specific keywords to be used as symbolsOndrej Zajicek
Some of these new BGP role keywords use generic names that collides with user-defined symbols. Allow them to be redefined. Also remove duplicit keyword definition for 'prefer'.
2023-01-03Configure: Expensive check option was broken, never workedOndrej Zajicek
2023-01-03Nest: Fix leaking internal attributes in RIP and BabelOndrej Zajicek
During backporting attribute changes from 3.0-branch, some internal attributes (RIP iface and Babel seqno) leaked to 'show route all' output. Allow protocols to hide specific attributes with GA_HIDDEN value. Thanks to Nigel Kukard for the bugreport.
2023-01-02Add compile-time option to enable 4-way tries instead of 16-way onesOndrej Zajicek
In some cases 16-way tries are too memory-heavy, while 4-way are almost as efficient as the original 2-way ones.
2023-01-01Nest: Fix several issues with pflagsOndrej Zajicek
There were some confusion about validity and usage of pflags, which caused incorrect usage after some flags from (now removed) protocol- specific area were moved to pflags. We state that pflags: - Are secondary data used by protocol-specific hooks - Can be changed on an existing route (in contrast to copy-on-write for primary data) - Are irrelevant for propagation (not propagated when changed) - Are specific to a routing table (not propagated by pipe) The patch did these fixes: - Do not compare pflags in rte_same(), as they may keep cached values like BGP_REF_STALE, causing spurious propagation. - Initialize pflags to zero in rte_get_temp(), avoid initialization in protocol code, fixing at least two forgotten initializations (krt and one case in babel). - Improve documentation about pflags
2022-12-24Babel: Rework seqno request handlingToke Høiland-Jørgensen
The seqno request retransmission handling was tracking the destination that a forwarded request was being sent to and always retransmitting to that same destination. This is unnecessary because we only need to retransmit requests we originate ourselves, not those we forward on behalf of others; in fact retransmitting on behalf of others can lead to exponential multiplication of requests, which would be bad. So rework the seqno request tracking so that instead of storing the destination of a request, we just track whether it was a request that we forwarded on behalf of another node, or if it was a request we originated ourselves. Forwarded requests are not retransmitted, they are only used for duplicate suppression, and for triggering an update when satisfied. If we end up originating a request that we previously forwarded, we "upgrade" the old request and restart the retransmit counter. One complication with this is that requests sent in response to unfeasible updates (section 3.8.2.2 of the RFC) have to be sent as unicast to a particular peer. However, we don't really need to retransmit those as there's no starvation when sending such a request; so we just change such requests to be one-off unicast requests that are not subject to retransmission or duplicate suppression. This is the same behaviour as babeld has for such requests. Minor changes from committer.
2022-12-18BSD: Use ip_mreqn on FreeBSD 12.1+ and OpenBSD 6.9+Ondrej Zajicek
2022-12-16FreeBSD: use interface index instead of IP address when specifying multicast ↵Alexander Chernikov
interface Minor changes from committer.
2022-12-16Netlink: move OS-specific headers and defines to sysdepAlexander Chernikov
Minor changes from committer.
2022-12-16BSD: Add missing makefile for bsd-netlink targetOndrej Zajicek
Use symlinks to linux/netlink* to avoid limitations of our buildsystem.
2022-12-11NEWS and version updatev2.0.11Ondrej Zajicek
2022-12-11BSD: Workaround for direct routes on FreeBSD 13.0Ondrej Zajicek
FreeBSD 13.0 added some safechecks for syscalls, rejecting sockaddrs that are too small, later versions loosen up the check.
2022-12-10BGP: Log unacceptable hold time as decimal numberOndrej Zajicek
Thanks Johannes Moos for the suggestion.
2022-12-10CLI: Fix for long-lived sessions during high loadsOndrej Zajicek
When there is a continuos stream of CLI commands, cli_get_command() always returns 1 (there is a new command). Anyway, the socket receive buffer was reset only when there was no command at all, leading to a strange behavior: after a while, the CLI receive buffer came to its end, then read() was called with zero size buffer, it returned 0 which was interpreted as EOF. The patch fixes that by resetting the buffer position after each command and moving remaining data at the beginning of buffer. Thanks to Maria Matejka for examining the bug and for the original bugfix.