diff options
Diffstat (limited to 'zebra/zapi_msg.c')
| -rw-r--r-- | zebra/zapi_msg.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 651babdeba..db54e6f25b 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -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" @@ -1416,7 +1417,7 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) struct nexthop *nexthop = NULL; struct nexthop_group *ng = NULL; int i, ret; - vrf_id_t vrf_id = 0; + vrf_id_t vrf_id; struct ipaddr vtep_ip; s = msg; @@ -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 */ @@ -2382,14 +2391,19 @@ static inline void zread_rule(ZAPI_HANDLER_ARGS) if (!(zpr.rule.filter.src_ip.family == AF_INET || zpr.rule.filter.src_ip.family == AF_INET6)) { - zlog_warn("Unsupported PBR source IP family: %s\n", - family2str(zpr.rule.filter.src_ip.family)); + zlog_warn( + "Unsupported PBR source IP family: %s (%" PRIu8 + ")\n", + family2str(zpr.rule.filter.src_ip.family), + zpr.rule.filter.src_ip.family); return; } if (!(zpr.rule.filter.dst_ip.family == AF_INET || zpr.rule.filter.dst_ip.family == AF_INET6)) { - zlog_warn("Unsupported PBR dest IP family: %s\n", - family2str(zpr.rule.filter.dst_ip.family)); + zlog_warn("Unsupported PBR IP family: %s (%" PRIu8 + ")\n", + family2str(zpr.rule.filter.dst_ip.family), + zpr.rule.filter.dst_ip.family); return; } |
