0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00
bird/filter
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
..
config.Y Filter: make bgpmask literals real constructors 2018-03-14 11:34:29 +01:00
Doc Reimplementation of prefix sets. 2009-03-31 12:55:57 +02:00
f-util.c Filter: Instruction codes named as enum 2018-03-13 16:29:33 +01:00
filter.c Filter: make bgpmask literals real constructors 2018-03-14 11:34:29 +01:00
filter.h Filter: make bgpmask literals real constructors 2018-03-14 11:34:29 +01:00
Makefile Reimplementation of prefix sets. 2009-03-31 12:55:57 +02:00
test6.conf Reimplementation of prefix sets. 2009-03-31 12:55:57 +02:00
test.conf Filter test: typo fix 2017-11-09 15:04:05 +01:00
test.conf2 Allow matching on enums: 2000-06-01 08:32:49 +00:00
test.conf.inc Implements wildcard matching in config file include. 2012-07-18 19:29:33 +02:00
tree.c Minor code cleanups 2016-11-08 17:46:29 +01:00
trie.c Tree/Trie: Check the end of buffer 2016-10-11 21:25:21 +02:00