From: Donald Sharp Date: Wed, 6 Oct 2021 12:01:30 +0000 (-0400) Subject: bgpd: Check return code for bgp_route_match_add X-Git-Tag: base_8.2~360^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ac0ed50468ed362f8c1342c7f8de99ae25494beb;p=matthieu%2Ffrr.git bgpd: Check return code for bgp_route_match_add 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 --- diff --git a/bgpd/bgp_routemap_nb_config.c b/bgpd/bgp_routemap_nb_config.c index f98c1b0f8f..09a6be4010 100644 --- a/bgpd/bgp_routemap_nb_config.c +++ b/bgpd/bgp_routemap_nb_config.c @@ -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);