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

188 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
Jan Maria Matejka
74bfd2f97c Filters: Removed FI_COMMA, not used for 19 years.
This instruction was removed in the commit linked below
and never used ever again. Rest in peace.

commit 84c7e1943f
Author: Pavel Machek <pavel@ucw.cz>
Date:   Tue Mar 2 19:49:28 1999 +0000
2018-03-13 17:01:37 +01:00
Jan Maria Matejka
7c601e6b7b Filter: recursion to loop
It was supposed to do tail-recursion in interpret() but it didn't
compile as such. Converting it to loop makes a significant filter
performance improvement for flat filters.
2018-03-13 16:29:33 +01:00
Maria Jan Matejka
5a14df3950 Filter: Instruction codes named as enum
The two-letter instructions were quite messy but they could be easily
read from memory dumps. Now GDB (since 2012) supports pretty printing
enum values and GCC checks the switch construction for missing enum
values so we are converting the nice two-byte values to enums.

Anyway, the enum still keeps the old two-byte values to be able to read
the instruction codes even without GDB from plain memory dump.
2018-03-13 16:29:33 +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
Michal 'vorner' Vaner
5a8b1fb047 filter: Allow assigning enums into extended attributes
They are internally ints, but they got refused as a wrong type. This
fixes setting of the BGP origin and is also needed for RA.
2017-09-20 15:36:54 +02:00
Ondrej Zajicek (work)
da65a3d898 Filter: Fix missing case for !~ operator
Thanks to Vincent Bernat for the patch.
2017-01-24 15:35:38 +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
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
768d5e1058 Add !~ operator to filter grammar 2016-09-21 13:35:52 +02:00
Ondřej Surý
33d22f0e9e whitespace fixes 2016-08-16 09:24:12 +02:00
Ondrej Zajicek (work)
f1f39bb9d8 Filter: Fixes reconfiguration with last_nonaggregated operator 2016-07-01 11:03:13 +02:00
Ondrej Zajicek (work)
122deb6d5b Filters: Fixes pm_same() w.r.t. ASN ranges and ASN expressions
This is necessary for proper detection of filter changes during
reconfigurations.
2016-06-09 00:30:41 +02:00
Ondrej Filip
a0fe1944d1 Add AS# ranges to bgpmask. 2016-06-08 16:22:44 +02:00
Ondrej Zajicek (work)
9c9cc35c02 Filter: Implement last_nonaggregated operator on bgp_path 2016-02-16 17:33:58 +01:00
Ondrej Zajicek
1321e12ac4 Static: Allows to specify attributes for static routes
The patch adds suport for specifying route attributes together with
static routes, e.g.:

 route 10.1.1.0/24 via 10.0.0.1 { krt_advmss = 1200; ospf_metric1 = 100; };
2015-07-20 17:11:10 +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
315f23a047 Add bitfield route attribute type 2015-05-10 19:44:10 +02:00
Pavel Tvrdik
7d37bf79de Remove a comparison of unsigned expression < 0 2015-02-21 19:38:44 +01:00
Ondrej Zajicek
1123e70740 Implements token bucket filter for rate limiting. 2014-10-02 12:52:50 +02:00
Ondrej Zajicek
283c7dfada Merge branch 'master' into add-path 2013-11-25 18:42:47 +01:00
Ondrej Zajicek
52e030e146 Converts filters to unsigned integers. 2013-11-24 00:17:02 +01:00
Ondrej Zajicek
736e143fa5 Merge branch 'master' into add-path
Conflicts:

	filter/filter.c
	nest/proto.c
	nest/rt-table.c
	proto/bgp/bgp.h
	proto/bgp/config.Y
