Commit graph

44 commits

Author SHA1 Message Date
Ondrej Zajicek 92a8565547 Filter: Add some minor functions for f_tree and EC
Add some supportive functions for f_tree and EC. These functions are used
by L3VPN code.
2022-10-03 20:18:12 +02:00
Ondrej Zajicek (work) cb339a3067 Filter: Implement for loops
For loops allow to iterate over elements in compound data like BGP paths
or community lists. The syntax is:

  for [ <type> ] <variable> in <expr> do <command-body>
2022-06-27 21:13:32 +02:00
Ondrej Zajicek (work) 8f3c6151b4 Nest: Cleanups in as_path_filter()
Use struct f_val as a common argument for as_path_filter(), as suggested
by Alexander Zubkov. That allows to use NULL sets as valid arguments.
2022-06-27 21:13:31 +02:00
Alexander Zubkov 0e1fd7ea6a Filter: Add operators to find minimum and maximum element of sets
Add operators .min and .max to find minumum or maximum element in sets
of types: clist, eclist, lclist. Example usage:

bgp_community.min
bgp_ext_community.max
filter(bgp_large_community, [(as1, as2, *)]).min

Signed-off-by: Alexander Zubkov <green@qrator.net>
2021-12-28 04:07:09 +01:00
Ondrej Zajicek (work) ec430a7fee Nest: Implement BGP path mask loop operator
Implement regex-like '+' operator in BGP path masks to match previous
path mask item multiple times. This is useful as ASNs may appear
multiple times in paths due to path prepending for traffic engineering
purposes.
2020-05-18 16:25:08 +02:00
Nasato Goto a6548d5b5b BGP: Fix handling of 16bit-only ASN translation
The bug generated invalid AGGREGATOR attribute during translation of
32bit ASN to 16bit-only BGP peer. The patch fixes that.
2020-04-15 03:46:53 +02:00
Ondrej Zajicek (work) a52476c9be BGP: Add option to reject AS_SETs
There is a pending draft to make them obsolete
2019-11-04 22:09:35 +01:00
Ondrej Zajicek (work) 9f3e098320 Filter: Allow to use set constants / expressions in path masks
Allow to not only use set literals in path masks, but also existing
set constants or set expressions.
2019-08-06 18:54:19 +02:00
Ondrej Zajicek (work) ef113c6f72 Filter: Allow to use sets in path masks 2019-08-06 16:58:13 +02:00
Maria Matejka de12cd18fb Filter: Merged filter line item dumpers into common generated source 2019-02-20 22:30:54 +01:00
Maria Matejka 9b46748d5b Filter: refactoring of instruction constructors 2019-02-20 22:30:54 +01:00
Maria Matejka 4c553c5a5b Filter refactoring: dropped the recursion from the interpreter
This is a major change of how the filters are interpreted. If everything
works how it should, it should not affect you unless you are hacking the
filters themselves.

Anyway, this change should make a huge improvement in the filter performance
as previous benchmarks showed that our major problem lies in the
recursion itself.

There are also some changes in nest and protocols, related mostly to
spreading const declarations throughout the whole BIRD and also to
refactored dynamic attribute definitions. The need of these came up
during the whole work and it is too difficult to split out these
not-so-related changes.
2019-02-20 22:30:54 +01:00
Ondrej Zajicek (work) d807ea087f BGP: Fix non-transitive ext communities 2017-12-13 15:57:44 +01:00
Ondrej Zajicek (work) c259669fa3 Merge branch 'master' into int-new 2017-02-08 14:34:48 +01:00
Ondrej Zajicek (work) 5509e17d0c BGP: Support for AS confederations (RFC 5065) 2017-01-22 16:32:42 +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
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) 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
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
Pavel Tvrdík ae80a2de95 unsigned [int] -> uint 2015-06-08 02:24:08 +02: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 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 bff9ce5130 Extends delete/filter operators to work no bgp_paths. 2013-08-15 01:06:47 +02:00
Ondrej Zajicek cc31b75a8f Implements 'bgppath ~ int set' filter op. 2013-07-09 23:27:10 +02: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 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 46eb80d5d5 Fixes headers for uintptr_t (and build on NetBSD). 2009-09-17 17:52:36 +02:00
Ondrej Zajicek 949bd34e81 Fixes bug related to AS2->AS4 conversion. 2009-08-25 19:01:37 +02:00
Ondrej Zajicek 92a72a4cbd Adds support for dynamic pair and bgp mask expressions. 2009-06-01 19:32:41 +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 48d79d521c Better handling of AS4 optional attribute errors
AS4 optional attribute errors were handled by session
drop (according to BGP RFC). This patch implements
error handling according to new BGP AS4 draft (*)
 - ignoring invalid AS4 optional attributes.

(*) http://www.ietf.org/internet-drafts/draft-chen-rfc4893bis-02.txt
2009-03-18 20:30:21 +01:00
Ondrej Zajicek aebe06b40c Proper format functions for ORIGINATOR_ID, CLUSTER_LIST 2008-11-08 23:33:22 +01:00
Ondrej Zajicek b6bf284a90 Bugfixes in MULIT_EXIT_DISC attribute handling.
- Old MED handling was completely different from behavior
   specified in RFCs - for example they havn't been propagated
   to neighboring areas.

 - Update tie-breaking according to RFC 4271.

 - Change default value for 'default bgp_med' configuration
   option according to RFC 4271.
2008-10-26 22:59:21 +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 f49528a3df Added as_path_get_first(). 2000-05-19 11:01:06 +00:00
Martin Mares 56a2bed46b Don't import/export MED and LOCAL_PREF on external links.
Added real comparison of BGP routes (inspired by the Cisco one).
Default local preference and default MED are now settable.
Defined filter keywords for all BGP attributes we know.
2000-04-17 12:46:07 +00:00
Pavel Machek 9c400ec9dd Int sets moved to core. It is now possible to have variable of type clist. 2000-04-17 11:34:38 +00:00
Pavel Machek 2a40efa5e6 as_path_match moved to a-path.c 2000-04-17 11:11:33 +00:00
Pavel Machek 684c6f5a0e Path_getlen moved to nest and length was made callable from filters. 2000-04-17 11:06:39 +00:00
Martin Mares c6add07fa6 Printing of AS paths and community sets. 2000-04-17 10:18:55 +00:00
Martin Mares c0668f3696 Created nest/a-path.c and a-set.c which should contain general operations
on AS paths and community sets.

Moved as_path_prepend() there.

Pavel, please move the other functions as well.
2000-04-17 07:53:29 +00:00