Commit graph

614 commits

Author SHA1 Message Date
Jan Maria Matejka e8bc64e308 Filter: make bgpmask literals real constructors
The bgpmask literals can include expressions. This is OK but they have
to be interpreted as soon as the code is run, not in the time the code
is used as value.

This led to strange behavior like rewriting bgpmasks when they shan't
be rewritten:

	function mask_generator(int as)
	{
		return [= * as * =];
	}

	function another()
	bgpmask m1;
	bgpmask m2;
	{
		m1 = mask_generator(10);
		m2 = mask_generator(20);
		if (m1 == m2) {
			print("strange"); # this would happen
		}
	}

Moreover, sending this to CLI would cause stack overflow and knock down the
whole BIRD, as soon as there is at least one route to execute the given
filter on.

	show route filter bgpmask mmm; bgppath ppp; { ppp = +empty+; mmm = [= (ppp ~ mmm) =]; print(mmm); accept; }

The magic match operator (~) inside the bgpmask literal would try to
resolve mmm, which points to the same bgpmask so it would resolve
itself, call the magic match operator and vice versa.

After this patch, the bgpmask literal will get resolved as soon as it's
assigned to mmm and it also will return a type error as bool is not
convertible to ASN in BIRD.
2018-03-14 11:34:29 +01:00
Ondrej Zajicek (work) b940579115 Filter: Allow silent filter execution
A filter should log messages only if executed explicitly (e.g., during
route export or route import). When a filter is executed for technical
reasons (e.g., to establish whether a route was exported before), it
should run silently.
2018-01-16 16:20:01 +01:00
Ondrej Zajicek (work) 0ff86d054e ROA: Fix reconfiguration 2018-01-03 14:12:00 +01:00
Ondrej Zajicek (work) 8396094156 Minor cleanups 2017-12-14 22:15:01 +01:00
Michal 'vorner' Vaner 2a95e63343 RAdv: Support for more specific routes (RFC 4191)
The patch implements Default Router Preferences and More-Specific Routes
(RFC 4191) for RAdv protocol, allowing to announce router preference and
more specific routes in router advertisements. Routes can be exported to
RAdv like to regular routing protocols.

Some cleanups, bugfixes and other changes done by Ondrej Zajicek.
2017-10-04 16:27:02 +02:00
Ondrej Zajicek (work) cd1d99611e BGP: Shutdown communication (RFC 8203)
The patch implements BGP Administrative Shutdown Communication (RFC 8203)
allowing BGP operators to pass messages related to BGP session
administrative shutdown/restart. It handles both transmit and receive of
shutdown messages. Messages are logged and may be displayed by show
protocol all command.

Thanks to Job Snijders for the basic patch.
2017-09-19 19:57:52 +02:00
Michal 'vorner' Vaner 7b2c5f3d28 Docs: FIB iteration macros 2017-09-19 12:59:41 +02:00
Ondrej Zajicek (work) f2dd602fef Backport some minor changes from int-new 2017-09-12 16:33:29 +02:00
Ondrej Zajicek (work) 9f4908fe78 Nest: VRF support for neighbor cache and olock code
Actually much simpler than expected.
2017-09-12 15:49:36 +02:00
Ondrej Zajicek (work) 943478b00f Basic VRF support
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-09-06 17:38:48 +02:00
Michal 'vorner' Vaner 080d9e4ce2
Nicer log output
non-primary is ugly, just omit it (and use primary in the other case).
2017-08-10 14:35:14 +02:00
Michal 'vorner' Vaner 5699a2036c
Less confusing log message
A non-primary address isn't necessarily secondary, that's an independent
flag.
2017-08-10 13:06:05 +02:00
Ondrej Zajicek (work) 33f7fbc42d CLI: Fix bug in symbol handling introduced in previous patches 2017-05-31 14:11:40 +02:00
Ondrej Zajicek (work) b7761af34d Conf: Replace keyword and symbol hash table with generic hash table.
The old hash table had fixed size, which makes it slow for config files
with large number of symbols and symbol lookups. The new one is growing
according to needs.
2017-05-25 23:30:39 +02:00
Ondrej Zajicek (work) 261816b0d4 BGP: Cluster list item should be prepended
Commit 3c09af41... changed behavior of int_set_add() from prepend to
append, which makes more sense for community list, but prepend must be
used for cluster list. Add int_set_prepend() and use it in cluster list
handling code.
2016-11-15 16:24:39 +01:00
Ondrej Zajicek (work) 390601f038 RIP: Use message authentication interface
Based on former commit from Pavel Tvrdik
2016-11-02 17:53:22 +01:00
Pavel Tvrdík 56cb3bedc2 Nest: Add support for MAC algorithms in grammar 2016-11-02 16:23:53 +01:00
Ondrej Zajicek (work) de2a27e255 Add generic message authentication interface
Add generic interface for generating and verifying MACs (message
authentication codes). Replace multiple HMAC implementation with
a generic one.
2016-11-02 16:23:53 +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
Pavel Tvrdik 3c09af4169 Clist: The add() function will append a new value
The add() function used to prepend a new community to clist, but after
this fix the add() function appends new community.
2016-10-13 16:59:15 +02:00
Jan Moskyto Matejka 2e7fb11a6e Fixed memory bloating on kernel merge paths together with export filter.
Some memory was being allocated from bad linpool, not from the given one
as they should.

