summaryrefslogtreecommitdiff
path: root/src/network/networkd-route.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/networkd-route.c')
-rw-r--r--src/network/networkd-route.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index bae7cd8f96..85df5d9395 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -157,11 +157,14 @@ static void route_hash_func(const Route *route, struct siphash *state) {
switch (route->family) {
case AF_INET:
case AF_INET6:
- siphash24_compress(&route->gw, FAMILY_ADDRESS_SIZE(route->family), state);
- siphash24_compress(&route->dst, FAMILY_ADDRESS_SIZE(route->family), state);
siphash24_compress(&route->dst_prefixlen, sizeof(route->dst_prefixlen), state);
- siphash24_compress(&route->src, FAMILY_ADDRESS_SIZE(route->family), state);
+ siphash24_compress(&route->dst, FAMILY_ADDRESS_SIZE(route->family), state);
+
siphash24_compress(&route->src_prefixlen, sizeof(route->src_prefixlen), state);
+ siphash24_compress(&route->src, FAMILY_ADDRESS_SIZE(route->family), state);
+
+ siphash24_compress(&route->gw, FAMILY_ADDRESS_SIZE(route->family), state);
+
siphash24_compress(&route->prefsrc, FAMILY_ADDRESS_SIZE(route->family), state);
siphash24_compress(&route->tos, sizeof(route->tos), state);
@@ -170,6 +173,7 @@ static void route_hash_func(const Route *route, struct siphash *state) {
siphash24_compress(&route->protocol, sizeof(route->protocol), state);
siphash24_compress(&route->scope, sizeof(route->scope), state);
siphash24_compress(&route->type, sizeof(route->type), state);
+
siphash24_compress(&route->initcwnd, sizeof(route->initcwnd), state);
siphash24_compress(&route->initrwnd, sizeof(route->initrwnd), state);
@@ -194,55 +198,59 @@ static int route_compare_func(const Route *a, const Route *b) {
if (r != 0)
return r;
+ r = memcmp(&a->dst, &b->dst, FAMILY_ADDRESS_SIZE(a->family));
+ if (r != 0)
+ return r;
+
r = CMP(a->src_prefixlen, b->src_prefixlen);
if (r != 0)
return r;
- r = CMP(a->tos, b->tos);
+ r = memcmp(&a->src, &b->src, FAMILY_ADDRESS_SIZE(a->family));
if (r != 0)
return r;
- r = CMP(a->priority, b->priority);
+ r = memcmp(&a->gw, &b->gw, FAMILY_ADDRESS_SIZE(a->family));
if (r != 0)
return r;
- r = CMP(a->table, b->table);
+ r = memcmp(&a->prefsrc, &b->prefsrc, FAMILY_ADDRESS_SIZE(a->family));
if (r != 0)
return r;
- r = CMP(a->protocol, b->protocol);
+ r = CMP(a->tos, b->tos);
if (r != 0)
return r;
- r = CMP(a->scope, b->scope);
+ r = CMP(a->priority, b->priority);
if (r != 0)
return r;
- r = CMP(a->type, b->type);
+ r = CMP(a->table, b->table);
if (r != 0)
return r;
- r = CMP(a->initcwnd, b->initcwnd);
+ r = CMP(a->protocol, b->protocol);
if (r != 0)
return r;
- r = CMP(a->initrwnd, b->initrwnd);
+ r = CMP(a->scope, b->scope);
if (r != 0)
return r;
- r = memcmp(&a->gw, &b->gw, FAMILY_ADDRESS_SIZE(a->family));
+ r = CMP(a->type, b->type);
if (r != 0)
return r;
- r = memcmp(&a->dst, &b->dst, FAMILY_ADDRESS_SIZE(a->family));
+ r = CMP(a->initcwnd, b->initcwnd);
if (r != 0)
return r;
- r = memcmp(&a->src, &b->src, FAMILY_ADDRESS_SIZE(a->family));
+ r = CMP(a->initrwnd, b->initrwnd);
if (r != 0)
return r;
- return memcmp(&a->prefsrc, &b->prefsrc, FAMILY_ADDRESS_SIZE(a->family));
+ return 0;
default:
/* treat any other address family as AF_UNSPEC */
return 0;