# Generated by confd
function reject_disabled_pools ()
{

}

function reject_tunnel_routes () {
  # Don't export tunnel routes to other nodes, Felix programs them.
  # IPIP routes are handled by Bird, and it does not re-advertise them.
  if (defined(ifname)) then {
     if ((ifname ~ "*.cali") || (ifname ~ "*.calico")) then {
        reject;
     }
  }
}

function reject_local_routes () {
  # Don't export local routes learned via BPF as they should never leave the node.
  if (defined(ifname)) then {
     if (ifname ~ "bpf*.cali") then {
        reject;
     }
  }
}

function calico_export_to_bgp_peers(bool internal_peer) {
  # filter code terminates when it calls `accept;` or `reject;`,
  # call reject_disabled_pools() first, then reject_tunnel_routes(),
  # then apply_communities() and then calico_aggr()
  reject_disabled_pools();
  if (internal_peer) then {
    reject_tunnel_routes();
  }
  reject_local_routes();
  apply_communities();
  calico_aggr();

  if ( net ~ dead:beef::/64 ) then {
    accept;
  }
}

filter calico_kernel_programming {

  if ( net ~ dead:beef::/64 ) then {
    # Don't program VXLAN routes into the kernel - these are handled by Felix.
    reject;
  }
  accept;
}
