0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-19 20:05:21 +00:00
Commit Graph

305 Commits

Author SHA1 Message Date
Maria Matejka
ddf698ec99 Renamed nest/rt.h back to nest/route.h
Some [redacted] (yes, myself) had a really bad idea
to rename nest/route.h to nest/rt.h while refactoring
some data structures out of it.

This led to unnecessarily complex problems with
merging updates from v2. Reverting this change
to make my life a bit easier.

At least it needed only one find-sed command:

    find -name '*.[chlY]' -type f -exec sed -i 's#nest/rt.h#nest/route.h#' '{}' +
2023-10-29 16:29:26 +01:00
Maria Matejka
e6baff89f8 Merge commit '5951dfbd' into thread-next 2023-10-27 18:06:34 +02:00
Maria Matejka
21b75c472d Merge commit 'e3c0eca9' into thread-next 2023-10-13 11:04:39 +02:00
Maria Matejka
767b7b22a0 Merge commit '5121101136cb80151a9361c63dc4822afeb44eef' into thread-next 2023-10-12 14:12:33 +02:00
Ondrej Zajicek
e3c0eca956 Nest: Treat VRF interfaces as inside respective VRFs
Despite not having defined 'master interface', VRF interfaces should be
treated as being inside respective VRFs. They behave as a loopback for
respective VRFs. Treating the VRF interface as inside the VRF allows
e.g. OSPF to pick up IP addresses defined on the VRF interface.

For this, we also need to tell apart VRF interfaces and regular interfaces.
Extend Netlink code to parse interface type and mark VRF interfaces with
IF_VRF flag.

Based on the patch from Erin Shepherd, thanks!
2023-08-23 16:08:40 +02:00
Luiz Amaral
f8bcb037b5 Netlink: Allow RTA_VIA even without MPLS support
It is necessary for IPv4 over IPv6 nexthop support on FreeBSD,
and RTA_VIA is not really related to MPLS.

It breaks build for some very old systems like Debian 8 and CentOS 7,
but we generally do not support older kernels than 4.14 LTS anyway.
2023-06-15 16:07:36 +02:00
Maria Matejka
836e857b30 Sockets: Unified API for main and other loops
Now sk_open() requires an explicit IO loop to open the socket in. Also
specific functions for socket RX pause / resume are added to allow for
BGP corking.

And last but not least, socket reloop is now synchronous to resolve
weird cases of the target loop stopping before actually picking up the
relooped socket. Now the caller must ensure that both loops are locked
while relooping, and this way all sockets always have their respective
loop.
2023-04-04 17:00:59 +02:00
Maria Matejka
b8a230e478 Interface subsystem locking 2023-04-04 17:00:58 +02:00
Maria Matejka
521fec2fdc Merge commit '2b7643e1f8ecb0bd4cf9af4183b4fd53b655d19c' into thread-next 2023-01-22 13:19:22 +01:00
Maria Matejka
0f9df6d1bd Merge commit 'a80cd4707464cedb526eb72e7704b097af20beb7' into thread-next 2023-01-21 23:46:33 +01:00
Maria Matejka
343628d8c0 Fixed various build problems on FreeBSD and/or CLang 2023-01-20 18:31:57 +01:00
Alexander Chernikov
176fc68aed Netlink: move OS-specific headers and defines to sysdep
Minor changes from committer.
2022-12-16 19:21:51 +01:00
Alexander V. Chernikov
a80cd47074 Netlink on FreeBSD support
Netlink support was added to FreeBSD recently. It is not as full-featured
as its Linux counterpart yet, however the added subset is enough to make
a routing daemon work. Specifically, it supports multiple tables,
multipath, nexthops and nexthops groups. No MPLS support yet.

The attached change adds 'bsd-netlink’ sysconf target, allowing to build
both netlink & rtsock versions on FreeBSD.
2022-12-09 16:01:30 +01:00
Maria Matejka
40bae8e1b7 Merge commit '32425297' into thread-next 2022-11-07 10:25:52 +01:00
Ondrej Zajicek
3242529750 Netlink: Parse onlink flag even on direct routes
While onlink flag is meaningful only with explicit next hops, it can be
defined also on direct routes. Parse it also in this case to avoid
periodic updates of the same route.

