network/ndisc: drop redundant sd_ndisc_router_get_icmp6_ratelimit()
This effectively reverts9175002864. The retrans time field in RA message is for neighbor solicitation, and the commitd4c8de21a0makes the value assigned to the correct sysctl property. Let's deprecate the option, and drop the redundant functions.
This commit is contained in:
committed by
Luca Boccassi
parent
29eddf0ea4
commit
39af486a7f
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user