constant not available everywhere and passing variables from protocols

Saku Ytti saku at ytti.fi
Wed Mar 21 11:48:06 CET 2018


On 21 March 2018 at 12:13, Jan Maria Matejka <jan.matejka at nic.cz> wrote:

>> Why not? It barfs with 'line 10: IP address expected'
>
> In v1.6.x, nobody implemented it. In v2, it should work.

Thanks, will consider upgrading.

> Try 'import where yourCustomImportFunction(arg1, arg2, arg3, ... argN)'.

Thanks.


Are there considerations in future to pass bgp_neighbour object to
filter, to discriminate on neighbor address, ifname, asn, etc? JunOS
allows this. This would allow me to keep single 'define backup_int =
"XYZ". On ingress I'd match against protocol, on egress I'd match
against bgp_neighbour.ifname. So only thing I'd define for
backup/primary selection is single const, which could be included in a
single line config file.

Something like this:


filter bgp_primary_out {
  if ifname = "lo" then {
    if bgp_neighbor.ifname = backup_int then bgp_path.prepend(local_as);
    accept;
  }
  reject;
}

filter bgp_primary_in {
  if proto = backup_int then bgp_local_pref = 50;
  if net = default_candidate_net then accept;
  reject;
}


>Anyway, it should be possible to 'define default_candidate_ip = default_candidate_net.ip;'
> and then use the constant as IP.

This works. Curiously won't work if the next-hop is
default_candidate_net.ip; Actually have to assign own constant to it.

-- 
  ++ytti


More information about the Bird-users mailing list