Strange bgp_ext_community.add behaviour
Hello, I've met strange bgp_ext_community.add behaviour when adding ext. communities to static route: protocol static TEST { import filter { bgp_ext_community.add( (ro,MyASN,10856) ); accept; }; route 185.61.244.0/22 blackhole; } - works: Jul 2 17:19:57 gate bird: TEST: State changed to down Jul 2 17:19:57 gate bird: TEST: Starting Jul 2 17:19:57 gate bird: TEST: Connected to table master Jul 2 17:19:57 gate bird: TEST: State changed to feed Jul 2 17:19:57 gate bird: TEST > added [best] 185.61.244.0/22 blackhole protocol static TEST { import filter { bgp_ext_community.add([ (ro,MyASN,10856), (ro,MyASN,3) ]); accept; }; route 185.61.244.0/22 blackhole; } - does not work. Route is filtered: Jul 2 17:26:22 gate bird: TEST: State changed to down Jul 2 17:26:22 gate bird: TEST: Starting Jul 2 17:26:22 gate bird: TEST: Connected to table master Jul 2 17:26:22 gate bird: TEST: State changed to feed Jul 2 17:26:22 gate bird: TEST > filtered out 185.61.244.0/22 blackhole bgp_ext_community.add( [ (ro,MyASN,10856) ] ); also don't work But adding communities one-by-one works as expected: protocol static TEST { import filter { bgp_ext_community.add( (ro,MyASN,10856) ); bgp_ext_community.add( (ro,MyASN,3) ); bgp_community.add( (65101, 1 ) ); bgp_community.add( (65101, 2 ) ); accept; }; route 185.61.244.0/22 blackhole; } bird> show route all 185.61.244.0/22 blackhole [TEST 17:34:42] * (200) Type: static unicast univ BGP.community: (65101,2) (65101,1) BGP.ext_community: (ro, 201836, 10856) (ro, 201836, 3) User's guide says that .add argument may be a (e)clist, thus this issue seems to be a bug. Please, advice! Thanks. -- Alexander Shikov Technical Staff, Digital Telecom IX Tel.: +380 44 201 14 07 http://dtel-ix.net/
On Thu, Jul 03, 2014 at 12:28:44PM +0300, Alexander Shikov wrote:
Hello,
I've met strange bgp_ext_community.add behaviour when adding ext. communities to static route:
protocol static TEST { import filter { bgp_ext_community.add([ (ro,MyASN,10856), (ro,MyASN,3) ]); accept; }; route 185.61.244.0/22 blackhole; } - does not work. Route is filtered: Jul 2 17:26:22 gate bird: TEST: State changed to down Jul 2 17:26:22 gate bird: TEST: Starting Jul 2 17:26:22 gate bird: TEST: Connected to table master Jul 2 17:26:22 gate bird: TEST: State changed to feed Jul 2 17:26:22 gate bird: TEST > filtered out 185.61.244.0/22 blackhole
bgp_ext_community.add( [ (ro,MyASN,10856) ] ); also don't work
User's guide says that .add argument may be a (e)clist, thus this issue seems to be a bug.
Please, advice! Thanks.
This is expected, as .add argument may be a (e)clist, but not a (E)C set, and [ (ro,MyASN,10856), (ro,MyASN,3) ] expression is an EC set. But it should report error during filter: bird: filters, line 169: Can't add set -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Hi! On Thu, Jul 03, 2014 at 12:48:04PM +0200, Ondrej Zajicek wrote:
This is expected, as .add argument may be a (e)clist, but not a (E)C set, and [ (ro,MyASN,10856), (ro,MyASN,3) ] expression is an EC set. Hm... Now I'm confused. "clist is similar to a set" I understand that as I can define eclist variable in a similar way: eclist var; var = [ ... ];
I tried that: filter Reject_Static eclist cmn; { cmn = [ (ro,MyASN,10856), (ro,MyASN,3) ]; print cmn.len; zzz; bgp_ext_community.add(cmn); accept; } protocol static TEST { import filter Reject_Static; route 185.61.244.0/22 blackhole; } bird> configure Reading configuration from /usr/local/etc/bird.conf Reconfigured Jul 3 12:26:47 gate bird: TEST: Reconfigured Jul 3 12:26:47 gate bird: TEST: Shutting down Jul 3 12:26:47 gate bird: TEST: State changed to flush Jul 3 12:26:47 gate bird: TASK: Initializing [disabled] Jul 3 12:26:47 gate bird: TEST: State changed to down Jul 3 12:26:47 gate bird: TEST: Starting Jul 3 12:26:47 gate bird: TEST: Connected to table master Jul 3 12:26:47 gate bird: TEST: State changed to feed Jul 3 12:26:47 gate bird: TEST > filtered out 185.61.244.0/22 blackhole "print cmn.len" does not print anything neither in syslog nor in stderr, when running with -d switch.
On Thu, Jul 03, 2014 at 01:41:33PM +0300, Alexander Shikov wrote:
Hi!
On Thu, Jul 03, 2014 at 12:48:04PM +0200, Ondrej Zajicek wrote:
This is expected, as .add argument may be a (e)clist, but not a (E)C set, and [ (ro,MyASN,10856), (ro,MyASN,3) ] expression is an EC set. Hm... Now I'm confused. "clist is similar to a set" I understand that as I can define eclist variable in a similar way: eclist var; var = [ ... ];
I tried that: filter Reject_Static eclist cmn; { cmn = [ (ro,MyASN,10856), (ro,MyASN,3) ];
This is the same problem - assigning EC set value to eclist variable.
"print cmn.len" does not print anything neither in syslog nor in stderr, when running with -d switch.
Seems like you have missing all log messages from filters. What your 'log' config option looks like?
From my point of view, expressions like bgp_community.add( [] ) bgp_ext_community.add( [] ) should treat arguments like (e)clist. It would be more logical.
Unfortunately with the way how the filter language is implemented, expressions are interpreted independently of the context and the '[...]' expression is just a set expression.
But it should report error during filter: bird: filters, line 169: Can't add set
It does not reports anything. Moreover, if change [] brackets with () brackets: cmn = ( (ro,MyASN,10856), (ro,MyASN,2) ); ... there is no syntax error, but it should be?
You can enclose any expression with () brackets, it does not change its meaning, . It is like 2+2 vs (2+2). -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Alexander Shikov -
Ondrej Zajicek