#
# BIRD configuration
#
# Generated by Puppet, DO NOT EDIT!
#

log syslog { info, remote, warning, error, auth, fatal, bug };

router id 10.2.3.0;


function local_host()
{
	if source ~ [RTS_STATIC, RTS_DEVICE, RTS_INHERIT] && net.len = 32 then return true;
	return false;
}

function local_routes()
{
	if local_host() && ifname != "vip" then return true;
	return false;
}



# Filter that 
filter bgp_import {
	accept;
}

# Accept locally-generated host routes only
filter bgp_export {
	if local_routes() then accept;
	reject;
}

# Set source and only accept BGP routes
filter kernel_export {
	krt_prefsrc = 10.2.3.0;

	if source = RTS_BGP then accept;
	else reject;
}

protocol kernel {
	persist;		# Don't remove routes on bird shutdown
	scan time 2;		# Scan kernel routing table every 2 seconds
	device routes;
	import all;
	export filter kernel_export;
	learn on;
	merge paths on;		# Multipath
	preference 230;		# Prefer kernel routes to BGP/OSPF
}

protocol device {
	scan time 2;		# Scan interfaces every 2 seconds
}

protocol static {
}

protocol direct {
}

template bgp tor {
	local as 4288283392;
	bfd on;
	import filter bgp_import;
	export filter bgp_export;
}

protocol bgp tor1 from tor {
	neighbor 10.2.4.0 as 65432;
}

protocol bgp tor2 from tor {
	neighbor 10.2.4.128 as 65432;
}


protocol bfd {
	interface "eth0" {
		interval 1000 ms;
		multiplier 4;
	};
	interface "eth1" {
		interval 1000 ms;
		multiplier 4;
	};
}

