Deleting unallowed communities

Alexander Shikoff minotaur at crete.org.ua
Mon Sep 6 19:34:39 CEST 2010


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



More information about the Bird-users mailing list