determining ipv4 or ipv6 net in filter

Chriztoffer Hansen chriztoffer at netravnen.de
Mon Jan 27 20:44:53 CET 2020


On Mon, 27 Jan 2020 at 20:27, Robert Blayzor <rblayzor.bulk at inoc.net> wrote:
> Migrating from BIRD 1.6 to 2.0 and I would like to consolidate some BGP
> filters and use them for IPv4 or IPv6 sessions....
>
> What is the best way to enumerate if a net is IPv4 or IPv6 if you wanted
> to make a if/then/else on.. ie:
>
> filter MY_FILTER {
>     if ((MYAS, 888) ~ bgp_community) then {
>       if (< Is IPv4 ?>) then {
>         do this...;
>         accept;
>       } else if (< Is IPv6 ?> then {
>         do that...;
>         accept;
>       } else {
>         reject;
>       }
>     }
>     reject;
> }
>
>
> TIA

Depending on your existing approach. One possible option is to go the
"we use communities" approach. Were you tag ALL routes on
ingress/import into the control plane. And henceforth from then on on
egress. You act on communities - when used in your OUT filters -
instead of using anything AF_INET specific. Were you need to
differentiate between v4 and v6. It may require some
planning/schematic on how you want to use what communities/ranges for
what purpose (look to large communities). But can be worthwhile in the
long run.

Chriztoffer


More information about the Bird-users mailing list