On Mon, Oct 31, 2022 at 09:54:12AM +0300, Bars Bars wrote:
> Hi!
> 
> Just upgraded to 7.2 and bgpd began to crash with VPNs, not immediately
> but in 1 minute after daemon start (probably the issue happens
> when prefix withdraw received or so, and rde goes to change the fib, not
> sure).
> If only using IPv4 sessions and keeping VPN sessions down then it works
> stable.
> "
> kroute_remove: not handled AID
> peer closed imsg connection
> SE: Lost connection to parent
> peer closed imsg connection notification: Cease, administratively down
> fatal in RTR: Lost connection to parent
> peer closed imsg connection
> fatal in RDE: Lost connection to parent
> "
> im not sure that is a bug, but there was huge kroute refactoring under bgpd
> source tree since 7.1 and it seems that routes with VPN4/VPN6 AIDs are
> now handled very differently. Im bad at code to
> investigate and to try to fix the issue, so i simply rolled back
> bgpd/bgpctl
> to 7.1 base revision and rebuild, ok now.
> Сan't imagine what else I can do.

Please try the following diff. It should fix the problem with MPLS routes.

-- 
:wq Claudio

Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v
retrieving revision 1.301
diff -u -p -r1.301 kroute.c
--- kroute.c    18 Oct 2022 09:30:29 -0000      1.301
+++ kroute.c    3 Nov 2022 13:42:11 -0000
@@ -580,6 +580,9 @@ krVPN4_change(struct ktable *kt, struct 
            (kf->prefix.labelstack[2] << 8);
        mplslabel = htonl(mplslabel);
 
+       kf->mplslabel = mplslabel;
+       kf->flags |= F_MPLS;
+
        /* for blackhole and reject routes nexthop needs to be 127.0.0.1 */
        if (kf->flags & (F_BLACKHOLE|F_REJECT))
                kf->nexthop.v4.s_addr = htonl(INADDR_LOOPBACK);
@@ -590,6 +593,7 @@ krVPN4_change(struct ktable *kt, struct 
                        return (-1);
        } else {
                kr->mplslabel = mplslabel;
+               kr->flags |= F_MPLS;
                kr->ifindex = kf->ifindex;
                kr->nexthop.s_addr = kf->nexthop.v4.s_addr;
                rtlabel_unref(kr->labelid);
@@ -632,6 +636,9 @@ krVPN6_change(struct ktable *kt, struct 
            (kf->prefix.labelstack[2] << 8);
        mplslabel = htonl(mplslabel);
 
+       kf->flags |= F_MPLS;
+       kf->mplslabel = mplslabel;
+
        /* for blackhole and reject routes nexthop needs to be ::1 */
        if (kf->flags & (F_BLACKHOLE|F_REJECT))
                memcpy(&kf->nexthop.v6, &lo6, sizeof(kf->nexthop.v6));
@@ -642,6 +649,7 @@ krVPN6_change(struct ktable *kt, struct 
                        return (-1);
        } else {
                kr6->mplslabel = mplslabel;
+               kr6->flags |= F_MPLS;
                kr6->ifindex = kf->ifindex;
                memcpy(&kr6->nexthop, &kf->nexthop.v6, sizeof(struct in6_addr));
                kr6->nexthop_scope_id = kf->nexthop.scope_id;

Reply via email to