Thanks to Marcin Saklak for the bugreport.
2022-10-12 17:57:26 +02:00
Maria Matejka
a414ba6b97 Merge commit 'e9e6baae' into HEAD 2022-10-04 16:02:23 +02:00
Maria Matejka
16ac6c3c74 Fixed initialization of Linux kernel route attributes 2022-08-18 17:44:00 +02:00
Maria Matejka
e9e6baae37 Merge commit '082905a8' into thread-next 2022-08-05 11:09:44 +02:00
Maria Matejka
a32cee7813 Merge commit '534d0a4b' into thread-next 2022-08-05 10:37:53 +02:00
Ondrej Zajicek
082905a833 Merge branch 'master' into backport 2022-07-27 00:47:24 +02:00
Ondrej Zajicek
ddb1bdf281 Netlink: Restrict route replace for IPv6
Seems like the previous patch was too optimistic, as route replace is
still broken even in Linux 4.19 LTS (but fixed in Linux 5.10 LTS) for:

  ip route add 2001:db8::/32 via fe80::1 dev eth0
  ip route replace 2001:db8::/32 dev eth0

It ends with two routes instead of just the second.

The issue is limited to direct and special type (e.g. unreachable)
routes, the patch restricts route replace for cases when the new route
is a regular route (with a next hop address).
2022-07-26 18:45:20 +02:00
Ondrej Zajicek
722daa9500 Netlink: Simplify handling of IPv6 ECMP routes
When IPv6 ECMP support first appeared in Linux kernel, it used different
API than IPv4 ECMP. Individual next hops were updated and announced
separately, instead of using RTA_MULTIPATH as in IPv4. This has several
drawbacks and requires complex code to merge received notifications to
one multipath route.

When Linux came with IPv6 RTA_MULTIPATH support, the initial versions
were somewhat buggy, so we kept using the old API for updates (splitting
multipath routes to sequences of route updates), while accepting both
old-style routes and RTA_MULTIPATH routes in scans / notifications.

As IPv6 RTA_MULTIPATH support is here for a long time, this patch fully
switches Netlink to the IPv6 RTA_MULTIPATH API and removes old complex
code for handling individual next hop announces.

The required Linux version is at least 4.11 for reliable operation.

