constant not available everywhere and passing variables from protocols
Saku Ytti
saku at ytti.fi
Wed Mar 21 10:00:48 CET 2018
My config:
define local_ip = 129.250.14.127;
define default_candidate_net = 129.250.0.0/16;
define default_candidate_ip = 129.250.0.0;
define default_net = 0.0.0.0/0;
include "common.conf";
protocol static {
route 0.0.0.0/0 recursive default_candidate_ip;
}
# ens192
protocol bgp active from NTT {
neighbor 204.141.224.0;
}
# ens 224
protocol bgp backup from NTT {
neighbor 204.141.224.2;
}
1) constant not available everywhere
a) this works
- define default_candidate_ip = 129.250.0.0;
- route 0.0.0.0/0 recursive default_candidate_ip;
b) this does not
- define default_route = 0.0.0.0/0;
- route default_route recursive 129.250.0.0;
Why not? It barfs with 'line 10: IP address expected'
2) passing variables from protocols
I'm thinking how to tell which neighbour is backup which is primary. My thoughts
a) 'import (backup, bgp_in)
=> no way to define >1 filter?
b) 'bool backup = true'
=> no way to set variables in protocols
c) 'define backup = true'
=> no way to set constants in protocols
d) ''import bgp_in(true)'
=> no way to pass variables to filters
I resorted to matching to protocol name, and call the backup group
backup. But I'd really prefer way to give neighbour or protocol some
information I can use in filter to discriminate.
Are constants considered strings? If so, should the strings have some
methods, like split, sub, []? I bit needlessly need to define
129.250.0.0 and 129.250.0.0/16 as one is used as static route next-hop
another is used as filter to permit prefix. I could just maybe say
'default_candidate_net.split('/')[0]'.
--
++ytti
More information about the Bird-users
mailing list