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

580 Commits

Author SHA1 Message Date
Jan Maria Matejka
a946317fab Filter: Converted static global variables to a filter_state struct.
The static filter state was messy and blocked the planned parallel
execution of filters. Anyway, this will be also slower as the state
structure must be passed almost everywhere with us.
2019-02-20 22:30:53 +01:00
Ondrej Zajicek (work)
3a2a3c7325 Doc: Rename code documentation files back to Doc 2018-12-14 02:03:42 +01:00
Maria Matejka
265419a369 Custom route attributes
For local route marking purposes, local custom route attributes may be
defined. These attributes are seamlessly stripped after export filter to
every real protocol like Kernel, BGP or OSPF, they however pass through
pipes. We currently allow at most 256 custom attributes.

This should be much faster than currently used bgp communities
for marking routes.
2018-12-06 09:55:21 +01:00
Ondrej Zajicek (work)
f2d8e6801e Filter: Make ifname attribute modifiable
Allow to change an interface associated with a route by setting
ifname attribute. It will also change the route to a direct one.
2018-11-05 22:03:21 +01:00
Ondrej Zajicek (work)
83715aa829 Filter: Add support for VPN_RD sets 2018-10-25 11:26:58 +02:00
Ondrej Zajicek (work)
41b83e52f7 Filter: Fix minor bug in accessing bgp_path
Not relevant for regular BGP paths, just for BGP paths added by filters
to e.g. static routes.
2018-10-25 11:23:15 +02:00
Ondrej Zajicek (work)
586c1800c4 Nest: Neighbor cache cleanups
Simplify neighbor cache code, fix several minor bugs, and improve
handling of ONLINK flag.
2018-06-27 16:57:07 +02:00
Maria Matejka
c2fc4c10ac Doc: renamed progdoc files Doc -> progdoc to fix collision with doc/ folder on case-insensitive filesystems 2018-06-26 17:09:12 +02:00
Jan Maria Matejka
f851f0d7e3 Config: Dropping CF_ADDTO. 2018-06-26 14:29:03 +02:00
Jan Maria Matejka
1771f70d74 Filter: fixed eattr cached pointer
Use ACCESS_RTE to guard **f_rte, use ACCESS_EATTRS to guard **f_eattrs.
Use f_rta_cow() before writing to rta or eattrs, use f_rte_cow() before
writing preference (stored in rte).

Do not access eattrs indirectly through (*f_rte)->attrs->eattrs, it is
way too slow. The cached pointer is faster.
2018-06-19 16:51:40 +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
Jan Maria Matejka
ee7e2ffd26 Protocol: Introducing an enum protocol_class
This supersedes the EAP_* constants.
2018-05-29 12:35:06 +02:00
Jan Maria Matejka
c3becfe193 Filter: macro for recursive interpretation of instructions 2018-05-29 12:35:06 +02:00
Jan Maria Matejka
0ec6b5ecd3 Filter: Simple type checks converted to ARG() macro 2018-05-29 12:35:06 +02:00
Jan Maria Matejka
478f9babed Filter: Removing the third argument hack
Just to make the code a bit more clean and easier to maintain.
2018-05-29 11:53:51 +02:00
Jan Maria Matejka
cff9e937fd Filter: instruction names 2018-05-29 11:53:51 +02:00
Jan Maria Matejka
31d6939cde Filter: Instruction codes linearized 2018-05-29 11:53:51 +02:00
Ondrej Zajicek (work)
b24b781117 Filter: Add support for src filter op to access SADR source prefix
The patch allows to use 'net.src' to access SADR source prefix
from filters.

