]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: "default-originate" shouldn't withdraw non-default routes
authorXiao Liang <shaw.leon@gmail.com>
Fri, 15 Dec 2023 10:27:39 +0000 (18:27 +0800)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Mon, 18 Dec 2023 14:17:58 +0000 (14:17 +0000)
Prevent "default-originate" from withdrawing non-default routes like
0.0.0.0/1 by checking prefix length.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
(cherry picked from commit 4d74ba929daa6e6b2fe15f9df6e61d5e4808b64c)

bgpd/bgp_route.c

index 498818dd8e729cf4476a0fdb0fabdbadc8080027..e63b3f4288bdde344314c58d957f3db31d97456b 100644 (file)
@@ -2089,9 +2089,7 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
         * configured for default-originate */
        if (CHECK_FLAG(peer->af_flags[afi][safi],
                       PEER_FLAG_DEFAULT_ORIGINATE)) {
-               if (p->family == AF_INET && p->u.prefix4.s_addr == INADDR_ANY)
-                       return false;
-               else if (p->family == AF_INET6 && p->prefixlen == 0)
+               if ((p->family == AF_INET || p->family == AF_INET6) && p->prefixlen == 0)
                        return false;
        }