network: save GatewayOnLink= value as tristate in Route

This should not change any behavior. But used in the later commit.
This commit is contained in:
Yu Watanabe 2019-02-28 10:10:38 +09:00
parent 4bec2f237b
commit 54901fd222
2 changed files with 7 additions and 1 deletions

View 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;
}

View 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;