Thanks to Toke Hoiland-Jorgensen for the original patch for srclen.
2018-05-16 11:19:29 +02:00
Jan Maria Matejka
823ad12191 Filter: Added missing instruction comparators.
These instructions caused SIGABORTs on reconfiguration.
2018-04-27 14:38:41 +02:00
Jan Maria Matejka
8a871e890a Merge branch 'master' into int-new 2018-03-14 12:57:16 +01:00
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
e95705f00c Merge branch 'master' into int-new 2018-03-13 17:02:49 +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
d1ba927b36 Merge branch 'master' into int-new 2018-03-13 16:51:04 +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
Jan Maria Matejka
f2f5a7d945 Filter: the test conf checks also a bit of BGP args
Uncommented an old test.
2018-03-08 12:57:39 +01:00
Jan Maria Matejka
0575c7db72 Config: Dropped the ipv4:netmask4 syntax for IPv4 prefixes. 2018-03-08 12:57:39 +01:00
Ondrej Zajicek (work)
1561ee799c Handle properly enums for extended attributes 2018-02-13 19:52:22 +01:00
Ondrej Zajicek (work)
75d98b6013 Merge branch 'master' into int-new 2018-01-23 18:29:32 +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)
3831b61966 BGP: Require explicit import and export policies for EBGP channels
To comply with RFC 8212 requirements.
2018-01-16 04:14:49 +01:00
Ondrej Zajicek (work)
8f8671bcde Filter: Handle undefined BGP paths as empty
The same is already done for clists. Also fixes defined() to work
properly for paths and clists.
2018-01-03 15:44:05 +01:00
Ondrej Zajicek (work)
ed1d853e51 Filter: Remove old BGP path mask syntax from tests 2017-12-08 17:31:33 +01:00
Jan Maria Matejka
3e52d112d7 Docs: Update to v2.0 2017-12-08 16:27:19 +01:00
Ondrej Zajicek (work)
830ba75e6d Merge commit '1e8721e2aeccfbc3f533e8b8abc07582cee77e9a' into int-new 2017-12-07 21:54:47 +01:00
Jan Maria Matejka
9ba4b4a63d Filter test: typo fix 2017-11-09 15:04:05 +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
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)
69f7399247 Merge branch 'master' into int-new 2017-08-09 12:46:27 +02:00
Ondrej Zajicek (work)
e46128fb50 Filters: Do not clamp EC set values to 16 bit for EC_GENERICs
Thanks to Lennert Buytenhek <buytenh@wantstofly.org> for the patch.
2017-06-19 12:46:40 +02:00
Ondrej Zajicek (work)
6aaaa63519 Change parser to handle numbers as unsigned
Lexer always parsed numbers as unsigned, but parser handled them as
signed and grammar contained many unnecessary checks for negativity.
2017-05-23 17:40:19 +02:00
Jan Moskyto Matejka
05d47bd53e Linpool: default allocation size 2017-05-16 15:34:57 +02:00
Ondrej Zajicek (work)
751fb2366c Test: Fix broken test for filters 2017-04-26 14:11:28 +02:00
Jan Moskyto Matejka
69fddac052 Merge branch 'int-new' of gitlab.labs.nic.cz:labs/bird into int-new 2017-04-26 12:30:22 +02:00
Jan Moskyto Matejka
2af807a83f Test: fixed broken test for VPN RD output 2017-04-26 12:19:39 +02:00
Ondrej Zajicek (work)
6f535924eb Filter: Fix reconfiguration of roa_check() 2017-04-18 13:56:51 +02:00
Jan Moskyto Matejka
61e501da89 Filter: Check whether IP is 4 or 6 2017-03-22 14:53:37 +01:00
Ondrej Zajicek (work)
a5d2a34497 Minor cleanups
BTW, 'prefices' is hypercorrection, as 'prefix' is from 'praefixum' with
plural 'praefixa'.
2017-03-14 17:25:42 +01:00
Jan Moskyto Matejka
8c9986d310 Filters: VPN Route Distinguishers, Prefix Type, Docs Update 2017-03-13 13:51:20 +01:00
Jan Moskyto Matejka
54334b5667 Filter: ROA check test and mixed prefix test 2017-03-09 15:57:54 +01: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)
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
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)
77234bbbde Basic flow specification support (RFC 5575)
Add flow4/flow6 network and rt-table type and operations, config grammar
and static protocol support.

