router id 62.168.0.2; # change this for each router!

# Enable debugging output
debug protocols all;

# Need to define table for ipv6 sadr (v4 is implicitly defined as 'master4')
ipv6 sadr table tab1;

# Listen to dev up/down events
protocol device {}

# Blacklisting and filtering from kernel
define blacklist = [
       a::/16,
       127.0.0.0/8
];

filter import_filter
{
        # Filter routes in blacklist
        if (net ~ blacklist) then reject "blacklisted";
        if (krt_source = 50) then reject "wrong protocol";
        accept;
}

protocol kernel {
  ipv6 sadr {
    table tab1;
    import filter import_filter;
    export all;
  };
  learn yes;
}

protocol kernel {
  ipv4 {
    export all;
    import filter import_filter;
  };
  learn yes;
}

# Create routes subnets configured on interfaces
#protocol direct {
#  ipv6 sadr;
#  ipv4;
#}

protocol babel {
  ipv6 sadr {
    table tab1;
    import filter import_filter;
    # Set initial metric for all routes
    export filter { if source != RTS_BABEL then babel_metric = 2048; accept; };
  };
  ipv4 {
    import filter import_filter;
    # Set initial metric for all routes
    export filter { if source != RTS_BABEL then babel_metric = 2048; accept; };
  };
  # Interfaces to listen on and their config
  interface "enp3s0" { type wired; };
  interface "enp4s0" { type wired; };
  interface "wlan0" { type wireless; };
}
