Skip to content

Commit

Permalink
Revert "lib : fix duplicate prefix list delete"
Browse files Browse the repository at this point in the history
This reverts commit 394ed76.

(cherry picked from commit 71fb99d)
  • Loading branch information
rzalamena authored and mergify[bot] committed Oct 3, 2023
1 parent be17d5d commit a06dbfd
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions lib/plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,22 +336,6 @@ prefix_list_entry_lookup(struct prefix_list *plist, struct prefix *prefix,
return NULL;
}

static bool
prefix_list_entry_lookup_prefix(struct prefix_list *plist,
struct prefix_list_entry *plist_entry)
{
struct prefix_list_entry *pentry = NULL;

for (pentry = plist->head; pentry; pentry = pentry->next) {
if (pentry == plist_entry)
continue;
if (prefix_same(&pentry->prefix, &plist_entry->prefix))
return true;
}

return false;
}

static void trie_walk_affected(size_t validbits, struct pltrie_table *table,
uint8_t byte, struct prefix_list_entry *object,
void (*fn)(struct prefix_list_entry *object,
Expand Down Expand Up @@ -420,16 +404,12 @@ static void prefix_list_trie_del(struct prefix_list *plist,


void prefix_list_entry_delete(struct prefix_list *plist,
struct prefix_list_entry *pentry, int update_list)
struct prefix_list_entry *pentry,
int update_list)
{
bool duplicate = false;

if (plist == NULL || pentry == NULL)
return;

if (prefix_list_entry_lookup_prefix(plist, pentry))
duplicate = true;

prefix_list_trie_del(plist, pentry);

if (pentry->prev)
Expand All @@ -441,10 +421,8 @@ void prefix_list_entry_delete(struct prefix_list *plist,
else
plist->tail = pentry->prev;

if (!duplicate)
route_map_notify_pentry_dependencies(plist->name, pentry,
RMAP_EVENT_PLIST_DELETED);

route_map_notify_pentry_dependencies(plist->name, pentry,
RMAP_EVENT_PLIST_DELETED);
prefix_list_entry_free(pentry);

plist->count--;
Expand Down Expand Up @@ -579,15 +557,11 @@ static void prefix_list_entry_add(struct prefix_list *plist,
void prefix_list_entry_update_start(struct prefix_list_entry *ple)
{
struct prefix_list *pl = ple->pl;
bool duplicate = false;

/* Not installed, nothing to do. */
if (!ple->installed)
return;

if (prefix_list_entry_lookup_prefix(pl, ple))
duplicate = true;

prefix_list_trie_del(pl, ple);

/* List manipulation: shameless copy from `prefix_list_entry_delete`. */
Expand All @@ -600,9 +574,8 @@ void prefix_list_entry_update_start(struct prefix_list_entry *ple)
else
pl->tail = ple->prev;

if (!duplicate)
route_map_notify_pentry_dependencies(pl->name, ple,
RMAP_EVENT_PLIST_DELETED);
route_map_notify_pentry_dependencies(pl->name, ple,
RMAP_EVENT_PLIST_DELETED);
pl->count--;

route_map_notify_dependencies(pl->name, RMAP_EVENT_PLIST_DELETED);
Expand Down

0 comments on commit a06dbfd

Please sign in to comment.