Squashed flowspec branch from Pavel Tvrdik.
2016-12-07 15:54:19 +01:00
Jan Moskyto Matejka
ad88b94bca Merge branch 'int-new-rpki-squashed' (early part) into int-new 2016-12-07 15:30:46 +01:00
Ondrej Zajicek (work)
d15b0b0a1b BGP redesign
Integrated and extensible BGP with generalized AFI handling,
support for IPv4+IPv6 AFI and unicast+multicast SAFI.
2016-12-07 14:20:52 +01:00
Pavel Tvrdik
cd6ca9b1f6 filter/test.conf: add ROA check and operator tests 2016-12-07 09:35:24 +01:00
Pavel Tvrdik
e58f8c28d2 Add `.maxlen' operator to all ROA prefixes in filters
Example:
  bird> eval (1.2.0.0/16 max 20 as 1234).maxlen
  20

Todo: Should be described in user docs
2016-12-07 09:35:24 +01:00
Pavel Tvrdik
69ae578450 Add `.asn' operator to all ROA prefixes in filters
Example:
  bird> eval (1.2.0.0/16 max 20 as 1234).asn
  1234

Todo: Should be described in user docs
2016-12-07 09:35:24 +01:00
Pavel Tvrdík
65d2a88dd2 RPKI protocol with one cache server per protocol
The RPKI protocol (RFC 6810) using the RTRLib
(http://rpki.realmv6.org/) that is integrated inside
the BIRD's code.

Implemeted transports are:
 - unprotected transport over TCP
 - secure transport over SSHv2

Example configuration of bird.conf:
  ...
  roa4 table r4;
  roa6 table r6;

  protocol rpki {
    debug all;

    # Import both IPv4 and IPv6 ROAs
    roa4 { table r4; };
    roa6 { table r6; };

    # Set cache server (validator) address,
    # overwrite default port 323
    remote "rpki-validator.realmv6.org" port 8282;

    # Overwrite default time intervals
    retry   10;         # Default 600 seconds
    refresh 60;         # Default 3600 seconds
    expire 600;         # Default 7200 seconds
  }

  protocol rpki {
    debug all;

    # Import only IPv4 routes
    roa4 { table r4; };

    # Set cache server address to localhost,
    # use default ports tcp => 323 or ssh => 22
    remote 127.0.0.1;

    # Use SSH transport instead of unprotected transport over TCP
    ssh encryption {
      bird private key "/home/birdgeek/.ssh/id_rsa";
      remote public key "/home/birdgeek/.ssh/known_hosts";
      user "birdgeek";
    };
  }
  ...
2016-12-07 09:35:24 +01:00
Pavel Tvrdik
5df4073c81 filter/test.conf: Minor changes in order of calls 2016-11-30 11:57:35 +01:00
Pavel Tvrdik
4abe781c27 Remove filter/test_bgp_filtering.conf file
It was an example filtering configuration from BIRD's wiki.
2016-11-30 11:57:35 +01:00
Pavel Tvrdik
012a0d6bf8 Merge test6.conf IPv6 tests into test.conf 2016-11-30 11:57:35 +01:00
Pavel Tvrdik
c39a1cb17e filter/test.conf: Extend tests 2016-11-16 17:01:09 +01:00
Pavel Tvrdik
0ed1e85091 filter/test.conf: Reorder tests
Tests are sorted from trivial tests to more complex tests
2016-11-16 13:46:43 +01:00
Pavel Tvrdik
7dea7ccb10 filter/test.conf: Replace print func with assert and format 2016-11-16 12:22:01 +01:00
Pavel Tvrdik
4b135d0958 Birdtest: Add function format in grammar for stringify expression 2016-11-16 12:22:01 +01:00
Pavel Tvrdik
3ec0bedc60 Birdtest: Remove bt_assert command from term
The bt_assert function does not return any value, so it was useless to
have a option in term definition.
2016-11-16 12:22:01 +01:00
Pavel Tvrdik
5e3cd0e5b5 Birdtest: Replace BT_SUCCESS and BT_FAILURE with 1 and 0 2016-11-11 17:43:09 +01:00
Pavel Tvrdik
fd328869cc birdtest: Fix no-forked mode in trie_test 2016-11-11 17:02:16 +01:00
Ondrej Zajicek (work)
101c5a50aa Filter: Add long community tests
Based on Pavel Tvrdik's int-test-lc branch.
2016-11-09 19:09:24 +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)
c8cafc8ebb Minor code cleanups 2016-11-08 17:46:29 +01:00
Ondrej Zajicek (work)
cc5b93f72d Merge tag 'v1.6.2' into int-new 2016-11-08 17:04:29 +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)
c68e8cd374 Filter: Minor formatting changes in test.conf 2016-10-18 13:06:51 +02:00
Pavel Tvrdik
5fd7dacadc Filter: Expand testing of large community sets 2016-10-13 15:17:41 +02:00
Pavel Tvrdik
c2564d34af Tree/Trie: Check the end of buffer
We set buffer->pos to buffer->end in function buffer_print() when
bvsnprintf() failed, so there would be uninitialized memory between
the old buffer->pos and the current buffer->pos.
2016-10-11 21:25:21 +02:00
Ondrej Zajicek (work)
a998836d4b Filter: fix missing separator 2016-10-04 23:19:35 +02:00
Ondrej Zajicek (work)
60566c5c80 Filter: large community sets
Add support for lc sets to filter code. Grammar of (small) community sets
has to be updated to avoid parser collisions.
2016-10-03 13:47:37 +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
768d5e1058 Add !~ operator to filter grammar 2016-09-21 13:35:52 +02:00
Pavel Tvrdik
bc00f05815 Filter: Prefer xmalloc/xfree to malloc/free 2016-09-15 15:24:00 +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
Pavel Tvrdik
5de0e848de filter/test.conf: fixes formating 2016-06-30 15:00:47 +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)
286e2011d2 Miscellaneous minor fixes 2016-05-12 16:04:47 +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
Jan Moskyto Matejka
7a7ac65682 Merge branch 'master' into int-new-channels 2016-04-08 12:28:33 +02:00
Ondrej Zajicek (work)
9c9cc35c02 Filter: Implement last_nonaggregated operator on bgp_path 2016-02-16 17:33:58 +01:00
Pavel Tvrdík
0264ccf6f4 Rewrite roa_check() for integrated BIRD
Thanks to Ondrej Zajicek for his support with writing this code.
2016-01-20 16:46:58 +01:00
Pavel Tvrdík
cb1bd816db Add ROA_* constants values to grammar of configuration
Add ROA_UNKNOWN, ROA_VALID and ROA_INVALID
2016-01-20 16:46:58 +01:00
Pavel Tvrdík
de9b87f558 Add NET ROA4/6 structures 2016-01-07 18:21:31 +01:00
Ondrej Zajicek (work)
04632fd77f Follow-up work on integration 2015-12-24 15:56:04 +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
Ondrej Zajicek (work)
23c212e7f1 Follow-up work on integration 2015-12-21 03:33:18 +01:00
Ondrej Zajicek (work)
e92a4b855f Filter: Fix some changes in IP<->Quad implicit conversion 2015-12-20 21:43:00 +01:00
Jan Moskyto Matejka
9656dce72e ROA code switchoff 2015-12-20 13:04:07 +01:00
Jan Moskyto Matejka
5e173e9f63 Stop perusing f_prefix for non-prefix-set uses
Multiple changes by Ondrej Santiago Zajicek
2015-12-19 23:49:47 +01:00
Jan Moskyto Matejka
d7661fbe9d Removed BITS_PER_IP_ADDRESS, MAX_PREFIX_LENGTH, BIRD_AF
Explicit setting of AF_INET(6|) in IP socket creation. BFD set to listen
on v6, without setting the V6ONLY flag to catch both v4 and v6 traffic.

