mirror of
https://github.com/systemd/systemd.git
synced 2025-03-01 08:58:29 +03:00
network/ndisc: drop redundant sd_ndisc_router_get_icmp6_ratelimit()
This effectively reverts 9175002864d8876f375e0df089d142d239282528. The retrans time field in RA message is for neighbor solicitation, and the commit d4c8de21a07d015f2f2c787e0735be5e4d02fb3c makes the value assigned to the correct sysctl property. Let's deprecate the option, and drop the redundant functions.
This commit is contained in:
parent
29eddf0ea4
commit
39af486a7f
@ -3394,16 +3394,6 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>UseICMP6RateLimit=</varname></term>
|
||||
<listitem>
|
||||
<para>Takes a boolean. When true, the ICMP6 rate limit received in the Router Advertisement will be set to ICMP6
|
||||
rate limit based on the advertisement. Defaults to true.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v255"/>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>UseGateway=</varname></term>
|
||||
<listitem>
|
||||
|
@ -29,7 +29,6 @@ struct sd_ndisc_router {
|
||||
|
||||
uint8_t hop_limit;
|
||||
uint32_t mtu;
|
||||
uint64_t icmp6_ratelimit_usec;
|
||||
};
|
||||
|
||||
static inline void* NDISC_ROUTER_RAW(const sd_ndisc_router *rt) {
|
||||
|
@ -144,7 +144,6 @@ int ndisc_router_parse(sd_ndisc *nd, sd_ndisc_router *rt) {
|
||||
rt->hop_limit = a->nd_ra_curhoplimit;
|
||||
rt->flags = a->nd_ra_flags_reserved; /* the first 8 bits */
|
||||
rt->lifetime_usec = be16_sec_to_usec(a->nd_ra_router_lifetime, /* max_as_infinity = */ false);
|
||||
rt->icmp6_ratelimit_usec = be32_msec_to_usec(a->nd_ra_retransmit, /* max_as_infinity = */ false);
|
||||
rt->reachable_time_usec = be32_msec_to_usec(a->nd_ra_reachable, /* mas_as_infinity = */ false);
|
||||
rt->retransmission_time_usec = be32_msec_to_usec(a->nd_ra_retransmit, /* max_as_infinity = */ false);
|
||||
|
||||
@ -294,14 +293,6 @@ int sd_ndisc_router_get_retransmission_time(sd_ndisc_router *rt, uint64_t *ret)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_ndisc_router_get_icmp6_ratelimit(sd_ndisc_router *rt, uint64_t *ret) {
|
||||
assert_return(rt, -EINVAL);
|
||||
assert_return(ret, -EINVAL);
|
||||
|
||||
*ret = rt->icmp6_ratelimit_usec;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_ndisc_router_get_flags(sd_ndisc_router *rt, uint64_t *ret) {
|
||||
assert_return(rt, -EINVAL);
|
||||
assert_return(ret, -EINVAL);
|
||||
|
@ -512,43 +512,6 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ndisc_router_process_icmp6_ratelimit(Link *link, sd_ndisc_router *rt) {
|
||||
usec_t icmp6_ratelimit, msec;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
assert(rt);
|
||||
|
||||
if (!link->network->ndisc_use_icmp6_ratelimit)
|
||||
return 0;
|
||||
|
||||
/* Ignore the icmp6 ratelimit field of the RA header if the lifetime is zero. */
|
||||
r = sd_ndisc_router_get_lifetime(rt, NULL);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
r = sd_ndisc_router_get_icmp6_ratelimit(rt, &icmp6_ratelimit);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Failed to get ICMP6 ratelimit from RA: %m");
|
||||
|
||||
/* We do not allow 0 here. */
|
||||
if (!timestamp_is_set(icmp6_ratelimit))
|
||||
return 0;
|
||||
|
||||
msec = DIV_ROUND_UP(icmp6_ratelimit, USEC_PER_MSEC);
|
||||
if (msec <= 0 || msec > INT_MAX)
|
||||
return 0;
|
||||
|
||||
/* Limit the maximal rates for sending ICMPv6 packets. 0 to disable any limiting, otherwise the
|
||||
* minimal space between responses in milliseconds. Default: 1000. */
|
||||
r = sysctl_write_ip_property_int(AF_INET6, NULL, "icmp/ratelimit", (int) msec);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(link, r, "Failed to apply ICMP6 ratelimit, ignoring: %m");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ndisc_router_process_reachable_time(Link *link, sd_ndisc_router *rt) {
|
||||
usec_t reachable_time, msec;
|
||||
int r;
|
||||
@ -1699,10 +1662,6 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = ndisc_router_process_icmp6_ratelimit(link, rt);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = ndisc_router_process_reachable_time(link, rt);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -303,7 +303,6 @@ IPv6AcceptRA.UseMTU, config_parse_bool,
|
||||
IPv6AcceptRA.UseHopLimit, config_parse_bool, 0, offsetof(Network, ndisc_use_hop_limit)
|
||||
IPv6AcceptRA.UseReachableTime, config_parse_bool, 0, offsetof(Network, ndisc_use_reachable_time)
|
||||
IPv6AcceptRA.UseRetransmissionTime, config_parse_bool, 0, offsetof(Network, ndisc_use_retransmission_time)
|
||||
IPv6AcceptRA.UseICMP6RateLimit, config_parse_bool, 0, offsetof(Network, ndisc_use_icmp6_ratelimit)
|
||||
IPv6AcceptRA.DHCPv6Client, config_parse_ndisc_start_dhcp6_client, 0, offsetof(Network, ndisc_start_dhcp6_client)
|
||||
IPv6AcceptRA.RouteTable, config_parse_dhcp_or_ra_route_table, AF_INET6, 0
|
||||
IPv6AcceptRA.RouteMetric, config_parse_ndisc_route_metric, 0, 0
|
||||
@ -621,6 +620,7 @@ DHCPv6PrefixDelegation.Token, config_parse_address_generation_typ
|
||||
DHCPv6PrefixDelegation.RouteMetric, config_parse_uint32, 0, offsetof(Network, dhcp_pd_route_metric)
|
||||
IPv6AcceptRA.DenyList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_deny_listed_prefix)
|
||||
IPv6AcceptRA.BlackList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_deny_listed_prefix)
|
||||
IPv6AcceptRA.UseICMP6RateLimit, config_parse_warn_compat, DISABLED_LEGACY, 0
|
||||
TrafficControlQueueingDiscipline.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
|
||||
TrafficControlQueueingDiscipline.NetworkEmulatorDelaySec, config_parse_network_emulator_delay, 0, 0
|
||||
TrafficControlQueueingDiscipline.NetworkEmulatorDelayJitterSec, config_parse_network_emulator_delay, 0, 0
|
||||
|
@ -483,7 +483,6 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||
.ndisc_use_hop_limit = true,
|
||||
.ndisc_use_reachable_time = true,
|
||||
.ndisc_use_retransmission_time = true,
|
||||
.ndisc_use_icmp6_ratelimit = true,
|
||||
.ndisc_route_table = RT_TABLE_MAIN,
|
||||
.ndisc_route_metric_high = IPV6RA_ROUTE_METRIC_HIGH,
|
||||
.ndisc_route_metric_medium = IPV6RA_ROUTE_METRIC_MEDIUM,
|
||||
|
@ -345,7 +345,6 @@ struct Network {
|
||||
bool ndisc_use_hop_limit;
|
||||
bool ndisc_use_reachable_time;
|
||||
bool ndisc_use_retransmission_time;
|
||||
bool ndisc_use_icmp6_ratelimit;
|
||||
bool ndisc_quickack;
|
||||
bool ndisc_use_captive_portal;
|
||||
bool ndisc_use_pref64;
|
||||
|
@ -37,7 +37,6 @@ int sd_ndisc_router_get_timestamp(sd_ndisc_router *rt, clockid_t clock, uint64_t
|
||||
int sd_ndisc_router_get_raw(sd_ndisc_router *rt, const void **ret, size_t *ret_size);
|
||||
|
||||
int sd_ndisc_router_get_hop_limit(sd_ndisc_router *rt, uint8_t *ret);
|
||||
int sd_ndisc_router_get_icmp6_ratelimit(sd_ndisc_router *rt, uint64_t *ret);
|
||||
int sd_ndisc_router_get_flags(sd_ndisc_router *rt, uint64_t *ret);
|
||||
int sd_ndisc_router_get_preference(sd_ndisc_router *rt, unsigned *ret);
|
||||
int sd_ndisc_router_get_lifetime(sd_ndisc_router *rt, uint64_t *ret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user