]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Check return code for bgp_route_match_add
authorDonald Sharp <sharpd@nvidia.com>
Wed, 6 Oct 2021 12:01:30 +0000 (08:01 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 6 Oct 2021 12:47:07 +0000 (08:47 -0400)
FRR uses bgp_route_match_add and checked the return
code in every place but one.  Fix so that the
return code is looked at and warned against

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_routemap_nb_config.c

index f98c1b0f8fb7a9d04dde2af429b67a583c686d13..09a6be4010f9e5c0ce2b93c5f7d7900c3f7b2405 100644 (file)
@@ -1035,6 +1035,7 @@ lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(
        char *argstr;
        const char *condition;
        route_map_event_t event;
+       int ret;
 
        /* Add configuration. */
        rhc = nb_running_get_entry(args->dnode, NULL, true);
@@ -1072,8 +1073,14 @@ lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(
                rhc->rhc_event = RMAP_EVENT_ECLIST_DELETED;
        }
 
-       bgp_route_match_add(rhc->rhc_rmi, rhc->rhc_rule, argstr, event,
-                           args->errmsg, args->errmsg_len);
+       ret = bgp_route_match_add(rhc->rhc_rmi, rhc->rhc_rule, argstr, event,
+                                 args->errmsg, args->errmsg_len);
+       /*
+        * At this point if this is not a successful operation
+        * bgpd is about to crash.  Let's just cut to the
+        * chase and do it.
+        */
+       assert(ret == RMAP_COMPILE_SUCCESS);
 
        if (argstr != value)
                XFREE(MTYPE_ROUTE_MAP_COMPILED, argstr);