* Delete the received nhg id
*/
- nhe = zebra_nhg_proto_del(id);
+ nhe = zebra_nhg_proto_del(id, proto);
if (nhe) {
zebra_nhg_decrement_ref(nhe);
}
/* Delete NHE from upper level proto, caller must decrement ref */
-struct nhg_hash_entry *zebra_nhg_proto_del(uint32_t id)
+struct nhg_hash_entry *zebra_nhg_proto_del(uint32_t id, int type)
{
struct nhg_hash_entry *nhe;
return NULL;
}
+ if (type != nhe->type) {
+ if (IS_ZEBRA_DEBUG_NHG)
+ zlog_debug(
+ "%s: id %u, type %s mismatch, sent by %s, ignoring",
+ __func__, id, zebra_route_string(nhe->type),
+ zebra_route_string(type));
+ return NULL;
+ }
+
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_PROTO_RELEASED)) {
if (IS_ZEBRA_DEBUG_NHG)
zlog_debug("%s: id %u, already released", __func__, id);
*
* Caller must decrement ref with zebra_nhg_decrement_ref() when done.
*/
-struct nhg_hash_entry *zebra_nhg_proto_del(uint32_t id);
+struct nhg_hash_entry *zebra_nhg_proto_del(uint32_t id, int type);
/*
* Remove specific by proto NHGs.