diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-10-20 08:32:36 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-10-20 08:32:55 +0200 |
commit | 40075951dc437b3f7ea9a56085e7efa78598e33f (patch) | |
tree | 0205250ae44bc26029fdcc3da604c9c8785327ed /src/network/networkd-route.c | |
parent | network: copy multipath route element earlier (diff) | |
download | systemd-40075951dc437b3f7ea9a56085e7efa78598e33f.tar.xz systemd-40075951dc437b3f7ea9a56085e7efa78598e33f.zip |
network: also compare and hash weight of the gateway
Diffstat (limited to '')
-rw-r--r-- | src/network/networkd-route.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 34ede60405..85d540c32a 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -299,9 +299,10 @@ void route_hash_func(const Route *route, struct siphash *state) { siphash24_compress(&route->src, FAMILY_ADDRESS_SIZE(route->family), state); siphash24_compress(&route->gw_family, sizeof(route->gw_family), state); - if (IN_SET(route->gw_family, AF_INET, AF_INET6)) + if (IN_SET(route->gw_family, AF_INET, AF_INET6)) { siphash24_compress(&route->gw, FAMILY_ADDRESS_SIZE(route->gw_family), state); - + siphash24_compress(&route->gw_weight, sizeof(route->gw_weight), state); + } siphash24_compress(&route->prefsrc, FAMILY_ADDRESS_SIZE(route->family), state); @@ -356,6 +357,10 @@ int route_compare_func(const Route *a, const Route *b) { r = memcmp(&a->gw, &b->gw, FAMILY_ADDRESS_SIZE(a->family)); if (r != 0) return r; + + r = CMP(a->gw_weight, b->gw_weight); + if (r != 0) + return r; } r = memcmp(&a->prefsrc, &b->prefsrc, FAMILY_ADDRESS_SIZE(a->family)); @@ -484,6 +489,7 @@ static void route_copy(Route *dest, const Route *src, const MultipathRoute *m) { } else { dest->gw_family = src->gw_family; dest->gw = src->gw; + dest->gw_weight = src->gw_weight; } } |