summaryrefslogtreecommitdiff
path: root/sysdep
AgeCommit message (Collapse)Author
2021-12-27BSD: Assume onlink flag on ifaces with only host addressesOndrej Zajicek (work)
The BSD kernel does not support the onlink flag and BIRD does not use direct routes for next hop validation, instead depends on interface address ranges. We would like to handle PtMP cases with only host addresses configured, like: ifconfig wg0 192.168.0.10/32 route add 192.168.0.4 -iface wg0 route add 192.168.0.8 -iface wg0 To accept BIRD routes with onlink next-hop, like: route 192.168.42.0/24 via 192.168.0.4%wg0 onlink BIRD would dismiss the route when receiving from the kernel, as the next-hop 192.168.0.4 is not part of any interface subnet and onlink flag is not kept by the BSD kernel. The commit fixes this by assuming that for routes received from the kernel, any next-hop is onlink on ifaces with only host addresses. Thanks to Stefan Haller for the original patch.
2021-11-24Directly mapped pages are kept for future use if temporarily not neededMaria Matejka
2021-06-17Nest: Clean up main channel handlingOndrej Zajicek (work)
Remove assumption that main channel is the only channel.
2021-06-06sysdep: Add wrapper to get random bytes - updateOndrej Zajicek (work)
Simplify the code and fix an issue with getentropy() return value.
2021-06-06sysdep: Add wrapper to get random bytesToke Høiland-Jørgensen
Add a wrapper function in sysdep to get random bytes, and required checks in configure.ac to select how to do it. The configure script tries, in order, getrandom(), getentropy() and reading from /dev/urandom.
2021-05-10BSD: Propagate OS-level IFF_MULTICAST to internal IF_MULTICAST flagToke Høiland-Jørgensen
The BSD code did not propagate the OS-level IFF_MULTICAST flag to the Bird-internal IF_MULTICAST flag, which causes problems with Wireguard interfaces on FreeBSD. The Linux sysdep code does propagate the flag already, so just copy over the same check and flag update.
2021-04-19BSD: Fix invalid pointer derefence in logging codeStefan Haller
For logging purposes a stack allocated net_addr struct was passed by value as vararg (instead of the expected pointer). This resulted in a segfault when the specific error condition got logged.
2021-04-07Unix: Expand accepted ranges of iproute2 constantsOndrej Zajicek (work)
We support 32bit table and realm/flow ids, we should also accept them as constants. Thanks to Patrick Hemmer for the bugreport.
2021-03-30Routing table is now a resource allocated from its own poolMaria Matejka
This also fixes memory leaks from import/export tables being never cleaned up and freed.
2021-03-25Slab: head now uses bitmask for used/free nodes info instead of listsMaria Matejka
From now, there are no auxiliary pointers stored in the free slab nodes. This led to strange debugging problems if use-after-free happened in slab-allocated structures, especially if the structure's first member is a next pointer. This also reduces the memory needed by 1 pointer per allocated object. OTOH, we now rely on pages being aligned to their size's multiple, which is quite common anyway.
2021-03-18NEWS and version updatev2.0.8Ondrej Zajicek (work)
2021-03-12Rate-limit scheduling of work-eventsOndrej Zajicek (work)
In general, events are code handling some some condition, which is scheduled when such condition happened and executed independently from I/O loop. Work-events are a subgroup of events that are scheduled repeatedly until some (often significant) work is done (e.g. feeding routes to protocol). All scheduled events are executed during each I/O loop iteration. Separate work-events from regular events to a separate queue and rate limit their execution to a fixed number per I/O loop iteration. That should prevent excess latency when many work-events are scheduled at one time (e.g. simultaneous reload of many BGP sessions).
2021-02-10BGP: Add support for BGP hostname capabilityVincent Bernat
This is an implementation of draft-walton-bgp-hostname-capability-02. It is implemented since quite some time for FRR and in datacenter, this gives a nice output to avoid using IP addresses. It is disabled by default. The hostname is retrieved from uname(2) and can be overriden with "hostname" option. The domain name is never set nor displayed. Minor changes by committer.
2021-01-14Netlink: Ignore dead routesOndrej Zajicek (work)
With net.ipv4.conf.XXX.ignore_routes_with_linkdown sysctl, a user can ensure the kernel does not use a route whose target interface is down. Such route is marked with a 'dead' / RTNH_F_DEAD flag. Ignore these routes or multipath nexthops during scan. Thanks to Vincent Bernat for the original patch.
2021-01-07Kernel: Do not check templatesOndrej Zajicek (work)
So one can define kernel protocol template without channels. For other protocols, it is either irrelevant or already done. Thanks to Clemens Schrimpe for the bugreport.
2021-01-06Kernel: Fix handling of krt_realm with ECMP routesOndrej Zajicek (work)
For ECMP routes, RTA_FLOW attribute must be set per-nexthop, not per-route. Our corresponding krt_realm attribute is per-route. Thanks to Mikhail Petrov for the bugreport.
2020-11-25Log: Fix locking during log reconfigurationOndrej Zajicek (work)
The log subsystem should be locked earlier, as default_log_list() may internally manipulate with the current_log_list (if it is also a default log list).
2020-11-25Log: Reinitialize the static logging structuresOndrej Zajicek (work)
The static logging structures are reused, we need to reinitialize them otherwise add_tail() would fail in debug build. Reinitializing these structures should be fine as the list they belong to is being reinitialized on entry to the very same function. Thanks to Andreas Rammhold and Mikael Magnusson for patches.
2020-06-03Netlink: Fix parsing of MPLS multipath routesKazuki Yamaguchi
Add support for RTA_MULTIPATH attribute parsing for AF_MPLS routes. BIRD is capable of installing a multipath route into kernel on Linux, but it would not be seen because parsing fails. This made BIRD attempt to install the same route repeatedly. (The patch minorly updated by committer)
2020-06-03Log: Do not open logfiles when parse-and-exit option is activeOndrej Zajicek (work)
This is a quick workaround for an issue where configured logfiles are opened/created during parsing of a config file even when parse-and-exit option is active. We should later refactor the logging code to avoid opening log during parsing altogether.
2020-05-01Unix socket: Path length check directly before copying the path.Maria Matejka
This is not needed as the string is always short enough, anyway it may be needed in future and one strlen during BIRD start is cheap enough.
2020-05-01Nest: Added const to ea_show just to declare that this shouldn't really ↵Maria Matejka
change anything
2020-04-09Configuration strings are constant.Maria Matejka
This is merely a const propagation. There was no problem in there.
2020-03-07Netlink: Handle interfaces with missing broadcast addressesOndrej Zajicek (work)
2020-02-27BGP: Support for MD5SIG together with remote rangeOndrej Zajicek (work)
When dynamic BGP with remote range is configured, MD5SIG needs to use newer socket option (TCP_MD5SIG_EXT) to specify remote addres range for listening socket. Thanks to Adam Kułagowski for the suggestion.
2020-02-04Conf: Better error message when reading iproute2 configMaria Matejka
Reported by: Martin Weinelt <martin@darmstadt.freifunk.net>
2020-01-07KRT: Improve syncer code to avoid using temporary data in rtableOndrej Zajicek (work)
The old code stored route verdicts and temporary routes directly in rtable. The new code do not store received routes (it immediately compares them with exported routes and resolves conflicts) and uses internal bitmap to keep track of which routes were received and which needs to be reinstalled. By not putting 'invalid' temporary routes to rtable, we keep rtable in consistent state, therefore scan no longer needs to be atomic operation and could be splitted to multiple events.
2019-12-19KRT: Remove KRF_SYNC_ERROR flagOndrej Zajicek (work)
This info is now stored in an internal bmap. Unfortunately, net.flags is still needed for temporary kernel data.
2019-12-17KRT: Fix removal of KRF_INSTALLEDOndrej Zajicek (work)
Use route id from net->routes to check export_map. Route received from sysdep KRT code does not have proper id.
2019-12-16KRT: Remove KRF_INSTALLED flagOndrej Zajicek (work)
The same information is stored in export_map of kernel protocol.
2019-11-26Nest: Use bitmaps to keep track of exported routesOndrej Zajicek (work)
Use a hierarchical bitmap in a routing table to assign ids to routes, and then use bitmaps (indexed by route id) in channels to keep track whether routes were exported. This avoids unreliable and inefficient re-evaluation of filters for old routes in order to determine whether they were exported.
2019-11-12Netlink: Handle IPv4 routes with IPv6 nexthopsOndrej Zajicek
Accept RTA_VIA attribute in all cases. The old code always used RTA_GATEWAY for IPv4 / IPv6 and RTA_VIA for MPLS. The new code uses RTA_VIA in cases where AF of network and AF of nexthop differs.
2019-10-22Accept uppercase letters in iproute2 namesOndrej Zajicek
Names read from texfiles in /etc/iproute2/* are normalized by replacing non-alphanumeric chars with underscore. The patch fixes handling of uppercase letters, which were handled as non-alphanumberic. Thanks to Igor Gavrilov for the bugreport.
2019-10-11NEWS and version updatev2.0.7Ondrej Zajicek (work)
2019-10-09Lib: Support for 64-bit numbers in bvsnprintf()Ondrej Zajicek (work)
Use 'l' for s64/u64 instead of for long/ulong, as that is much more useful. Also make number() correct with regard to signed/unsigned typecasts.
2019-10-04Fixed undefined behavior on signals.Maria Matejka
The C11 specification allows only sig_atomic_t and _Atomic variable access. All other accesses to global variables are undefined behavior. Using int was probably OK on x86 and x86_64; yet there were some reports from other architectures (especially some MIPS) that in rare cases, after issuing SIGHUP, BIRD did strange things.
2019-09-23Nest: Fix help for 'graceful restart' commandOndrej Zajicek (work)
Multi-worded commands are not automatically added to top-level help output. Thanks to Christoph for the bugreport.
2019-09-10NEWS and version updatev2.0.6Ondrej Zajicek (work)
2019-08-21Sysdep: Drop supplementary groups when dropping GIDOndrej Zajicek (work)
We forgot to do that. Oops.
2019-07-31NEWS and version updateOndrej Zajicek (work)
2019-07-31Change 'graceful down' command to 'graceful restart' and update docsOndrej Zajicek (work)
The command initiating planned graceful restart including bird shutdown should be called 'graceful restart' instead of 'graceful down', as the later should be reserved for graceful shutdown in style of RFC 8326.
2019-07-30Log: Fixed race condition in reconfigure while BFD is runningMaria Matejka
2019-07-24Merge remote-tracking branch 'origin/mq-filter-stack'Ondrej Zajicek (work)
2019-07-23RPKI: Fix reconfiguration when ssh parameters are undefinedOndrej Zajicek (work)
2019-07-15Netlink: Fix parsing of multipath routes with MPLS labelsOndrej Zajicek (work)
2019-07-15Netlink: Use route replace for IPv4Ondrej Zajicek (work)
Use route replace netlink op instead of delete+add netlink ops for kernel IPv4 route replace. This avoids some packetloss during route replace. Still use the old behavior for IPv6, as some kernel bugs are hidden in IPv6 ECMP handling.
2019-07-10Merge branch 'master' into mq-filter-stackMaria Matejka
2019-07-10Debug: growing message format bufferMaria Matejka
This led in corner cases to undefined buffer content and garbage output.
2019-07-03Merge branch 'master' into mq-filter-stackMaria Matejka
2019-07-03Dynamic attributes definition split whether it is bitmask or not.Maria Matejka