Squashing and minor changes by Ondrej Santiago Zajicek
2015-12-19 15:57:09 +01:00
Ondrej Zajicek (work)
fe9f1a6ded Initial commit on integrated BIRD
New data types net_addr and variants (in lib/net.h) describing
network addresses (prefix/pxlen). Modifications of FIB structures
to handle these data types and changing everything to use these
data types instead of prefix/pxlen pairs where possible.

The commit is WiP, some protocols are not yet updated (BGP, Kernel),
and the code contains some temporary scaffolding.

Comments are welcome.
2015-11-05 12:48:52 +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
51762a45b3 Allows user data attached to f_trie_node structure.
Thanks to Alexander Chernikov for the patch.
2015-02-21 14:05:20 +01:00
Ondrej Zajicek
1123e70740 Implements token bucket filter for rate limiting. 2014-10-02 12:52:50 +02:00
Ondrej Zajicek
b2f008378a Allows more constants in set literals.
Thanks to Michael Fincham for the bugreport.
2014-10-02 12:52:50 +02:00
Ondrej Zajicek
6285793f18 Replaces function name in test.conf as it collided with new keyword. 2014-07-07 22:23:37 +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
56027b5cbd Minor fix in log_commit() w.r.t. changes in BFD branch. 2013-11-22 21:58:43 +01:00
Ondrej Zajicek
0aeac9cb7f Merge commit 'origin/bfd' 2013-11-22 02:48:44 +01:00
Ondrej Zajicek
f8f2419d4c Additional filter test case. 2013-11-20 13:30:11 +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
4ee39ff2ff Fixes initial random values for function arguments.
Thanks to Javor Kliachev for the bugreport.
2013-07-26 11:08:59 +02:00
Ondrej Zajicek
1103b32e83 Allows to define constants of all filter types. 2013-07-25 22:33:57 +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
4be266a983 Implements wildcard matching in config file include.
Also fixes some minor bugs in include.

