summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-09-10 00:18:05 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-09-17 21:53:42 +0900
commitfa3e401a79f0435b1768593d12d42688955560b8 (patch)
tree7d9ce1b55ae024d05e9f488af1b1a6fa32579c73
parentc077a205e71cb4c0c837c69f28b001553b9be3f9 (diff)
downloadsystemd-fa3e401a79f0435b1768593d12d42688955560b8.tar.gz
systemd-fa3e401a79f0435b1768593d12d42688955560b8.tar.bz2
systemd-fa3e401a79f0435b1768593d12d42688955560b8.zip
network: also take Route::initcwnd and ::initrwnd into hash func
Fixes #13506.
-rw-r--r--src/network/networkd-manager.c25
-rw-r--r--src/network/networkd-route.c10
2 files changed, 35 insertions, 0 deletions
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 8095de960e..ea962e50db 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -435,6 +435,31 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, vo
return 0;
}
+ r = sd_netlink_message_enter_container(message, RTA_METRICS);
+ if (r < 0 && r != -ENODATA) {
+ log_link_error_errno(link, r, "rtnl: Could not enter RTA_METRICS container: %m");
+ return 0;
+ }
+ if (r >= 0) {
+ r = sd_netlink_message_read_u32(message, RTAX_INITCWND, &tmp->initcwnd);
+ if (r < 0 && r != -ENODATA) {
+ log_link_warning_errno(link, r, "rtnl: received route message with invalid initcwnd, ignoring: %m");
+ return 0;
+ }
+
+ r = sd_netlink_message_read_u32(message, RTAX_INITRWND, &tmp->initrwnd);
+ if (r < 0 && r != -ENODATA) {
+ log_link_warning_errno(link, r, "rtnl: received route message with invalid initrwnd, ignoring: %m");
+ return 0;
+ }
+
+ r = sd_netlink_message_exit_container(message);
+ if (r < 0) {
+ log_link_error_errno(link, r, "rtnl: Could not exit from RTA_METRICS container: %m");
+ return 0;
+ }
+ }
+
(void) route_get(link, tmp, &route);
if (DEBUG_LOGGING) {
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index b6da560afe..bae7cd8f96 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -170,6 +170,8 @@ 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);
break;
default:
@@ -220,6 +222,14 @@ static int route_compare_func(const Route *a, const Route *b) {
if (r != 0)
return r;
+ r = CMP(a->initcwnd, b->initcwnd);
+ if (r != 0)
+ return r;
+
+ r = CMP(a->initrwnd, b->initrwnd);
+ if (r != 0)
+ return r;
+
r = memcmp(&a->gw, &b->gw, FAMILY_ADDRESS_SIZE(a->family));
if (r != 0)
return r;