summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-10-06 14:01:30 +0200
committerDonald Sharp <sharpd@nvidia.com>2021-10-06 14:47:07 +0200
commitac0ed50468ed362f8c1342c7f8de99ae25494beb (patch)
tree755e086aea5274503e99d61b51576153624b7f45 /bgpd
parentbgpd: Check return from generic_set_add (diff)
downloadfrr-ac0ed50468ed362f8c1342c7f8de99ae25494beb.tar.xz
frr-ac0ed50468ed362f8c1342c7f8de99ae25494beb.zip
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 <sharpd@nvidia.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_routemap_nb_config.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/bgpd/bgp_routemap_nb_config.c b/bgpd/bgp_routemap_nb_config.c
index f98c1b0f8..09a6be401 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);