• Jan Maria Matejka's avatar
    Filter: make bgpmask literals real constructors · e8bc64e3
    Jan Maria Matejka authored
    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.
    e8bc64e3
Name
Last commit
Last update
..
Doc Loading commit data...
Makefile Loading commit data...
a-path.c Loading commit data...
a-set.c Loading commit data...
attrs.h Loading commit data...
bfd.h Loading commit data...
bird.h Loading commit data...
cli.c Loading commit data...
cli.h Loading commit data...
cmds.c Loading commit data...
cmds.h Loading commit data...
config.Y Loading commit data...
iface.c Loading commit data...
iface.h Loading commit data...
locks.c Loading commit data...
locks.h Loading commit data...
mrtdump.h Loading commit data...
neighbor.c Loading commit data...
password.c Loading commit data...
password.h Loading commit data...
proto-hooks.c Loading commit data...
proto.c Loading commit data...
proto.sgml Loading commit data...
protocol.h Loading commit data...
route.h Loading commit data...
rt-attr.c Loading commit data...
rt-dev.c Loading commit data...
rt-dev.h Loading commit data...
rt-fib.c Loading commit data...
rt-roa.c Loading commit data...
rt-table.c Loading commit data...