Merge pull request #26071 from yuwata/network-dhcp-quick-ack

network: make TCP quick ACK mode for dynamic routes configurable
This commit is contained in:
Luca Boccassi 2023-01-16 19:41:03 +00:00 committed by GitHub
commit 37df1221d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 9 deletions

19
NEWS
View file

@ -48,13 +48,6 @@ CHANGES WITH 253 in spe:
* systemd-fstab-generator now supports x-systemd.makefs option for
/sysroot (in the initrd).
* The [DHCPv4] section in .network file gained new SocketPriority=
setting that assigns the Linux socket priority used by the DHCPv4
raw socket. Can be used in conjuntion with the EgressQOSMaps=setting in
[VLAN] section of .netdev file to send the desired ethernet 802.1Q frame
priority for DHCPv4 initial packets. This cannot be achieved with
netfilter mangle tables because of the raw socket bypass.
Changes in udev:
* The new net naming scheme "v253" has been introduced. In the new
@ -120,6 +113,18 @@ CHANGES WITH 253 in spe:
Changes in systemd-networkd and related tools:
* The [DHCPv4] section in .network file gained new SocketPriority=
setting that assigns the Linux socket priority used by the DHCPv4
raw socket. Can be used in conjuntion with the EgressQOSMaps=setting
in [VLAN] section of .netdev file to send the desired ethernet 802.1Q
frame priority for DHCPv4 initial packets. This cannot be achieved
with netfilter mangle tables because of the raw socket bypass.
* The [DHCPv4] and [IPv6AcceptRA] sections in .network file gained new
QuickAck= boolean setting that enables the TCP quick ACK mode for the
routes configured by the aquired DHCPv4 lease or received router
advertisements (RAs).
* The RouteMetric= option (for DHCPv4, DHCPv6, and IPv6 advertised
routes) now accepts three values, for high, medium, and low preference
of the router (which can be set with the RouterPreference=) setting.

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;