]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: also take Route::initcwnd and ::initrwnd into hash func 13508/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Sep 2019 15:18:05 +0000 (00:18 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Sep 2019 12:53:42 +0000 (21:53 +0900)
Fixes #13506.

src/network/networkd-manager.c
src/network/networkd-route.c

index 8095de960eb89fb7a8a1c283894bb354c5e8a38d..ea962e50dbcefe552d36d6d5e5110163995bed3c 100644 (file)
@@ -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) {
index b6da560afe57f974886065578d81fbc97ffb5af1..bae7cd8f96038e25d9d2032c16f51941446478f7 100644 (file)
@@ -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;