It seems commit

  commit c6964c305b425b98aaf0492806a28b578d799d83
  Author: Ondrej Zajicek <santi...@crfreenet.org>
  Date:   Sat Jun 29 22:55:41 2013 +0200

      Makes krt.c much more readable.

introduces regression, so in configurations with more
than one kernel syncer when kernel protocol added/enabled/or
restarted (for example due to filter changes), no KRT scan is
performed and BRT remains empty until next scan on regular
interval specified scan time option).

BIRD config:
------------
# Configure logging
log stderr all;
log syslog all;

router id 172.16.1.1;

protocol device devices {
        scan time 120;
}

### KRT 10

table rt_10;

protocol kernel kernel10 {
        table rt_10;

        debug all;

        persist no;
        scan time 120;
        learn yes;
        device routes yes;
        kernel table 10;
        import all;
        export none;
}

### KRT 20

table rt_20;

protocol kernel kernel20 {
        disabled yes;

        table rt_20;

        debug all;

        persist no;
        scan time 120;
        learn yes;
        device routes yes;
        kernel table 20;
        import all;
        export none;
}

System configuration:
---------------------

# ip -4 addr sh dev lo255
6: lo255: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    inet 192.0.2.1/24 brd 192.0.2.255 scope global lo255

# ip -4 route show table 10
172.16.1.0/24 dev lo255  proto static  scope link  src 192.0.2.1 

# ip -4 route show table 20
172.16.1.0/24 dev lo255  proto static  scope link  src 192.0.2.1

After BIRD starts:
------------------

# birdc 'show protocols'
BIRD 1.3.11 ready.
name     proto    table    state  since       info
devices  Device   master   up     10:21       
kernel10 Kernel   rt_10    up     10:21       
kernel20 Kernel   rt_20    down   10:21

# birdc 'show route table rt_10'
BIRD 1.3.11 ready.
172.16.1.0/24      dev lo255 [kernel10 10:21] * (10)

# birdc 'show route table rt_20'
BIRD 1.3.11 ready.

Now enable kernel20:
--------------------

# birdc 'enable kernel20'
BIRD 1.3.11 ready.
kernel20: enabled

10-10-2013 10:23:11 <INFO> Enabling protocol kernel20
Kicking kernel20 up
10-10-2013 10:23:11 <TRACE> kernel20: Starting
Allocating FIB hash of order 10: 1024 entries, 0 low, 4096 high
kernel20 reporting state transition HUNGRY/DOWN -> */UP
kernel20: Scheduling meal
Connecting protocol kernel20 to table rt_20
10-10-2013 10:23:11 <TRACE> kernel20: Connected to table rt_20
10-10-2013 10:23:11 <TRACE> kernel20: State changed to feed
Feeding protocol kernel20
Feeding protocol kernel20 continued
Announcing routes to new protocol kernel20
10-10-2013 10:23:11 <TRACE> kernel20: State changed to up
Protocol kernel20 up and running

And see no routes from kernel:
------------------------------
# birdc 'show route table rt_20'
BIRD 1.3.11 ready.

After less than scan time interval (120 sec in configuration):
--------------------------------------------------------------

BIRD 1.3.11 ready.
172.16.1.0/24      dev lo255 [kernel20 10:25] * (10)

10-10-2013 10:25:06 <TRACE> kernel10: 172.16.1.0/24: [alien] seen
KRT: Got 172.16.1.0/24, type=1, oif=6, table=20, prid=4, proto=kernel20
10-10-2013 10:25:06 <TRACE> kernel20: 172.16.1.0/24: [alien] created

---
 sysdep/unix/krt.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index 26eb31a..7b45139 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -854,12 +854,11 @@ static void
 krt_scan_timer_start(struct krt_proto *p)
 {
   if (!krt_scan_count)
-  {
     krt_scan_timer = tm_new_set(krt_pool, krt_scan, NULL, 0, KRT_CF->scan_time);
-    tm_start(krt_scan_timer, 0);
-  }
 
   krt_scan_count++;
+
+  tm_start(krt_scan_timer, 0);
 }
 
 static void

Reply via email to