diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-12-17 18:43:11 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-12-18 11:28:10 +0100 |
commit | 8ae1a821b36683fae6514dcd317a2049d0824779 (patch) | |
tree | 7741080e4a1c61f989dd5bc8aa236c474b6b9327 /src/libsystemd-network/lldp-neighbor.c | |
parent | c380b84d8b88ca61371d8fdb77d5719c778700fc (diff) | |
download | systemd-8ae1a821b36683fae6514dcd317a2049d0824779.tar.gz |
sd-lldp: accept if a neighbor is already removed from the hashtable
Diffstat (limited to 'src/libsystemd-network/lldp-neighbor.c')
-rw-r--r-- | src/libsystemd-network/lldp-neighbor.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/lldp-neighbor.c index 199d8aee0a..43fc8e03c0 100644 --- a/src/libsystemd-network/lldp-neighbor.c +++ b/src/libsystemd-network/lldp-neighbor.c @@ -82,7 +82,12 @@ sd_lldp_neighbor *lldp_neighbor_unlink(sd_lldp_neighbor *n) { if (!n->lldp) return NULL; - assert_se(hashmap_remove(n->lldp->neighbor_by_id, &n->id) == n); + /* Only remove the neighbor object from the hash table if it's in there, don't complain if it isn't. This is + * because we are used as destructor call for hashmap_clear() and thus sometimes are called to de-register + * ourselves from the hashtable and sometimes are called after we already are de-registered. */ + + (void) hashmap_remove_value(n->lldp->neighbor_by_id, &n->id, n); + assert_se(prioq_remove(n->lldp->neighbor_by_expiry, n, &n->prioq_idx) >= 0); n->lldp = NULL; |