exporting routes to kernel

Tomasz Głuch groups at tomaszgluch.pl
Thu Mar 15 15:14:31 CET 2012


Hi!
I'm trying configure BIRD 1.3.6 on Centos 5.8. I have 2 routing tables.
In default table I've routes imported from kernel, static and direct protocols:
root at tomasz:~# ip ro s
10.110.10.5 dev eth0  proto bird 
192.168.100.0/24 dev virbr1  proto kernel  scope link  src 192.168.100.1 
10.110.10.0/24 dev eth0  proto kernel  scope link  src 10.110.10.27 
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 
169.254.0.0/16 dev eth0  scope link  metric 1000 
default via 10.110.10.1 dev eth0  metric 100 
root at tomasz:~# birdc
BIRD 1.3.6 ready.
bird> show route 
0.0.0.0/0          via 10.110.10.1 on eth0 [kernel1 12:55] * (10)
192.168.100.0/24   dev virbr1 [direct1 12:55] * (240)
192.168.122.0/24   dev virbr0 [direct1 12:55] * (240)
10.110.10.5/32     dev eth0 [static1 12:55] * (200)
10.110.10.0/24     dev eth0 [direct1 12:55] * (240)

Now, I would like to copy them to table 'testable'. Pipe protocol is
configured with import all and export all filters. Bird's table testable
includes all routes according to filters, but only static routes are exported
to kernel2 table testable:
bird> show route table testable
0.0.0.0/0          via 10.110.10.1 on eth0 [kernel1 12:55] * (10)
192.168.100.0/24   dev virbr1 [direct1 12:55] * (240)
192.168.122.0/24   dev virbr0 [direct1 12:55] * (240)
10.110.10.5/32     dev eth0 [static1 12:55] * (200)
10.110.10.0/24     dev eth0 [direct1 12:55] * (240)
bird> q
root at tomasz:~# ip ro s table testable
10.110.10.5 dev eth0  proto bird
default via 10.110.10.1 dev eth0  proto bird

In debug logs I spotted lines:
Mar 15 12:55:53 tomasz bird: pipe1 < added 192.168.100.0/24 dev virbr1
Mar 15 12:55:53 tomasz bird: pipe1 < rejected by protocol 192.168.100.0/24
dev virbr1
It seems to be filtered out by krt_import_control() in krt.c. I prepare dirty hack as
below and routes are propagated as I want. 

diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index 0fb8c4f..55a1a0a 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -770,7 +770,7 @@ krt_import_control(struct proto *P, rte **new, ea_list
**attrs, struct linpool *
 
   if (!KRT_CF->devroutes && 
       (e->attrs->dest == RTD_DEVICE) && 
-      (e->attrs->source != RTS_STATIC_DEVICE))
+      (!(e->attrs->source == RTS_STATIC_DEVICE || e->attrs->source ==
RTS_DEVICE)))
     return -1;
 
   if (!krt_capable(e))

Is there any reason to not accept routes other than RTS_STATIC_DEVICE, assuming that
possible loops are filtered out? Is other approach for this issue? The same problem occurs
when routes origin from OSPF.

Minimal config which problem occurs on:
router id 10.110.10.27;
table testable;
debug protocols all;
protocol direct {
	interface "*";
	export all;
}
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
	export all;		# Default is export none
}
protocol kernel {
	table testable;
	persist;		# Don't remove routes on bird shutdown
	scan time 20;		# Scan kernel routing table every 20 seconds
	export all;		# Default is export none
	kernel table 252;		# Kernel table to synchronize with (default: main)
}
protocol device {
	scan time 10;		# Scan interfaces every 10 seconds
}
protocol static {
	route 10.110.10.5/32 via "eth0";
}
protocol pipe {
	peer table testable;
	import all;		# default is all
	export all;		# default is none
} 


-- 
Best Regards,
  Tomasz Głuch groups @ tomaszgluch.pl



More information about the Bird-users mailing list