2013-11-23 11:50:34 +01:00
Ondrej Zajicek
0aeac9cb7f Merge commit 'origin/bfd' 2013-11-22 02:48:44 +01:00
Ondrej Zajicek
a15dab76f9 Implements 'allow local as' option.
Similar to allowas-in option on other routers.
2013-10-21 14:59:35 +02:00
Ondrej Zajicek
0e175f9f0f Fixes some BFD bugs and makes logging thread-safe. 2013-10-05 20:12:28 +02:00
Ondrej Zajicek
7ccb36d330 Implements C.len operator for clist and eclist types.
Thanks to Sergey Popovich for the original patch.
2013-10-02 14:57:29 +02:00
Ondrej Zajicek
28a10f84cb Some fixes in filter code.
Thanks to Sergey Popovich for original patches.
2013-10-02 14:41:37 +02:00
Ondrej Zajicek
70c5780535 Minor code cleanups.
Thanks to Sergey Popovich for the patch.
2013-10-02 12:10:09 +02:00
Ondrej Zajicek
b655596d1d Simplifies val_in_range().
Also fixes missing type check for element ~ set.
2013-10-02 11:42:46 +02:00
Ondrej Zajicek
a5fc59587f Rewrites static attribute filter code and adds ifname/ifindex attributes.
Thanks to Sergey Popovich for the original ifname/ifindex patch.
2013-09-26 22:08:21 +02:00
Ondrej Zajicek
507e182a60 Fixes reconfiguration of global set variables.
When global set variables were used, every reconfiguration restarted
protocols that use it in filters.

Thanks to Sergey Popovich for a bugreport.
2013-09-10 12:58:24 +02:00
Ondrej Zajicek
bff9ce5130 Extends delete/filter operators to work no bgp_paths. 2013-08-15 01:06:47 +02:00
Ondrej Zajicek
00192d5ab8 Implements proper setting of 'gw' route attribute.
Thanks to Sergey Popovich for the bugreport.
2013-08-13 20:32:02 +02:00
Ondrej Zajicek
508d936078 Implements eval command and minor CLI cleanups.
Implemented eval command can be used to evaluate expressions.

The patch also documents echo command and allows to use log classes
instead of integer as a mask for echo.
2013-07-25 13:15:32 +02:00
Ondrej Zajicek
cc31b75a8f Implements 'bgppath ~ int set' filter op. 2013-07-09 23:27:10 +02:00
Ondrej Zajicek
36da2857bc Implements router advertisements activated by received routes.
The RAdv protocol could be configured to change its behavior based on
availability of routes, e.g., do not announce router lifetime when a
default route is not available.
2013-02-08 23:58:27 +01:00
Ondrej Zajicek
b31774eeb0 Removes some nonsense. 2012-11-27 01:30:09 +01:00
Ondrej Zajicek
3e40f3e795 Fixes setting of route attributes of type router id. 2012-11-27 01:25:47 +01:00
Ondrej Zajicek
094d2bdb79 Implements ADD-PATH extension for BGP.
Allows to send and receive multiple routes for one network by one BGP
session. Also contains necessary core changes to support this (routing
tables accepting several routes for one network from one protocol).
It needs some more cleanup before merging to the master branch.
2012-08-14 16:46:43 +02:00
Ondrej Zajicek
182a78957d Allows some modifications of dest attribute in filters. 2012-04-29 01:35:52 +02:00
Ondrej Zajicek
af582c4811 Route Origin Authorization basics.
- ROA tables, which are used as a basic part for RPKI.
 - Commands for examining and modifying ROA tables.
 - Filter operators based on ROA tables consistent with RFC 6483.
2012-03-18 17:32:30 +01:00
Ondrej Zajicek
0888a737b0 Extends set operations in filters.
Allows add/filter/delete clist on clist (set algebra on clists).

Allows number ~ bgppath match.
2012-03-15 21:07:58 +01:00
Ondrej Zajicek
a03ede6493 Fixes a tricky bug in route filtering.
Route attributes was used after rta was freed during copy-on-write in
filter code. This causes some random crashes, esp. with multipath
routes.
2012-01-03 00:42:25 +01:00
Ondrej Filip
4271f2b77e Fixed problem during 'configure' with EC 2011-09-18 13:52:50 +02:00
Ondrej Zajicek
42a0c05408 BGP Extended communities. 2011-08-14 13:55:02 +02:00
Ondrej Zajicek
fdf16eb658 Prints full community lists during 'show route all'. 2011-07-03 19:43:30 +02:00
Ondrej Zajicek
e08d2ff08e Adds filter clist operation. 2011-06-26 17:09:24 +02:00
Ondrej Zajicek
0aa88530ad Convert && and || to shortcut boolean operators. 2011-03-23 13:40:46 +01:00
Ondrej Zajicek
938b191b92 Fixes error handling in ASN expressions. 2010-10-09 01:00:53 +02:00