Hi!

I have ibgp setup where I receive number of routes with indirect nexthops.
"nexthop qualify via bgp" is configured. I'm using snapshot from 31.11.2016 and 
current bgpd sources.

When I start bgpd it usually comes up with either some or none of the indirect 
nexthops resolved:
# bgpctl show nex
Flags: * = nexthop valid

  Nexthop         Route              Prio Gateway         Iface
  10.150.0.10
* 10.150.0.12     10.150.0.0/23        48 10.150.8.1
<~50 nexthops some working some not removed>
* 10.150.8.1      10.150.8.0/24         4 connected       vio0 (UP, active)

"bgpctl reload" always fixes the problem and all nexthops are resolved to 
10.150.0.0/23 -> 10.150.8.1

I have tried to find a way to fix it properly but so far I have managed to get 
it working with following definitely wrong patch.
There seems to be race somewhere between nexthop insertion and validation.
Any idea where should I look or what to check?

vio0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 55:54:00:0b:39:f1
        index 1 priority 0 llprio 3
        groups: core egress
        media: Ethernet autoselect
        status: active
        inet 10.150.8.5 netmask 0xffffff00 broadcast 10.150.8.255

config:
AS 65001
router-id 10.150.8.5
nexthop qualify via bgp
network inet connected
neighbor 10.150.8.1 {
  remote-as 65001
}
match from any prefix 0.0.0.0/0 prefixlen >= 1 set rtlabel INT
match to any set localpref 90

Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v
retrieving revision 1.210
diff -u -p -r1.210 kroute.c
--- kroute.c    5 Oct 2016 07:38:06 -0000       1.210
+++ kroute.c    3 Nov 2016 19:15:49 -0000
@@ -897,6 +897,8 @@ kr_nexthop_add(u_int rtableid, struct bg
                        return (-1);
        }

+       RB_FOREACH(h, knexthop_tree, KT2KNT(kt))
+               knexthop_validate(kt, h);
        return (0);
}

Reply via email to