summaryrefslogtreecommitdiff
path: root/sysdep/unix/io.c
AgeCommit message (Collapse)Author
2018-12-19IO: Workaround for broken FreeBSD behaviorOndrej Zajicek (work)
FreeBSD silently changes TTL to 1 when MSG_DONTROUTE is used, even when it is explicitly set to another value. That breaks TTL security sockets, including BFD which always uses TTL 255. Bad FreeBSD!
2018-09-18The MRT protocolOndrej Zajicek (work)
The new MRT protocol is responsible for periodic RIB table dumps in the MRT format (RFC 6396). Also the existing code for BGP4MP MRT dumps is refactored and splitted between BGP to MRT protocols, will be more integrated into MRT in the future. Example: protocol mrt { table "*"; filename "%N_%F_%T.mrt"; period 60; } It is partially based on the old MRT code from Pavel Tvrdik.
2018-07-28BSD: Use MSG_DONTROUTE for unicast packets on FreeBSDOndrej Zajicek (work)
BSD systems cannot use SO_DONTROUTE, because it does not work properly with multicast packets (perhaps it tries to find iface based on multicast group address). But we can use MSG_DONTROUTE sendmsg() flag for unicast packets. Works on FreeBSD, is ignored on OpenBSD and is broken on NetBSD (i guess due to integrated routing table and ARP table).
2018-01-23IO: Fix socket priorityOndrej Zajicek (work)
On Linux, setting the ToS will also set the priority and the range of accepted values is quite limited (masked by 0x1e). Therefore, 0xc0 is translated to a priority of 0, not something we want, overriding the "7" priority which was set previously explicitely. To avoid that, just move setting priority later in the code. Thanks to Vincent Bernat for the patch.
2017-09-06Basic VRF supportOndrej Zajicek (work)
Add basic VRF (virtual routing and forwarding) support. Protocols can be associated with VRFs, such protocols will be restricted to interfaces assigned to the VRF (as reported by Linux kernel) and will use sockets bound to the VRF. E.g., different multihop BGP instances can use diffent kernel routing tables to handle BGP TCP connections. The VRF support is preliminary, currently there are several limitations: - Recent Linux kernels (4.11) do not handle correctly sockets bound to interaces that are part of VRF, so most protocols other than multihop BGP do not work. This will be fixed by future kernel versions. - Neighbor cache ignores VRFs. Breaks config with the same prefix on local interfaces in different VRFs. Not much problem as single hop protocols do not work anyways. - Olock code ignores VRFs. Breaks config with multiple BGP peers with the same IP address in different VRFs. - Incoming BGP connections are not dispatched according to VRFs. Breaks config with multiple BGP peers with the same IP address in different VRFs. Perhaps we would need some kernel API to read VRF of incoming connection? Or probably use multiple listening sockets in int-new branch. - We should handle master VRF interface up/down events and perhaps disable associated protocols when VRF goes down. Or at least disable associated interfaces. - Also we should check if the master iface is really VRF iface and not some other kind of master iface. - BFD session request dispatch should be aware of VRFs. - Perhaps kernel protocol should read default kernel table ID from VRF iface so it is not necessary to configure it. - Perhaps we should have per-VRF default table.
2017-05-16Minor autoconf cleanup and documentation updateOndrej Zajicek (work)
2016-12-20Netlink: fix occasional netlink hangs on busy machinesJan Moskyto Matejka
2016-11-08Minor code cleanupsOndrej Zajicek (work)
2016-11-01Build: switch on -Wextra, get rid of most of the warningsJan Moskyto Matejka
There are several unresolved -Wmissing-field-initializers on older versions of GCC than 5.1, all of them false positive.
2016-09-29Kernel socket missing err_hook fixJan Moskyto Matejka
Thanks to Tim Weippert for bugreport.
2016-08-16whitespace fixesOndřej Surý
2016-05-30Unix IO: Tried to fix strange behavior after POLLHUP or POLLERR.Jan Moskyto Matejka
2016-05-12Prog Doc: Complete several missing parametersPavel Tvrdik
2016-05-03Initialize variable ifr in sk_setup()Pavel Tvrdik
==00:00:00:02.831 2468== Syscall param socketcall.setsockopt(optval) points to uninitialised byte(s) ==00:00:00:02.831 2468== at 0x513BDEA: setsockopt (in /usr/lib/libc-2.23.so) ==00:00:00:02.831 2468== by 0x45C7AF: sk_setup (io.c:1216) ==00:00:00:02.831 2468== by 0x45CDFF: sk_open (io.c:1417) ==00:00:00:02.831 2468== by 0x44B562: rip_open_socket (packets.c:740) ==00:00:00:02.831 2468== by 0x4481A7: rip_iface_locked (rip.c:616) ==00:00:00:02.831 2468== by 0x4133E4: olock_run_event (locks.c:177) ==00:00:00:02.831 2468== by 0x45A6DE: ev_run (event.c:85) ==00:00:00:02.831 2468== by 0x45A7AD: ev_run_list (event.c:142) ==00:00:00:02.831 2468== by 0x45E0FC: io_loop (io.c:2066) ==00:00:00:02.831 2468== by 0x463B56: main (main.c:845) ==00:00:00:02.831 2468== Address 0xffefffd24 is on thread 1's stack ==00:00:00:02.831 2468== in frame #1, created by sk_setup (io.c:1188) ==00:00:00:02.831 2468== Uninitialised value was created by a stack allocation ==00:00:00:02.831 2468== at 0x45C6BB: sk_setup (io.c:1188)
2016-04-13BSD: Add the IPsec SA/SP database entries controlOndrej Zajicek (work)
Add code for manipulation with TCP-MD5 keys in the IPsec SA/SP database at FreeBSD systems. Now, BGP MD5 authentication (RFC 2385) keys are handled automatically on both Linux and FreeBSD. Based on patches from Pavel Tvrdik.
2016-04-06IO: Avoid multiple event cycles in one loop cycle.Ondrej Zajicek (work)
Event cycle may took too much time and trigger next timer events, so avoid cycling between timer and event cycles inside the loop cycle.
2016-04-06IO: Replace RX priority heuristic with explicit markOndrej Zajicek (work)
In BIRD, RX has lower priority than TX with the exception of RX from control socket. The patch replaces heuristic based on socket type with explicit mark and uses it for both control socket and BGP session waiting to be established. This should avoid an issue when during heavy load, outgoing connection could connect (TX event), send open, but then failed to receive OPEN / establish in time, not sending notifications between and therefore got hold timer expired error from the neighbor immediately after it finally established the connection.
2016-03-30IO/Poll: fix mistaken variable mergeJan Moskyto Matejka
The events variable is used in the short loop decision. The reasons are not much clear, keeping this to keep the former behaviour.
2016-03-18Unix: Substituted select -> poll also in congestion checkerJan Moskyto Matejka
It does strange things when even one fd larger than FD_SETSIZE is passed to select().
2016-03-15Poll: Prevent the improbable case of EAGAIN after POLLINJan Moskyto Matejka
2016-03-11Unix: Rework of select-loop to poll-loopJan Moskyto Matejka
This should lift the limit of FD_SETSIZE and allow more than 1024 fd's. FD_SETSIZE limit doesn't matter now when creating new sockets.
2015-11-03IO: Fix the previous bugfixOndrej Zajicek (work)
I should check it after making some trivial changes. The original patch from Alexander has it right.
2015-11-03IO: Handle fd values too big for select()Ondrej Zajicek (work)
If the number of sockets is too much for select(), we should at least handle it with proper error messages and reject new sockets instead of breaking the event loop. Thanks to Alexander V. Chernikov for the patch.
2015-04-19Fixes port range socket optionOndrej Zajicek
2015-03-02Fixes bug in debug dumpsOndrej Zajicek
Using 'dump sockets' in IPv6 mode caused crash due to mismatched format string. Thanks to Pavel Tvrdik for noticing it.
2015-03-02Implement latency tracking, internal event log and watchdogOndrej Zajicek
2015-02-22Use IP_PORTRANGE_HIGH for BFD where availableOndrej Zajicek
2014-10-24Integrated IP functions.Ondrej Zajicek
2014-10-02Fixes some warnings.Ondrej Zajicek
2014-06-26Ensures that msg_controllen includes last padding.Ondrej Zajicek
Although RFC 3542 allows both cases, Theo de Raadt thinks he knows better, and msg_controllen without last padding fails on OpenBSD. Thanks to Job Snijders for the bugreport.
2014-05-18IPv4/IPv6 integrated socket code.Ondrej Zajicek
2014-02-06Many changes in I/O and OSPF sockets and packet handling.Ondrej Zajicek
I/O: - BSD: specify src addr on IP sockets by IP_HDRINCL - BSD: specify src addr on UDP sockets by IP_SENDSRCADDR - Linux: specify src addr on IP/UDP sockets by IP_PKTINFO - IPv6: specify src addr on IP/UDP sockets by IPV6_PKTINFO - Alternative SKF_BIND flag for binding to IP address - Allows IP/UDP sockets without tx_hook, on these sockets a packet is discarded when TX queue is full - Use consistently SOL_ for socket layer values. OSPF: - Packet src addr is always explicitly set - Support for secondary addresses in BSD - Dynamic RX/TX buffers - Fixes some minor buffer overruns - Interface option 'tx length' - Names for vlink pseudoifaces (vlinkX) - Vlinks use separate socket for TX - Vlinks do not use fixed associated iface - Fixes TTL for direct unicast packets - Fixes DONTROUTE for OSPF sockets - Use ifa->ifname instead of ifa->iface->name
2013-11-22Merge commit 'origin/bfd'Ondrej Zajicek
2013-11-22Fixes problem with RIP on multiple ifaces on BSD.Ondrej Zajicek
RIP sockets for multiple ifaces collided, because we cannot bind to a specific iface on BSD. Workarounded by SO_REUSEPORT. Thanks to Eugene M. Zheganin for the bugreport.
2013-11-19BFD protocol, ready for release.Ondrej Zajicek
Supports OSPF and BGP and also statically configured sessions.
2013-10-05Fixes some BFD bugs and makes logging thread-safe.Ondrej Zajicek
2013-09-16BFD work in progress.Ondrej Zajicek
Now it compiles and mostly works.
2013-09-10Initial BFD commit, work in progress.Ondrej Zajicek
2013-07-24Fixes header file name.Ondrej Zajicek
Thanks to Fritz Grimpen for the patch.
2013-07-11Some fixes for TTL security.Ondrej Zajicek
2013-06-25Implements TTL security for OSPF and RIP.Ondrej Zajicek
Interfaces for OSPF and RIP could be configured to use (and request) TTL 255 for traffic to direct neighbors. Thanks to Simon Dickhoven for the original patch for RIPng.
2013-06-24Better packet priority and traffic class handling.Ondrej Zajicek
Implements support for IPv6 traffic class, sets higher priority for OSPF and RIP outgoing packets by default and allows to configure ToS/DS/TClass IP header field and the local priority of outgoing packets.
2012-12-26Implements undo command and optional timeout for configurationOndrej Zajicek
Several new configure command variants: configure undo - undo last reconfiguration configure timeout - configure with scheduled undo if not confirmed in timeout configure confirm - confirm last configuration configure check - just parse and validate config file
2012-07-18Rename sk_new() to avoid name collision with OpenSSL.Ondrej Zajicek
2012-04-30Cleanup in sysdep KRT code, part 2.Ondrej Zajicek
Remove support for historic Linux kernels, merge krt-iface, krt-set and krt-scan stub headers.
2012-01-09Some minor fixes.Ondrej Zajicek
2012-01-08Better support for link-local addresses in IO code.Ondrej Zajicek
2011-08-16The generalized TTL security mechanism (RFC 5082) support.Ondrej Zajicek
Thanks to Alexander V. Chernikov for the patch.
2011-03-23Added header file.Ondrej Zajicek
2011-03-13Implements Router Advertisement protocol.Ondrej Zajicek