Bird 2.0.0 and (filter) code deduplication
Luis Ressel
aranea at aixah.de
Sun Dec 17 01:37:39 CET 2017
Hello *,
TL;DR: Skip to last paragraph.
during the migration to Bird 2.0.0, the combined linecount of my bird
config files has increased by quite a bit. The bulk of the increase is
an unfortunate consequence of the bird/bird6 merge which I'll describe
in the following. With Bird 1.6.3 I could reuse protocol-agnostic filter
code using the following scheme:
$ cat bird.conf
function foo() {
# some v4-specific filter checks
}
include "common";
$ cat bird6.conf
# same thing in green
$ cat common
function bar() {
# protocol-agnostic boilerplate with calls to foo() all over it
}
This approach for code deduplication has become substantially more
difficult with Bird 2.0.0. I do, however, have an suggestion on how to
fix this:
Could you please add a way to check the current channel's AFI/SAFI from
within filter code? That way, I could keep my bar() function unmodified
and merge the two foo() implementations using a 'if afi = "ipv4" then
{ } else { }' construction.
Regards,
Luis Ressel
More information about the Bird-users
mailing list