#log syslog all;
log "/tmp/ospf.log" all;

# Override router ID
router id 10.7.0.12;

filter import_OSPF {
        reject;
}


filter export_OSPF {
        print net, source;

        if source = RTS_STATIC then {
                print "net accept static: ", net;
        }
        print "export ", ifname;

        if (net ~ [10.98.0.0/16{24,32}]) then {
            print "net accept export: ", net;
            accept;
        }

        if (net ~ [10.195.0.0/21{24,32}]) then {
            print "net accept export: ", net;
            accept;
        }

        reject;
}

filter export_ATM {
        if source = RTS_STATIC then {
                print "net accept atm static: ", net;
                accept;
        }

        reject;
}

filter import_ATM {
        if (net ~ [10.98.0.0/16{24,32}]) then {
            print "net accept: ", net;
            accept;
        }
        if (net ~ [10.195.0.0/21{24,32}]) then {
            print "net accept: ", net;
            accept;
        }

        reject;
}




protocol kernel {
	learn;			# Learn all alien routes from the kernel
#	persist;		# Don't remove routes on bird shutdown
	scan time 20;		# Scan kernel routing table every 20 seconds
#	import none;		# Default is import all
	export all;		# Default is export none
	export all;
#	kernel table 5;		# Kernel table to synchronize with (default: main)
}

# This pseudo-protocol watches all interface up/down events.
protocol device {
	scan time 10;		# Scan interfaces every 10 seconds
}

# Static routes (again, there can be multiple instances, so that you
# can disable/enable various groups of static routes on the fly).

protocol static {
        
	route 10.98.0.4/30 via 10.7.0.1;
	route 10.98.0.12/30 via 10.7.0.1;
	route 10.3.50.0/24 via 10.7.0.254;
	route 10.3.60.0/24 via 10.7.0.254;

}

protocol ospf  {
        rfc1583compat yes;
        import filter import_OSPF;
        export filter export_OSPF;

        area 0 {
                interface "eth1" {
                        cost 5;
                        hello 1;
                        retransmit 2;
                        priority 1;
                        wait 5;
                        dead 4;
                        type broadcast;
                        authentication none;
                };
        };
}

protocol ospf {
        rfc1583compat yes;
        import filter import_ATM;
        export filter export_ATM;

        area 0 {
                interface "tap12" {
                        cost 100;
                        hello 60;
                        retransmit 2;
                        priority 1;
                        wait 5;
                        dead 120;
                        type ptmp;
                        authentication none;
                };

                interface "tap122" {
                        cost 100;
                        hello 60;
                        retransmit 2;
                        priority 1;
                        wait 5;
                        dead 120;
                        type ptmp;
                        authentication none;
                };

                interface "tap13" {
                        cost 10;
                        hello 60;
                        retransmit 2;
                        priority 1;
                        wait 5;
                        dead 120;
                        type ptmp;
                        authentication none;
                };

        };
}

