Re: Deleting unallowed communities
On Mon, Sep 13, 2010 at 07:57:49PM +0300, Alexander Shikoff wrote: There is a bug in community set delete. Try attached patch to fix it. Thank you very much! This patch fixes a problem. Ondrej, do you plan to implement invertion of community lists? Not invertion of community lists, but perhaps invertion of (pair) sets. I am not sure. Just implementing set invertion should not be hard, but question is how to integrate it into filter language grammar (as it is not just a operator like add/delete, it must be done in config-read-time to be fast enough. Perhaps some new set syntax ... . -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santi...@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. signature.asc Description: Digital signature
Re: Deleting unallowed communities
On Mon, Sep 06, 2010 at 08:28:47PM +0200, Ondrej Zajicek wrote: But there is another issue: function check_community (clist c) pair set wrong; { wrong = [ (0,0)..(0,25371), (0,25373)..(0,31209), (0,31211)..(31209,65535), (31210,0)..(31210,25371), (31210,25373)..(31210,65535), (31211,0)..(65535,65281), (65535,65283)..(65535,65535) ]; c = delete(c,wrong); print c; } bird reports in log file: Sep 6 20:26:38 crete bird: filters, line 37: Can't add/delete non-pair This code works for me. This is a recent feature, perhaps you are using an old version of BIRD. Try version 1.2.4 . I'm using 1.2.4. Where do you call a function from? In my configuration it is called from filter: function check_community (clist c) pair set wrong; { wrong = [ (0,0)..(0,25371), (0,25373)..(0,31209), (0,31211)..(31209,65535), (31210,0)..(31210,25371), (31210,25373)..(31210,65535), (31211,0)..(65535,65281), (65535,65283)..(65535,65535) ]; c = delete(c,wrong); print c; } # filter flt_itcons_i prefix set plist; { check_community(bgp_community); plist = [ 194.247.174.0/23, 91.200.192.0/22, 109.68.40.0/21, 91.197.128.0/24, 91.197.129.0/24, 91.197.131.0/24, 91.197.128.0/23 ]; if net ~ plist then accept; else reject; } bird still reports error: Sep 7 13:45:58 crete bird: filters, line 37: Can't add/delete non-pair Also I tried fillowing config: function check_community () pair set wrong; { wrong = [ (0,0)..(0,25371), (0,25373)..(0,31209), (0,31211)..(31209,65535), (31210,0)..(31210,25371), (31210,25373)..(31210,65535), (31211,0)..(65535,65281), (65535,65283)..(65535,65535) ]; bgp_community.delete(wrong); print bgp_community; } filter flt_itcons_i prefix set plist; { check_community(); plist = [ 194.247.174.0/23, 91.200.192.0/22, 109.68.40.0/21, 91.197.128.0/24, 91.197.129.0/24, 91.197.131.0/24, 91.197.128.0/23 ]; if net ~ plist then accept; else reject; } Error is the same: Sep 7 13:45:58 crete bird: filters, line 37: Can't add/delete non-pair -- MINO-RIPE
Re: Deleting unallowed communities
On Tue, Sep 07, 2010 at 01:50:58PM +0300, Alexander Shikoff wrote: This code works for me. This is a recent feature, perhaps you are using an old version of BIRD. Try version 1.2.4 . I'm using 1.2.4. Where do you call a function from? In my configuration it is called from filter: I pasted function check_community() to the test.conf in BIRD source (filters/test.conf) and called it from function paths() on variable l just before: print Community list (1,2) , l; Could you send me your complete config file to test it? -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santi...@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. signature.asc Description: Digital signature
Deleting unallowed communities
Hello, is it possible in filter to delete all communities except ones which are stored in pre-defined list? Thanks in advance! -- MINO-RIPE
Re: Deleting unallowed communities
On Mon, Sep 06, 2010 at 07:45:15PM +0300, Alexander Shikoff wrote: Hello, is it possible in filter to delete all communities except ones which are stored in pre-defined list? It is possible to do that, but you have to manually invert the list of communities. For example instead of a list of allowed communities: [(123,100), (456,200), (789,300)] you would use a list of rejected communities: [(0,0)..(123,99), (123,101)..(456,199), (456,201)..(789,299), (789,301)..(65535,65535)] in bgp_community.delete(). -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santi...@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. signature.asc Description: Digital signature
Re: Deleting unallowed communities
On Mon, Sep 06, 2010 at 07:00:58PM +0200, Ondrej Zajicek wrote: On Mon, Sep 06, 2010 at 07:45:15PM +0300, Alexander Shikoff wrote: Hello, is it possible in filter to delete all communities except ones which are stored in pre-defined list? It is possible to do that, but you have to manually invert the list of communities. For example instead of a list of allowed communities: [(123,100), (456,200), (789,300)] you would use a list of rejected communities: [(0,0)..(123,99), (123,101)..(456,199), (456,201)..(789,299), (789,301)..(65535,65535)] in bgp_community.delete(). Ondrej, thank you for reply. I tried the following code: function check_community (clist c) clist wrong; { wrong = [ (0,0)..(0,25371), (0,25373)..(0,31209), (0,31211)..(31209,65535), (31210,0)..(31210,25371), (31210,25373)..(31210,65535), (31211,0)..(65535,65281), (65535,65283)..(65535,65535) ]; c.delete(wrong); } But bird reports error: bird configure Reading configuration from /usr/local/etc/bird.conf /usr/local/etc/bird.conf, line 37: syntax error Line 37 is: c.delete(wrong); I tried both c.delete(wrong) and delete(c,wrong) - the result is the same: syntax error. -- MINO-RIPE
Re: Deleting unallowed communities
On Mon, Sep 06, 2010 at 08:18:06PM +0300, Alexander Shikoff wrote: On Mon, Sep 06, 2010 at 07:00:58PM +0200, Ondrej Zajicek wrote: On Mon, Sep 06, 2010 at 07:45:15PM +0300, Alexander Shikoff wrote: Hello, is it possible in filter to delete all communities except ones which are stored in pre-defined list? It is possible to do that, but you have to manually invert the list of communities. For example instead of a list of allowed communities: [(123,100), (456,200), (789,300)] you would use a list of rejected communities: [(0,0)..(123,99), (123,101)..(456,199), (456,201)..(789,299), (789,301)..(65535,65535)] in bgp_community.delete(). Ondrej, thank you for reply. I tried the following code: function check_community (clist c) clist wrong; { wrong = [ (0,0)..(0,25371), (0,25373)..(0,31209), (0,31211)..(31209,65535), (31210,0)..(31210,25371), (31210,25373)..(31210,65535), (31211,0)..(65535,65281), (65535,65283)..(65535,65535) ]; c.delete(wrong); } But bird reports error: bird configure Reading configuration from /usr/local/etc/bird.conf /usr/local/etc/bird.conf, line 37: syntax error Line 37 is: c.delete(wrong); I tried both c.delete(wrong) and delete(c,wrong) - the result is the same: syntax error. ok, I got it: c = delete(c,wrong); did make the error to dissapear. But there is another issue: function check_community (clist c) pair set wrong; { wrong = [ (0,0)..(0,25371), (0,25373)..(0,31209), (0,31211)..(31209,65535), (31210,0)..(31210,25371), (31210,25373)..(31210,65535), (31211,0)..(65535,65281), (65535,65283)..(65535,65535) ]; c = delete(c,wrong); print c; } bird reports in log file: Sep 6 20:26:38 crete bird: filters, line 37: Can't add/delete non-pair If declare 'wrong' as clist, then assignments like wrong = [ (0,0)..(0,25371), (0,25373)..(0,31209), (0,31211)..(31209,65535), (31210,0)..(31210,25371), (31210,25373)..(31210,65535), (31211,0)..(65535,65281), (65535,65283)..(65535,65535) ]; do not work: Sep 6 20:23:38 crete bird: filters, line 36: Assigning to variable of incompatible type Any ideas? -- MINO-RIPE