Hi

When static routes are redistributed with bgpd(8), they are not removed when the
interface used by the static is destroyed.

When an interface is destroyed the routes using this interface are flagged with
RTP_DOWN, this means kroute(6)_find() is not able to find them (inserted with
RTP_STATIC and searched with RTP_STATIC|RTP_DOWN on removal)

Here is a diff to remove the RTP_DOWN flag before searching.

Thoughts ?

Denis

Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v
retrieving revision 1.241
diff -u -p -r1.241 kroute.c
--- kroute.c    18 Jan 2021 12:15:36 -0000      1.241
+++ kroute.c    2 Jan 2022 13:52:53 -0000
@@ -1799,6 +1799,8 @@ kroute_find(struct ktable *kt, in_addr_t
        s.r.prefix.s_addr = prefix;
        s.r.prefixlen = prefixlen;
        s.r.priority = prio;
+       /* RTP_DOWN prevents route to be found */
+       s.r.priority &= ~RTP_DOWN;
 
        kn = RB_FIND(kroute_tree, &kt->krt, &s);
        if (kn && prio == RTP_ANY) {
@@ -1949,6 +1951,8 @@ kroute6_find(struct ktable *kt, const st
        memcpy(&s.r.prefix, prefix, sizeof(struct in6_addr));
        s.r.prefixlen = prefixlen;
        s.r.priority = prio;
+       /* RTP_DOWN prevents route to be found */
+       s.r.priority &= ~RTP_DOWN;
 
        kn6 = RB_FIND(kroute6_tree, &kt->krt6, &s);
        if (kn6 && prio == RTP_ANY) {

Reply via email to