]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Fix zebra crashed in building FPM netlink message when bgp sends aggregation...
authorRichard Wu <wutong23@baidu.com>
Wed, 3 Jun 2020 01:44:16 +0000 (09:44 +0800)
committerDuncan Eastoe <duncan.eastoe@att.com>
Wed, 30 Sep 2020 09:33:27 +0000 (10:33 +0100)
Issue:
    When BGP sends aggregation routes to zebra, the next hop is black hole.
    Then Zebra will try to build the netlink FPM message, but there is no
    next hop as it is a black hole route. Then the netlink_route_info_fill
    function returns 0. In the result, zebra will crashed in
    "assert(data_len)" of zfpm_build_route_updates.
    This issue also happen when I create a static black hole route via
    staticd.
Fix:
    As the netlink message of the blackhole route is legal, it should return
    success.

Signed-off-by: Richard Wu <wutong23@baidu.com>
(cherry picked from commit b0e9567ed162da708f8d0b3a3caf87cd03b62e96)

zebra/zebra_fpm_netlink.c

index 00909df1dbb2e81060caeb221e50187f08a3c800..0e3d99cfb6b1b12b0e08ad7f1705ff0f065cc2e8 100644 (file)
@@ -339,7 +339,7 @@ static int netlink_route_info_fill(netlink_route_info_t *ri, int cmd,
        }
 
        /* If there is no useful nexthop then return. */
-       if (ri->num_nhs == 0) {
+       if (ri->rtm_type != RTN_BLACKHOLE && ri->num_nhs == 0) {
                zfpm_debug("netlink_encode_route(): No useful nexthop.");
                return 0;
        }