Skip to content

Commit

Permalink
zebra: Do not accept illegal safi's for route installation (#5679)
Browse files Browse the repository at this point in the history
zebra: Do not accept illegal safi's for route installation
  • Loading branch information
eqvinox authored Jan 16, 2020
2 parents 394e862 + 5e7939a commit ba16266
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "lib/vrf.h"
#include "lib/libfrr.h"
#include "lib/sockopt.h"
#include "lib/lib_errors.h"

#include "zebra/zebra_router.h"
#include "zebra/rib.h"
Expand Down Expand Up @@ -1612,6 +1613,14 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX))
src_p = &api.src_prefix;

if (api.safi != SAFI_UNICAST && api.safi != SAFI_MULTICAST) {
flog_warn(EC_LIB_ZAPI_MISSMATCH,
"%s: Received safi: %d but we can only accept UNICAST or MULTICAST",
__func__, api.safi);
nexthop_group_delete(&ng);
XFREE(MTYPE_RE, re);
return;
}
ret = rib_add_multipath(afi, api.safi, &api.prefix, src_p, re, ng);

/* Stats */
Expand Down

0 comments on commit ba16266

Please sign in to comment.