Thanks Kelly Cochran for suggestion and draft patch.
2012-07-18 19:29:33 +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
8796a8a56e Fixes name for unnamed filters.
Thanks to Alexander V. Chernikov for the suggestion.
2012-03-15 12:50:49 +01:00
Ondrej Zajicek
117e3c4bbf Fixes a bug in pair set intervals.
Pair intervals in form (a,b)..(c,d) were mishanded.

Thanks to Alexander Shikoff for the bugreport.
2012-03-15 12:18:26 +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 Zajicek
78e33c29bb Some minor fixes in parser. 2011-10-26 20:06:36 +02:00
Ondrej Zajicek
736fd7303c Fixes a bug with multiple function arguments. 2011-09-27 13:49:32 +02:00
Ondrej Filip
4271f2b77e Fixed problem during 'configure' with EC 2011-09-18 13:52:50 +02:00
Ondrej Filip
48ec367aab Configuration can include other files. 2011-09-11 21:21:47 +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
b8cc390e7e Fixes several problems in filter syntax.
- Fixes several conflicts in the grammar.
 - Fixes a bug in (a..b, c) pair patterns.
 - Makes pair patterns orthogonal.
 - Allows term expressions in pair patterns without additional ( ).
 - Allows several comma separated values in switch cases.
2011-05-06 22:00:54 +02:00
Ondrej Filip
c454872f4e Avoid using stack. 2011-03-27 23:27:37 +02:00
Ondrej Filip
4fc36f394e This adds (*,x) functionality. 2011-03-26 14:18:56 +01:00
Ondrej Zajicek
0aa88530ad Convert && and || to shortcut boolean operators. 2011-03-23 13:40:46 +01:00
Ondrej Zajicek
26d92bb892 A hack to distinguish if..else from else: in case.
The old BIRD grammar needs two lookaheads to distinguish if..else from
else: in case, which caused the parser to fail on some combinations of
both expressions.

This patch replaces two tokens 'else' ':' by one token 'else:' to fix
that.
2011-03-23 12:49:53 +01:00
Ondrej Zajicek
938b191b92 Fixes error handling in ASN expressions. 2010-10-09 01:00:53 +02:00
Ondrej Zajicek
b2b7bbfc69 Fixes scope of filter symbols. 2010-10-04 19:55:11 +02:00
Ondrej Zajicek
0d1b3c4c0e Changes print-like filter commands to use a log instead of a stderr.
And extends the log subsystem to better handle that.
2010-09-20 13:01:01 +02:00
Ondrej Zajicek
2dec1e3471 Fixes a bug in pair sets. 2010-09-15 02:01:23 +02:00
Ondrej Zajicek
a58022a64e Fixes a bug in community set delete. 2010-09-11 20:14:53 +02:00
Ondrej Filip
946dc15c92 Documentation update and improvement of tests related to expressions in sets. 2010-08-03 17:35:34 +02:00
Ondrej Filip
edaec901e1 Even set of number can be made by expressions. 2010-08-03 15:22:29 +02:00
Ondrej Filip
4733b49ed6 Syntax of sets improved. 2010-08-03 15:16:25 +02:00
Ondrej Zajicek
c477f48916 Hostcache should use trie to filter relevant route changes. 2010-07-27 18:20:12 +02:00
Ondrej Zajicek
7f0d245a5e Minor changes in prefix trie. 2010-07-27 17:17:11 +02:00
Ondrej Zajicek
ba5c0057ed Extends pair set syntax, matching and deleting against clist.
Expressions like (123,*) can be used in pair set literals, clists can be
matched against pair sets (community ~ pairset) and pair sets can be
used to specify items to delete from clists (community.delete(pairset)).
2010-05-22 22:47:24 +02:00
Ondrej Zajicek
d759c1a6f8 NEWS and version update. 2010-04-09 17:42:39 +02:00
Ondrej Zajicek
0277cc0baf Revert "Fixes behavior of defined() on bgp_community attribute."
This reverts commit 74e9331fe0.
2010-04-08 17:47:14 +02:00
Ondrej Zajicek
126683feed Filter language updates; new route attributes and datatype.
- Adds bgp_originator_id and bgp_cluster_list route attributes.
 - Adds dotted quad filter datatype (for router IDs, used by
   bgp_originator_id and ospf_router_id route attributes).
 - Fixes pair ~ pair set matching.
 - Documentation updates.