Thanks to Madhu and Justin Cattle for reporting this.
2016-10-12 14:22:01 +02:00
Pavel Tvrdik 9df52a98e2 Doc: Change debug to { flag1|flag2|flag3 [, ...] } style
Thanks to Micah Anderson for bug report and Ondrej Zajicek for the idea!
2016-10-12 12:48:29 +02:00
Pavel Tvrdik 9fcb9637b5 Nest: Remove trailing whitespaces 2016-10-12 12:48:29 +02:00
Ondrej Zajicek (work) a46e01eeef Nest: Fix signedness of large communities 2016-10-04 12:45:39 +02:00
Ondrej Zajicek (work) 66dbdbd993 BGP: Support for large communities
Add support for large communities (draft-ietf-idr-large-community),
96bit alternative to RFC 1997 communities.

Thanks to Matt Griswold for the original patch.
2016-10-03 12:48:56 +02:00
Pavel Tvrdik a290da25a1 rt-table: Fix kernel protocol export filter memory bug
Kernel protocol calls rt_export_merged(), which used @rte_update_pool for
temporary allocations, supposing it is called from other functions from
rt-table.c that handles locking and flushing of the linpool. Therefore,
linpool was not flushed properly and memory leaked.

Add linpool argument to rt_export_merged() and use @krt_filter_lp when
called from kernel protocol.

Thanks to Justin Cattle and Alexander Frolkin for the bugreport.

(Commit squashed and updated by Ondrej Zajicek)
2016-09-15 15:57:51 +02:00
Ondrej Zajicek (work) 84cac51a51 Nest: Keep multipath next hops sorted 2016-09-14 11:53:54 +02:00
Pavel Tvrdik d107ef78df Whitespace fixes 2016-08-16 13:02:32 +02:00
Ondrej Zajicek (work) 12640c1499 Babel: Documentation updates
This updates the documentation to correctly mention Babel when protocols
are listed, and adds examples and route attribute documentation to the
Babel section of the docs.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2016-07-19 12:16:51 +02:00
Ondrej Filip 6887f409f0 Prepare for longer interface names - clean up of the code. 2016-07-17 14:54:52 +02:00
Ondrej Filip a0fe1944d1 Add AS# ranges to bgpmask. 2016-06-08 16:22:44 +02:00
Pavel Tvrdik 8e433d6a52 Prog Doc: Complete several missing parameters 2016-05-12 15:49:44 +02:00
Ondrej Zajicek (work) 937e75d8f1 Add the Babel routing protocol (RFC 6126)
This patch implements the IPv6 subset of the Babel routing protocol.
Based on the patch from Toke Hoiland-Jorgensen, with some heavy
modifications and bugfixes.

Thanks to Toke Hoiland-Jorgensen for the original patch.
2016-04-28 18:01:40 +02:00
Ondrej Zajicek (work) e90dd656cc Direct: Implement check link for direct protocol
When enabled, direct protocol generates routes only if the underlying
link state is up.
2016-04-08 15:11:21 +02:00
Ondrej Zajicek (work) 06edbb67ed Nest: Reset export route counter during graceful restart
Counter exp_routes is increased during initial route feed after GR
recovery, so it has to start with zero, otherwise BIRD will end with
double value in exp_routes.
2016-04-07 01:10:24 +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
Pavel Tvrdík 79a4f74a65 BGP: Add documentaion for extended messages 2016-03-17 18:40:54 +01:00
Ondrej Zajicek (work) 9c9cc35c02 Filter: Implement last_nonaggregated operator on bgp_path 2016-02-16 17:33:58 +01:00
Ondrej Zajicek (work) 90f78507f4 Merge branch 'master' into rip-new 2015-11-24 15:21:11 +01:00
Ondrej Zajicek (work) 86b4e17001 Nest: Fixes bug in missing cleanup during table removal
When a table is removed during reconfiguration, a reference was not
cleared in the old configuration, which breaks undo.
2015-11-09 01:01:12 +01:00
Ondrej Zajicek (work) 9b9a7143c4 Conf: Fixes bug in symbol lookup during reconfiguration
Symbol lookup by cf_find_symbol() not only did the lookup but also added
new void symbols allocated from cfg_mem linpool, which gets broken when
lookups are done outside of config parsing, which may lead to crashes
during reconfiguration.

The patch separates lookup-only cf_find_symbol() and config-modifying
cf_get_symbol(), while the later is called only during parsing. Also
new_config and cfg_mem global variables are NULLed outside of parsing.
2015-11-09 00:42:02 +01:00
Ondrej Zajicek (work) 8eb8e546dc Merge branch 'master' into rip-new 2015-10-17 14:44:34 +02:00
Ondrej Zajicek (work) acb04cfdc5 Minor changes 2015-10-17 14:43:37 +02:00
Ondrej Zajicek (work) 8465dccb06 Major RIP redesign
The new RIP implementation fixes plenty of old bugs and also adds support
for many new features: ECMP support, link state support, BFD support,
configurable split horizon and more. Most options are now per-interface.
2015-10-05 13:18:10 +02:00
Ondrej Zajicek c7b99a932c Nest: Fixes one of previous commit 2015-07-28 15:08:21 +02:00
Ondrej Zajicek 538264cf1a Static: Support for BFD controlled static routes 2015-07-24 18:02:07 +02:00
Ondrej Zajicek 17661ff934 Nest: Fixes symbols in router id
Thanks to Peter Hudec for noticing the problem.
2015-07-18 19:30:35 +02:00
Ondrej Zajicek ab4da3423d Direct: Fixes behavior for the same routes on different interfaces
Thanks to Andrew (seti.kr.ua) for the bug report.
2015-07-18 13:05:05 +02:00
Ondrej Zajicek 8d9eef1771 BGP multipath support
Kernel option 'merge paths' allows to merge routes exported to kernel
protocol (currently BGP and static routes) to multipath routes.
2015-06-08 02:24:08 +02:00
Ondrej Zajicek db027a41d4 Fixes subtle bug in temporary attribute handling
In some cases, export filter accessed attributes of a different route.
2015-06-08 02:24:08 +02:00