Thanks to Daniel Gröber for the original patch.
2022-07-25 00:11:40 +02:00
Ondrej Zajicek
534d0a4b44 KRT: Scan routing tables separetely on linux to avoid congestion
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-24 02:15:20 +02:00
Maria Matejka
9efaf6bafe Dropped the internal kernel protocol table for learnt routes.
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-11 17:04:52 +02:00
Maria Matejka
4364ee9b6f Merge commit '938742decc6e1d6d3a0375dd012b75172e747bbc' into haugesund 2022-06-08 15:31:28 +02:00
Maria Matejka
cae5979871 Merge commit '950775f6fa3d569a9d7cd05e33538d35e895d688' into haugesund
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-06-08 11:47:49 +02:00
Maria Matejka
1493695c6b Merge commit 'f15f2fcee7eeb5a100bd204a0e67018e25953420' into haugesund 2022-05-30 17:37:08 +02:00
Maria Matejka
41508ceac3 Merge commit '1c30b689ddd032ef8000fb7836348a48ba3184ff' into haugesund 2022-05-30 17:26:25 +02:00
Maria Matejka
65254128e1 Merge commit '702c04fbef222e802ca4dfac645dc75ede522db6' into haugesund 2022-05-30 17:18:46 +02:00
Maria Matejka
5051e3c4af Merge commit '17f91f9e6e70f7e3f29502e854823c0d48571eaa' into haugesund 2022-05-30 16:59:24 +02:00
Maria Matejka
8b4b7c6eae Merge commit 'cf07d8ad79273a3bbf0617c17e438602e4b64ece' into haugesund 2022-05-30 16:52:38 +02:00
Maria Matejka
b3649ec77e Merge commit 'ef6a903e6f44b467f9606018446095521ad01ef1' into haugesund 2022-05-30 16:20:35 +02:00
Maria Matejka
54344f15f8 Merge commit '0d0f6554a5c233bf2bf830ae319191c4b1808d49' into haugesund 2022-05-30 15:43:13 +02:00
Maria Matejka
3752654852 Merge commit '80272d4b64a38ee6f04a1c4e8566cac3a2293176' into haugesund 2022-05-30 15:39:32 +02:00
Maria Matejka
45af19dd99 Merge commit '652be92a21f5575e5f74f6abe98eb4200b86776c' into haugesund 2022-05-30 15:36:54 +02:00
Maria Matejka
097f157182 Merge commit '692055e3df6cc9f0d428d3b0dd8cdd8e825eb6f4' into haugesund-to-2.0 2022-05-30 15:17:52 +02:00
Maria Matejka
938742decc Squashing the route attribute structure into one level.
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-30 14:39:09 +02:00
Maria Matejka
950775f6fa Route destination field merged with nexthop attribute; splitting flowspec 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-30 14:39:09 +02:00
Maria Matejka
f15f2fcee7 Moved nexthop from struct rta to extended attribute.
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-26 12:34:26 +02:00
Maria Matejka
1c30b689dd Moved route source attribute (RTS_*) to eattrs 2022-05-04 15:39:53 +02:00
Maria Matejka
702c04fbef Removing the route scope attribute. Use custom attributes instead.
The route scope attribute was used for simple user route marking. As
there is a better tool for this (custom attributes), the old and limited
way can be dropped.
2022-05-04 15:39:21 +02:00
Maria Matejka
cce974e8ea Conf: Allowing keyword redefinition
Some tokens are both keywords and symbols. For now, we allow only
specific keywords to be redefined; in future, more of the keywords may
be added to this category.

The redefinable keywords must be specified in any .Y file as follows:

  toksym: THE_KEYWORD ;

See proto/bgp/config.Y for an example.

Also dropped a lot of unused terminals.
2022-05-04 15:39:21 +02:00
Maria Matejka
17f91f9e6e Explicit definition structures of route attributes
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-04 15:39:19 +02:00
Maria Matejka
cf07d8ad79 Replaced boilerplate eattr allocation by ea_set_attr() 2022-05-04 15:38:40 +02:00
Maria Matejka
ef6a903e6f Splitting route data structures out to lib 2022-05-04 15:37:41 +02:00
Maria Matejka
0d0f6554a5 Unified attribute and filter types
This commit removes the EAF_TYPE_* namespace completely and also for
route attributes, filter-based types T_* are used. This simplifies
fetching and setting route attributes from filters.

Also, there is now union bval which serves as an universal value holder
instead of private unions held separately by eattr and filter code.
2022-05-04 15:37:41 +02:00
Maria Matejka
bc17fee1bf Filter: Bitfield eattrs reading / writing moved to filter code
Before this change, fetch-update-write and bitmasking was hardcoded in
attribute access code cased by the attribute type. Several filter
instructions are used to do it instead.

As this is certainly going to be a little bit slower than before, the
switch block in attribute access code should be completely removed in
near future, helping with both performance and code cleanliness.

The user interface should have stayed intact.
2022-05-04 15:37:41 +02:00
Ondrej Zajicek (work)
4b1aa37f93 Netlink: Remove superfluous sysdep/linux/netlink.c.orig
Thanks to Vincent Bernat for notice.
2022-03-16 23:16:26 +01:00
Maria Matejka
92b832380d Merge commit '1b9189d5' into haugesund 2022-03-09 13:13:05 +01:00
Maria Matejka
24773af9e0 Merge commit 'e42eedb9' into haugesund 2022-03-09 11:02:55 +01:00