1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

network: use address_equal()/route_equal() to compare addresses or routes configured by NDisc

Fixes #20244.
This commit is contained in:
Yu Watanabe 2021-08-04 13:14:03 +09:00 committed by Luca Boccassi
parent 42a45446bb
commit 10e417b3ea
3 changed files with 4 additions and 3 deletions

View File

@ -166,7 +166,7 @@ Address *address_free(Address *address) {
set_remove(address->link->dhcp6_pd_addresses, address);
set_remove(address->link->dhcp6_pd_addresses_old, address);
SET_FOREACH(n, address->link->ndisc_addresses)
if (n->address == address)
if (address_equal(n->address, address))
free(set_remove(address->link->ndisc_addresses, n));
if (address->family == AF_INET6 &&

View File

@ -276,7 +276,7 @@ Route *route_free(Route *route) {
set_remove(route->link->dhcp6_pd_routes, route);
set_remove(route->link->dhcp6_pd_routes_old, route);
SET_FOREACH(n, route->link->ndisc_routes)
if (n->route == route)
if (route_equal(n->route, route))
free(set_remove(route->link->ndisc_routes, n));
}
@ -432,7 +432,7 @@ DEFINE_HASH_OPS_WITH_KEY_DESTRUCTOR(
route_compare_func,
route_free);
static bool route_equal(const Route *r1, const Route *r2) {
bool route_equal(const Route *r1, const Route *r2) {
if (r1 == r2)
return true;

View File

@ -66,6 +66,7 @@ typedef struct Route {
void route_hash_func(const Route *route, struct siphash *state);
int route_compare_func(const Route *a, const Route *b);
bool route_equal(const Route *r1, const Route *r2);
extern const struct hash_ops route_hash_ops;
int route_new(Route **ret);