Commit graph

135 commits

Author SHA1 Message Date
Maria Matejka 24773af9e0 Merge commit 'e42eedb9' into haugesund 2022-03-09 11:02:55 +01:00
Alexander Zubkov 87a02489f3 IO: Support nonlocal bind in socket interface
Add option to socket interface for nonlocal binding, i.e. binding to an
IP address that is not present on interfaces. This behaviour is enabled
when SKF_FREEBIND socket flag is set. For Linux systems, it is
implemented by IP_FREEBIND socket flag.

Minor changes done by commiter.
2022-01-08 19:02:31 +01:00
Ondrej Zajicek (work) a39cd2cc0b BSD: Assume onlink flag on ifaces with only host addresses
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-12-27 21:00:04 +01:00
Maria Matejka e42eedb912 Kernel: Convert the rte-local attributes to extended attributes and flags to pflags 2021-10-13 19:09:04 +02:00
Toke Høiland-Jørgensen b17adf0735 BSD: Propagate OS-level IFF_MULTICAST to internal IF_MULTICAST flag
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-05-10 19:49:43 +02:00
Stefan Haller a7c9515ebc BSD: Fix invalid pointer derefence in logging code
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-19 15:06:42 +02:00
Maria Matejka 258be56539 Nest: Added const to ea_show just to declare that this shouldn't really change anything 2020-05-01 15:19:12 +02:00
Maria Matejka fd9f0c0640 Configuration strings are constant.
This is merely a const propagation. There was no problem in there.
2020-04-09 15:37:14 +02:00
Ondrej Zajicek (work) 757cab18d6 BGP: Support for MD5SIG together with remote range
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-27 17:29:17 +01:00
Ondrej Zajicek (work) cc75b3e1dc KRT: Remove KRF_SYNC_ERROR flag
This info is now stored in an internal bmap. Unfortunately, net.flags
is still needed for temporary kernel data.
2019-12-19 16:34:35 +01:00
Ondrej Zajicek (work) a1ee5eb2aa BSD: Fix TCP-MD5 code on current FreeBSD kernels
Current FreeBSD kernels require SA records for both directions.

Thanks to Joseph Mulloy and Andrey V. Elsukov for reporting and
solving the issue.
2019-01-04 18:21:27 +01:00
Ondrej Zajicek (work) 318acb0f6c BSD: Use MSG_DONTROUTE for unicast packets on FreeBSD
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-07-28 16:54:06 +02:00
Ondrej Zajicek (work) d8e816c150 BSD: Fix of the previous commit 2018-06-27 17:10:01 +02:00
Jan Maria Matejka f851f0d7e3 Config: Dropping CF_ADDTO. 2018-06-26 14:29:03 +02:00
Jan Maria Matejka 13c0be19d3 Nest: Removing separate tmpa from route propagation
This is a fundamental change of an original (1999) concept of route
processing inside BIRD. During import/export, there was a temporary
ea_list created which was to be used instead of the another one inside
the route itself.

This led to some confusion, quirks, and strange filter code that handled
extended route attributes. Dropping it now.

The protocol interface has changed in an uniform way -- the
`struct ea_list *attrs` argument has been removed from store_tmp_attrs(),
import_control(), rt_notify() and get_route_info().
2018-05-30 17:08:49 +02:00
Ondrej Zajicek (work) 4d36796131 KRT: Fix direct routes for BSD
Old way to set direct routes is to use local IP as gateway, but that does
not work properly on newer FreeBSDs. Now we use sockaddr_dl containing
interface index as gateway.
2018-01-14 19:21:39 +01:00
Ondrej Zajicek (work) ac48e72bf6 Fix some minor issues 2017-12-12 15:57:14 +01:00
Ondrej Zajicek (work) 517d05dff1 Enable ECMP and Link detection by default
ECMP is not enabled on BSD, where it is not supported by BIRD.
2017-12-08 16:00:33 +01:00
Ondrej Zajicek (work) 4ff15a75c5 Merge commit '98bb80a243b58c43453e9be69d19d0350286549c' into int-new 2017-12-07 17:41:09 +01:00
Ondrej Zajicek (work) cd80c9b070 BSD: Fix in the last commit 2017-12-07 14:21:38 +01:00
Ondrej Zajicek (work) 7c454d9186 BSD: Minor fix of penultimate commit 2017-12-07 13:44:00 +01:00
Ondrej Zajicek (work) 153f02da3b Nest: Maintain separate IPv4, IPv6 and LLv6 preferred addresses
Also redesign preferred address selection and update protocols to use
appropriate preferred address.

Based on a previous work by Jan Maria Matejka.
2017-12-07 13:06:01 +01:00
Ondrej Zajicek (work) 9befc7cc4f BSD: Fix alignment issue
Incorrect structure alignment breaks kernel routing table updates on
FreeBSD/ARM (and perhaps other platforms).

