# Generated by confd
# ------------- Static black hole addresses -------------
{{if ls "/"}}
protocol static {
{{range ls "/"}}
{{$parts := split . "-"}}
{{$cidr := join $parts "/"}}
   route {{$cidr}} blackhole;
{{end}}
}
{{else}}# No static routes configured.{{end}}

# Aggregation of routes on this host; export the block, nothing beneath it.
function calico_aggr ()
{
{{range ls "/"}}
{{$parts := split . "-"}}
{{$cidr := join $parts "/"}}
{{$affinity := json (getv (printf "/%s" .))}}
  {{if $affinity.state}}
      # Block {{$cidr}} is {{$affinity.state}}
    {{if eq $affinity.state "confirmed"}}
      if ( net = {{$cidr}} ) then { accept; }
      if ( net ~ {{$cidr}} ) then { reject; }
    {{end}}
  {{ else }}
      # Block {{$cidr}} is implicitly confirmed.
      if ( net = {{$cidr}} ) then { accept; }
      if ( net ~ {{$cidr}} ) then { reject; }
  {{ end }}
{{end}}
}
