diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-02-27 11:31:26 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2024-02-28 12:05:00 +0100 |
commit | 39af486a7fdc67817652c51d9bf42ca051ed8ff2 (patch) | |
tree | 19756ecd35afe789d4c386228345ec961b921831 /src | |
parent | nspawn: minor coding style tweaks to nspawn-register.c (diff) | |
download | systemd-39af486a7fdc67817652c51d9bf42ca051ed8ff2.tar.xz systemd-39af486a7fdc67817652c51d9bf42ca051ed8ff2.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-network/ndisc-router-internal.h | 1 | ||||
-rw-r--r-- | src/libsystemd-network/sd-ndisc-router.c | 9 | ||||
-rw-r--r-- | src/network/networkd-ndisc.c | 41 | ||||
-rw-r--r-- | src/network/networkd-network-gperf.gperf | 2 | ||||
-rw-r--r-- | src/network/networkd-network.c | 1 | ||||
-rw-r--r-- | src/network/networkd-network.h | 1 | ||||
-rw-r--r-- | src/systemd/sd-ndisc-router.h | 1 |
7 files changed, 1 insertions, 55 deletions
diff --git a/src/libsystemd-network/ndisc-router-internal.h b/src/libsystemd-network/ndisc-router-internal.h index 5bd9a65dd2..e39b4db3c4 100644 --- a/src/libsystemd-network/ndisc-router-internal.h +++ b/src/libsystemd-network/ndisc-router-internal.h @@ -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) { diff --git a/src/libsystemd-network/sd-ndisc-router.c b/src/libsystemd-network/sd-ndisc-router.c index b90fb77cd8..b1eb957dfe 100644 --- a/src/libsystemd-network/sd-ndisc-router.c +++ b/src/libsystemd-network/sd-ndisc-router.c @@ -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); diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 24808413c1..33bd7335a1 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -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; diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 9171056156..dffc40308c 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -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 diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 601820b123..3d418006d6 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -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, diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index b30e3b2209..467789bd68 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -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; diff --git a/src/systemd/sd-ndisc-router.h b/src/systemd/sd-ndisc-router.h index 7cde2979ac..bfdaeb4689 100644 --- a/src/systemd/sd-ndisc-router.h +++ b/src/systemd/sd-ndisc-router.h @@ -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); |