Thanks to Eugene Sevastyanov for the original patch.
2017-09-04 22:32:45 +02:00
Ondrej Zajicek (work) b644a490f0 BSD: Fix address scan on OpenBSD 2017-04-29 18:37:51 +02:00
Ondrej Zajicek (work) 1d21306785 Minor fixes 2017-04-29 01:24:30 +02:00
Jan Moskyto Matejka c609d03986 Merge branch 'int-new' into nexthop-merged 2017-02-22 11:58:04 +01:00
Ondrej Zajicek (work) 62e64905b7 Several minor fixes 2017-02-20 02:26:45 +01:00
Ondrej Zajicek (work) c259669fa3 Merge branch 'master' into int-new 2017-02-08 14:34:48 +01:00
Ondrej Zajicek (work) f6e6c3b5a5 Fix IP_HDRINCL usage on FreeBSD 11
FreeBSD 11 changed endianity of ip_len field from host order to network
order. Also DragonFly BSD allegedly expects network order here.

Thanks to Olivier Cochard-Labbé for the patch.
2017-01-17 13:21:25 +01:00
Jan Moskyto Matejka 5b208e296f Removing (struct rta)->cast. Never used. 2016-12-22 13:09:59 +01:00
Jan Moskyto Matejka 4e276a8920 Merged multipath and single-path data structures.
Dropped struct mpnh and mpnh_*()
Now struct nexthop exists, nexthop_*(), and also included struct nexthop
into struct rta.

Also converted RTD_DEVICE and RTD_ROUTER to RTD_UNICAST. If it is needed
to distinguish between these two cases, RTD_DEVICE is equivalent to
IPA_ZERO(a->nh.gw), RTD_ROUTER is then IPA_NONZERO(a->nh.gw).

From now on, we also explicitely want C99 compatible compiler. We assume
that this 20-year norm should be known almost everywhere.
2016-12-22 13:01:06 +01:00
Ondrej Zajicek (work) 9b0a0ba9e6 Unit Testing for BIRD
- Unit Testing Framework (BirdTest)
 - Integration of BirdTest into the BIRD build system
 - Tests for several BIRD modules

 Based on squashed Pavel Tvrdik's int-test branch, updated for
 current int-new branch.
2016-11-09 16:36:34 +01:00
Ondrej Zajicek (work) 8860e991f6 Merge branch 'master' into int-new 2016-11-08 19:27:58 +01:00
Ondrej Zajicek (work) cc5b93f72d Merge tag 'v1.6.2' into int-new 2016-11-08 17:04:29 +01:00
Ondrej Zajicek (work) 7eec398875 BSD: Fix build on OpenBSD broken by previous commit 2016-11-01 16:20:04 +01:00
Jan Moskyto Matejka 3e236955c9 Build: switch on -Wextra, get rid of most of the warnings
There are several unresolved -Wmissing-field-initializers on older
versions of GCC than 5.1, all of them false positive.
2016-11-01 14:52:54 +01:00
Jan Moskyto Matejka ccd2a3eda2 Kernel socket missing err_hook fix
Thanks to Tim Weippert for bugreport.
2016-09-29 13:21:16 +02:00
Jan Moskyto Matejka 925aa14912 After-master-merge simple fixes.
BSD lib/setkey.h and lib/sysio.h #include fixes.
OpenBSD's flex needs -o param without space.
V6ONLY for SK_IP fix.
2016-05-24 12:12:14 +02:00
Ondrej Zajicek (work) 379f995940 BSD: Fix setkey in int-new branch 2016-05-17 16:19:50 +02:00
Ondrej Zajicek (work) af678af0d5 Merge remote-tracking branch 'origin/master' into int-new 2016-05-12 18:03:23 +02:00
Jan Moskyto Matejka 0c6dfe5236 Merge branch 'int-new' into int-new-merged 2016-05-10 14:30:49 +02:00
Jan Moskyto Matejka 7152e5efbb Build system reworked to one global Makefile with includes and no nesting
Also removed the lib-dir merging with sysdep. Updated #include's
accordingly.

Fixed make doc on recent Debian together with moving generated doc into
objdir.

Moved Makefile.in into root dir

Retired all.o and birdlib.a
Linking the final binaries directly from all the .o files.
2016-05-10 14:07:34 +02:00
Ondrej Zajicek (work) a7baa09862 BSD: Add the IPsec SA/SP database entries control
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-13 14:37:09 +02:00
Jan Moskyto Matejka 7a7ac65682 Merge branch 'master' into int-new-channels 2016-04-08 12:28:33 +02:00
Ondrej Zajicek (work) e86cfd41d9 KRT: Fix route learn scan when route changed
When a kernel route changed, function krt_learn_scan() noticed that and
replaced the route in internal kernel FIB, but after that, function
krt_learn_prune() failed to propagate the new route to the nest, because
it confused the new route with the (removed) old best route and decided
that the best route did not changed.

Wow, the original code (and the bug) is almost 17 years old.
2016-04-06 11:46:25 +02:00
Jan Moskyto Matejka ade389b326 BSD: compilation error fix 2016-02-01 10:28:50 +01:00
Jan Moskyto Matejka 2fad92144e BSD: fix no-return warning 2016-01-21 15:47:04 +01:00
Jan Moskyto Matejka 3f35816136 BSD: Explicitly dropping routes with mismatched AF's. 2016-01-21 14:55:33 +01:00
Jan Moskyto Matejka 8109eb765f BSD integration fixes 2016-01-20 12:05:16 +01:00
Ondrej Zajicek (work) 0bf95f99e6 Follow-up work on integration
Contains some patches from Jan Moskyto Matejka
2015-12-21 17:17:21 +01:00