network: save GatewayOnLink= value as tristate in Route
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 28 Feb 2019 01:10:38 +0000 (10:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 28 Feb 2019 01:16:55 +0000 (10:16 +0900)
This should not change any behavior. But used in the later commit.

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

index 537f0e4..232abc8 100644 (file)
@@ -59,6 +59,7 @@ int route_new(Route **ret) {
                 .table = RT_TABLE_MAIN,
                 .lifetime = USEC_INFINITY,
                 .quickack = -1,
+                .gateway_onlink = -1,
         };
 
         *ret = TAKE_PTR(route);
@@ -565,6 +566,9 @@ int route_configure(
         if (r < 0)
                 return log_error_errno(r, "Could not set scope: %m");
 
+        if (route->gateway_onlink >= 0)
+                SET_FLAG(route->flags, RTNH_F_ONLINK, route->gateway_onlink);
+
         r = sd_rtnl_message_route_set_flags(req, route->flags);
         if (r < 0)
                 return log_error_errno(r, "Could not set flags: %m");
@@ -950,7 +954,8 @@ int config_parse_gateway_onlink(
                 return 0;
         }
 
-        SET_FLAG(n->flags, RTNH_F_ONLINK, r);
+        n->gateway_onlink = r;
+
         TAKE_PTR(n);
         return 0;
 }
index 4eddf51..7a9fc16 100644 (file)
@@ -30,6 +30,7 @@ struct Route {
         uint32_t initrwnd;
         unsigned char pref;
         unsigned flags;
+        int gateway_onlink;
 
         union in_addr_union gw;
         union in_addr_union dst;