2010-03-29 19:29:03 +02:00
Ondrej Zajicek
aa46124804 Clear local variables in filters and functions.
Fixes crash when used uninitialized variables.
This problem was surprisingly tricky to fix.
2010-03-19 09:41:18 +01:00
Ondrej Zajicek
74e9331fe0 Fixes behavior of defined() on bgp_community attribute. 2010-03-18 00:10:35 +01:00
Ondrej Zajicek
e8da1bd0b5 Fixes missing cases in filters. 2010-03-15 00:34:44 +01:00
Ondrej Zajicek
dfd48621d1 Replaces the algorithm for building balanced trees.
Changes the time complexity of the algorithm from O(n^2) to O(n*log(n)).
This speeds up loading of huge DEC-IX config from 128 s to 15 s. It also
makes the code significantly simpler.
2010-02-17 22:11:42 +01:00
Ondrej Zajicek
14f6aca480 Changes right recursion to left in the grammar of the case expression. 2010-02-17 11:29:48 +01:00
Ondrej Filip
0efd646278 Define symbols as text between ''. 2010-02-10 12:30:14 +01:00
Ondrej Zajicek
5f47c4c11e Changes right-recursion to left-recursion in a filter grammar.
Because we don't want to have a limit on a function/filter length.
2010-02-02 00:03:46 +01:00
Ondrej Filip
1960d20350 Priority for '||' and '&&' fixed. 2010-01-27 23:45:36 +01:00
Ondrej Filip
7515dafc00 Allow multiple || and && statements. 2010-01-27 22:26:45 +01:00
Ondrej Zajicek
63542845df Merge branch 'dev' into ospf3
Conflicts:

	proto/ospf/lsreq.c
	proto/ospf/lsupd.c
	proto/ospf/rt.c
2009-12-14 20:37:32 +01:00
Ondrej Zajicek
2eece54a04 Fixes bug related to reconfiguration with bgp_path first/last operators. 2009-11-15 14:24:20 +01:00
Ondrej Zajicek
3f22fa9e74 Merge branch 'dev' into ospf3 2009-11-09 22:54:39 +01:00
Ondrej Zajicek
4cdd078453 Implements protocol-specific router id and updates documentation. 2009-10-12 23:31:42 +02:00
Ondrej Zajicek
52b9b2a178 Rename as_path_get_last/as_path_get_first to be consistent. 2009-10-12 20:44:58 +02:00
Ondrej Zajicek
7ea5b00f42 First and last accessors to as_paths. 2009-10-08 15:23:24 +01:00
Ondrej Zajicek
54fe0d9230 Fixes setting of IP addresses to route attributes (NEXT_HOP). 2009-09-18 13:59:04 +02:00
Ondrej Zajicek
db96fccb31 Fixes bug in filter rta copy-on-write.
Filters should try to copy-on-write just cached rtas.
2009-09-18 01:11:09 +02:00
Ondrej Zajicek
f4c6ca8c9c Fixes preference bounds. 2009-09-17 13:35:37 +02:00
Ondrej Zajicek
05198c12f4 Some cleanups. 2009-08-27 19:01:04 +02:00
Ondrej Zajicek
b49e6f5a65 Temporary OSPFv3 development commit 2009-08-25 16:42:14 +02:00
Ondrej Zajicek
5004d02cb9 Merge branch 'master' into dev 2009-06-26 01:06:12 +02:00
Ondrej Zajicek
92a72a4cbd Adds support for dynamic pair and bgp mask expressions. 2009-06-01 19:32:41 +02:00
Ondrej Zajicek
f429d43482 Removes some remnant of '|' bgp path separator. 2009-06-01 16:20:48 +02:00
Ondrej Zajicek
23e563d86b Fixes buggy prefix ~ prefix matching. 2009-05-30 00:35:35 +02:00
Ondrej Filip
9be1086d29 New type variable 'V' defined in filters. This type is checked
only for name, never for value in function filter_same()
2009-05-29 23:08:28 +02:00
Ondrej Filip
43de796b8a Function pm_path_compare() checked just length of the bgpmasks 2009-05-29 23:04:54 +02:00
Ondrej Filip
d59405ec66 Typo in warning fixed. 2009-05-29 23:02:36 +02:00
Ondrej Filip
a6c9f0648d Missing boolean comparison added. 2009-05-28 13:37:04 +02:00
Ondrej Zajicek
c8a6b9a3d1 Rewrite of buggy AS path matching.
Old AS path maching supposes thath AS number appears
only once in AS path, but that is not true. It also
contains some bugs related to AS path sets.

