network: introduce QuickAck= for [DHCPv4] and [IPv6AcceptRA]

Closes #25906.
This commit is contained in:
Yu Watanabe 2023-01-16 14:31:58 +09:00
parent 67b65ac62d
commit f95fb19922
5 changed files with 28 additions and 2 deletions

View file

@ -1645,8 +1645,8 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
<varlistentry>
<term><varname>QuickAck=</varname></term>
<listitem>
<para>Takes a boolean. When true enables TCP quick ack mode for the route. When unset, the
kernel's default will be used.</para>
<para>Takes a boolean. When true, the TCP quick ACK mode for the route is enabled. When unset,
the kernel's default will be used.</para>
</listitem>
</varlistentry>
@ -2046,6 +2046,14 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>QuickAck=</varname></term>
<listitem>
<para>Takes a boolean. When true, the TCP quick ACK mode is enabled for the routes configured by
the acquired DHCPv4 lease. When unset, the kernel's default will be used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>UseGateway=</varname></term>
<listitem>
@ -2546,6 +2554,14 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>QuickAck=</varname></term>
<listitem>
<para>Takes a boolean. When true, the TCP quick ACK mode is enabled for the routes configured by
the received RAs. When unset, the kernel's default will be used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>UseMTU=</varname></term>
<listitem>

View file

@ -183,6 +183,7 @@ static int dhcp4_request_route(Route *in, Link *link) {
assert(route);
assert(link);
assert(link->network);
assert(link->dhcp_lease);
r = sd_dhcp_lease_get_server_identifier(link->dhcp_lease, &server);
@ -200,6 +201,8 @@ static int dhcp4_request_route(Route *in, Link *link) {
route->table = link_get_dhcp4_route_table(link);
if (route->mtu == 0)
route->mtu = link->network->dhcp_route_mtu;
if (route->quickack < 0)
route->quickack = link->network->dhcp_quickack;
if (route_get(NULL, link, route, &existing) < 0) /* This is a new route. */
link->dhcp4_configured = false;

View file

@ -173,6 +173,7 @@ static int ndisc_request_route(Route *in, Link *link, sd_ndisc_router *rt) {
assert(route);
assert(link);
assert(link->network);
assert(rt);
r = sd_ndisc_router_get_address(rt, &router);
@ -186,6 +187,8 @@ static int ndisc_request_route(Route *in, Link *link, sd_ndisc_router *rt) {
ndisc_set_route_priority(link, route);
if (!route->protocol_set)
route->protocol = RTPROT_RA;
if (route->quickack < 0)
route->quickack = link->network->ipv6_accept_ra_quickack;
is_new = route_get(NULL, link, route, NULL) < 0;

View file

@ -221,6 +221,7 @@ DHCPv4.UseHostname, config_parse_bool,
DHCPv4.UseDomains, config_parse_dhcp_use_domains, AF_INET, 0
DHCPv4.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_use_routes)
DHCPv4.UseGateway, config_parse_tristate, 0, offsetof(Network, dhcp_use_gateway)
DHCPv4.QuickAck, config_parse_bool, 0, offsetof(Network, dhcp_quickack)
DHCPv4.RequestOptions, config_parse_dhcp_request_options, AF_INET, 0
DHCPv4.Anonymize, config_parse_bool, 0, offsetof(Network, dhcp_anonymize)
DHCPv4.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_send_hostname)
@ -279,6 +280,7 @@ IPv6AcceptRA.UseMTU, config_parse_bool,
IPv6AcceptRA.DHCPv6Client, config_parse_ipv6_accept_ra_start_dhcp6_client, 0, offsetof(Network, ipv6_accept_ra_start_dhcp6_client)
IPv6AcceptRA.RouteTable, config_parse_dhcp_or_ra_route_table, AF_INET6, 0
IPv6AcceptRA.RouteMetric, config_parse_ipv6_accept_ra_route_metric, 0, 0
IPv6AcceptRA.QuickAck, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_quickack)
IPv6AcceptRA.RouterAllowList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_allow_listed_router)
IPv6AcceptRA.RouterDenyList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_deny_listed_router)
IPv6AcceptRA.PrefixAllowList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_allow_listed_prefix)

View file

@ -146,6 +146,7 @@ struct Network {
bool dhcp_use_mtu;
bool dhcp_use_routes;
int dhcp_use_gateway;
bool dhcp_quickack;
bool dhcp_use_timezone;
bool dhcp_use_hostname;
bool dhcp_use_6rd;
@ -312,6 +313,7 @@ struct Network {
bool ipv6_accept_ra_use_autonomous_prefix;
bool ipv6_accept_ra_use_onlink_prefix;
bool ipv6_accept_ra_use_mtu;
bool ipv6_accept_ra_quickack;
bool active_slave;
bool primary_slave;
DHCPUseDomains ipv6_accept_ra_use_domains;