index->map->name, index->pref);
/* Free route map northbound hook contexts. */
- while (!TAILQ_EMPTY(&index->rhclist))
- routemap_hook_context_free(TAILQ_FIRST(&index->rhclist));
+ while ((rhc = TAILQ_FIRST(&index->rhclist)) != NULL)
+ routemap_hook_context_free(rhc);
/* Free route match. */
- while ((rule = index->match_list.head) != NULL)
+ while ((rule = index->match_list.head) != NULL) {
+ if (IS_RULE_IPv4_PREFIX_LIST(rule->cmd->str))
+ route_map_pfx_tbl_update(RMAP_EVENT_PLIST_DELETED,
+ index, AFI_IP, rule->rule_str);
+ else if (IS_RULE_IPv6_PREFIX_LIST(rule->cmd->str))
+ route_map_pfx_tbl_update(RMAP_EVENT_PLIST_DELETED,
+ index, AFI_IP6,
+ rule->rule_str);
+
route_map_rule_delete(&index->match_list, rule);
+ }
/* Free route set. */
while ((rule = index->set_list.head) != NULL)