New code does not use any assumptions about semantic
structure of AS path. It is asymptotically slower than
the old code, but on real paths it is not significant.

It also allows '?' for matching one arbitrary AS number.
2009-04-17 01:48:36 +02:00
Ondrej Zajicek
c60cdd8c39 Cleanup changes 2009-03-31 21:17:00 +02:00
Ondrej Zajicek
b1a597e0c3 Reimplementation of prefix sets.
Prefix sets were broken beyond any repair and have to be reimplemented.
They are reimplemented using a trie with bitmasks in nodes.
There is also change in the interpretation of minus prefix pattern,
but the old interpretation was already inconsistent with
the documentation and broken.

There is also some bugfixes in filter code related to set variables.
2009-03-31 12:55:57 +02:00
Ondrej Zajicek
cf18603491 New syntax for bgp_path 2009-03-14 12:43:10 +01:00
Ondrej Zajicek
cb53039271 Rate limit for most abundant log messages 2009-02-26 14:23:54 +01:00
Ondrej Zajicek
82ba9032be Fixes crash during some expressions
Bird crashed when 'bgp_path.len' was used for routes that does
not came from BGP.
2009-02-21 22:46:50 +01:00
Ondrej Zajicek
cd17c651a6 Add format for BGP_AGGREGATOR attribute 2009-02-21 17:47:56 +01:00
Ondrej Zajicek
f949163039 New syntax for bgp_path 2009-01-27 17:35:00 +01:00
Ondrej Zajicek
330aecead8 Bugfix in interpret
Missing cases in filter code interpret leads to crash
when  bgp_next_hop attr was queried.
2008-12-25 17:49:57 +01:00
Ondrej Zajicek
083c43e22e fixes some 64-bit related bugs.
Filter code used 'aux' integer field of 'symbol' struct to store ptr
to next symbol and both 'aux2' and 'def' fields for value.
Changed to just 'def' for value and 'aux2' for ptr to next symbol.
Also another minor bugfix.
2008-12-25 11:55:27 +01:00
Ondrej Zajicek
44711e0ca2 Fix some bugs in filter interpret. 2008-11-16 22:16:04 +01:00
Ondrej Zajicek
e29fa06ece New read-only route attribute 'proto' added. It returns a string
representing a name of the protocol that originated the route.
Strings can be compared using = or matched using ~. Routes can
be filtered, for example:

show route where proto ~ "bgp1*"
2008-11-14 14:50:37 +01:00
Ondrej Zajicek
aebe06b40c Proper format functions for ORIGINATOR_ID, CLUSTER_LIST 2008-11-08 23:33:22 +01:00
Ondrej Zajicek
4847a894bf Implementation of route reflection for BGP 2008-10-26 22:45:09 +01:00
Ondrej Zajicek
11cb620266 Implementation of 4B ASN support for BGP 2008-10-26 22:36:08 +01:00
Martin Mares
9831e5916f Staticized lots of local functions. 2004-06-05 09:58:23 +00:00
Martin Mares
6ecd20605c ... and in the filter. 2004-06-05 09:26:55 +00:00
Martin Mares
6a57bb3110 Killed a couple of unused variables.
We really should compile with warnings enabled.
2004-05-31 20:57:38 +00:00
Martin Mares
03e3d184b2 Fix bison input for current build tools, otherwise bison or the compiler
will abort the build.

