I'm importing BGP and OSPF routes from several interfaces, and I would like to
use the OSPF metrics as-is on the local router. However, I'm exporting these
routes via OSPF on several other interfaces, and I'd like to selectively
override the OSPF metric on some (but not all) of the routes before performing
route selection and exporting them via OSPF on the other interfaces.
Having successfully done similar things in the past with bird, I expected I
should be able to do this in a pipe filter:
protocol pipe master_to_adjusted {
table master;
peer table adjusted;
export filter {
if ! defined(ospf_metric1) then accept;
if true then ospf_metric1 = ospf_metric1 + 1000;
accept;
};
}
However, that isn't working; ospf_metric1 is not changing.
If I use the same filter as an import filter in "protocol ospf" instance, it
works fine (except that I don't want the metric changed there, since I don't
want this affecting route selection on the local router).
If I set a different attribute that doesn't already exist (eg. ospf_metric2 or
ospf_tag) in the pipe filter, it works fine. If I set ospf_tag in the
"protocol ospf" filter, then try to change it in the pipe filter, the change
does not work. If I "unset(ospf_metric1);" in the pipe filter then the routes
are silently rejected.
I don't have the same problem with BGP routes. For example,
"bgp_path.prepend(123);" in the pipe filter works as expected. Similarly,
setting ospf_metric1 on a BGP route in the "protocol ospf" filter, then
changing it in the pipe filter works as expected.
I'm running bird 2.0.7 (installed via the distro package on Ubuntu 18.04) - I
have not tested with 2.0.8.
Am I doing something wrong, or is this a bug?
Thanks!
-Paul