mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
Merge pull request #28335 from ssahani/dhcp4-route-option
network: DHCP4 allow to set InitialCongestionWindow and InitialAdvert…
This commit is contained in:
commit
afe7026511
@ -2073,6 +2073,20 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>InitialCongestionWindow=</varname></term>
|
||||
<listitem>
|
||||
<para>As in the [Route] section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>InitialAdvertisedReceiveWindow=</varname></term>
|
||||
<listitem>
|
||||
<para>As in the [Route] section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>UseGateway=</varname></term>
|
||||
<listitem>
|
||||
|
@ -203,6 +203,10 @@ static int dhcp4_request_route(Route *in, Link *link) {
|
||||
route->mtu = link->network->dhcp_route_mtu;
|
||||
if (route->quickack < 0)
|
||||
route->quickack = link->network->dhcp_quickack;
|
||||
if (route->initcwnd == 0)
|
||||
route->initcwnd = link->network->dhcp_initial_congestion_window;
|
||||
if (route->initrwnd == 0)
|
||||
route->initrwnd = link->network->dhcp_advertised_receive_window;
|
||||
|
||||
if (route_get(NULL, link, route, &existing) < 0) /* This is a new route. */
|
||||
link->dhcp4_configured = false;
|
||||
|
@ -195,8 +195,8 @@ Route.GatewayOnlink, config_parse_route_boolean,
|
||||
Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0
|
||||
Route.Protocol, config_parse_route_protocol, 0, 0
|
||||
Route.Type, config_parse_route_type, 0, 0
|
||||
Route.InitialCongestionWindow, config_parse_tcp_window, 0, 0
|
||||
Route.InitialAdvertisedReceiveWindow, config_parse_tcp_window, 0, 0
|
||||
Route.InitialCongestionWindow, config_parse_route_tcp_window, 0, 0
|
||||
Route.InitialAdvertisedReceiveWindow, config_parse_route_tcp_window, 0, 0
|
||||
Route.TCPAdvertisedMaximumSegmentSize, config_parse_tcp_advmss, 0, 0
|
||||
Route.TCPCongestionControlAlgorithm, config_parse_tcp_congestion, 0, 0
|
||||
Route.QuickAck, config_parse_route_boolean, 0, 0
|
||||
@ -249,6 +249,8 @@ DHCPv4.SocketPriority, config_parse_dhcp_socket_priority,
|
||||
DHCPv4.SendOption, config_parse_dhcp_send_option, AF_INET, offsetof(Network, dhcp_client_send_options)
|
||||
DHCPv4.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_vendor_options)
|
||||
DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu)
|
||||
DHCPv4.InitialCongestionWindow, config_parse_tcp_window, 0, offsetof(Network, dhcp_initial_congestion_window)
|
||||
DHCPv4.InitialAdvertisedReceiveWindow, config_parse_tcp_window, 0, offsetof(Network, dhcp_advertised_receive_window)
|
||||
DHCPv4.FallbackLeaseLifetimeSec, config_parse_dhcp_fallback_lease_lifetime, 0, 0
|
||||
DHCPv4.Use6RD, config_parse_bool, 0, offsetof(Network, dhcp_use_6rd)
|
||||
DHCPv4.NetLabel, config_parse_string, CONFIG_PARSE_STRING_SAFE, offsetof(Network, dhcp_netlabel)
|
||||
|
@ -148,6 +148,8 @@ struct Network {
|
||||
bool dhcp_use_routes;
|
||||
int dhcp_use_gateway;
|
||||
bool dhcp_quickack;
|
||||
uint32_t dhcp_initial_congestion_window;
|
||||
uint32_t dhcp_advertised_receive_window;
|
||||
bool dhcp_use_timezone;
|
||||
bool dhcp_use_hostname;
|
||||
bool dhcp_use_6rd;
|
||||
|
@ -2643,8 +2643,7 @@ int config_parse_tcp_window(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(route_free_or_set_invalidp) Route *n = NULL;
|
||||
Network *network = userdata;
|
||||
uint32_t *window = ASSERT_PTR(data);
|
||||
uint32_t k;
|
||||
int r;
|
||||
|
||||
@ -2654,15 +2653,6 @@ int config_parse_tcp_window(
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = route_new_static(network, filename, section_line, &n);
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to allocate route, ignoring assignment: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = safe_atou32(rvalue, &k);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
@ -2680,13 +2670,53 @@ int config_parse_tcp_window(
|
||||
return 0;
|
||||
}
|
||||
|
||||
*window = k;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_route_tcp_window(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(route_free_or_set_invalidp) Route *n = NULL;
|
||||
Network *network = userdata;
|
||||
uint32_t *d;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(section);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = route_new_static(network, filename, section_line, &n);
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to allocate route, ignoring assignment: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (streq(lvalue, "InitialCongestionWindow"))
|
||||
n->initcwnd = k;
|
||||
d = &n->initcwnd;
|
||||
else if (streq(lvalue, "InitialAdvertisedReceiveWindow"))
|
||||
n->initrwnd = k;
|
||||
d = &n->initrwnd;
|
||||
else
|
||||
assert_not_reached();
|
||||
|
||||
r = config_parse_tcp_window(unit, filename, line, section, section_line, lvalue, ltype, rvalue, d, userdata);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
TAKE_PTR(n);
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_route_boolean);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_route_preference);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_type);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_tcp_window);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_multipath_route);
|
||||
|
Loading…
x
Reference in New Issue
Block a user