(by Andreas)
2004-05-31 17:44:39 +00:00
Martin Mares
d85e1f0e2f Prefix comparison bug (hopefully) fixed. 2003-02-27 10:48:30 +00:00
Martin Mares
de10a974f2 Added missing semicolons. 2002-11-13 08:46:12 +00:00
Pavel Machek
4bb18dd2da Fix i_same for 'c' instruction. 2000-06-08 16:57:41 +00:00
Martin Mares
725270cb1d Fixes for the programmer's manual. 2000-06-08 12:37:21 +00:00
Pavel Machek
a5a947d4d8 Fixing error messages. 2000-06-08 10:26:19 +00:00
Pavel Machek
b178d92a0b Better messages 2000-06-08 08:24:32 +00:00
Pavel Machek
3e82b32d36 Progdocs updates 2000-06-07 14:45:55 +00:00
Pavel Machek
8dcf254499 Even better documentation of filters. 2000-06-07 14:16:11 +00:00
Pavel Machek
907503adb6 Comment fix. 2000-06-07 14:00:17 +00:00
Pavel Machek
771ae456a5 Better progdocs for filters 2000-06-07 13:54:06 +00:00
Martin Mares
2e9b24211a Spelling fixes to progdoc. 2000-06-07 12:29:08 +00:00
Pavel Machek
4c5f93d76b Better documentation. There are functions whose description is good when
reading source but whose documentation does not belong to progdocs.
2000-06-05 17:13:36 +00:00
Pavel Machek
8798c81176 Docs updates:
make prog.dvi

do not overflow in .dvi

include filter documentation in the system
2000-06-05 16:36:16 +00:00
Pavel Machek
98da26a0a0 Better error messages 2000-06-05 15:41:29 +00:00
Ondrej Filip
49222defff Bug in comment. It didn't compile. 2000-06-05 15:06:26 +00:00
Pavel Machek
b093c328f5 Updates to both programmers and users doc 2000-06-05 12:52:57 +00:00
Martin Mares
bf3eb98eb8 Use nested scopes properly. Updated according to cf_define_symbol() changes.
The rest of code doesn't need changing since it doesn't use nesting.
2000-06-04 19:30:55 +00:00
Martin Mares
f7667ba1c4 When cloning a rte and replacing its rta, remember to free the old one
so that we don't leak memory. Thanks go to the resource tracking system
for quickly discovering the source of leakages.
2000-06-04 18:46:30 +00:00
Pavel Machek
64ba9f7bcc Do not try to divide by zero. 2000-06-02 08:01:12 +00:00
Pavel Machek
5f4aee76a2 Added && and ||. 2000-06-01 08:43:29 +00:00
Pavel Machek
1877dab217 Allow
case net {
                       62.0.0.0/8+:
                       10.0.0.0/8+:
                       else: reject;
               }
2000-06-01 08:34:30 +00:00
Pavel Machek
1895e81e05 Allow matching on enums:
if !(scope ~ [ SCOPE_HOST, SCOPE_SITE ]) then {
                print "Failed in test";
                quitbird;
        }
2000-06-01 08:32:49 +00:00
Pavel Machek
0b1cad8162 Complain when filter does not end in accept nor reject. 2000-05-31 21:50:13 +00:00
Pavel Machek
24e1e2005b Another testbed for filters. 2000-05-30 11:09:09 +00:00
Pavel Machek
0dc4431cde Access to all attributes we should be able to access seems to work. 2000-05-30 11:07:22 +00:00
Pavel Machek
26c09e1d25 Added read-only access to all required fields in rta. 2000-05-30 10:42:39 +00:00
Pavel Machek
2bdb5e0083 Cleaning static attributes 2000-05-30 10:23:04 +00:00
Pavel Machek
fe613ecded Access to few more attributes is needed. 2000-05-30 10:13:32 +00:00
Pavel Machek
ad9074e9ba Cleaned up warnings. 2000-05-25 15:20:40 +00:00