mirror of
https://github.com/systemd/systemd.git
synced 2025-01-23 02:04:32 +03:00
network/radv: introduce ReachableTimeSec= setting
To make the reachable time in the RA header sent by networkd configurable.
This commit is contained in:
parent
bc50700c7e
commit
59d475ba40
@ -4017,6 +4017,19 @@ ServerAddress=192.168.0.1/24</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>ReachableTimeSec=</varname></term>
|
||||
|
||||
<listitem>
|
||||
<para>Configures the time, used in the Neighbor Unreachability Detection algorithm, for which
|
||||
clients can assume a neighbor is reachable after having received a reachability confirmation. Takes
|
||||
a time span in the range 0…4294967295 ms. When 0, clients will handle it as if the value wasn't
|
||||
specified. Defaults to 0.</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v256"/>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>RetransmitSec=</varname></term>
|
||||
|
||||
|
@ -43,9 +43,11 @@
|
||||
#define RADV_MAX_ROUTER_LIFETIME_USEC (9000 * USEC_PER_SEC)
|
||||
#define RADV_DEFAULT_ROUTER_LIFETIME_USEC (3 * RADV_DEFAULT_MAX_TIMEOUT_USEC)
|
||||
/* RFC 4861 section 4.2.
|
||||
* Retrans Timer
|
||||
* Reachable Time and Retrans Timer
|
||||
* 32-bit unsigned integer. The time, in milliseconds. */
|
||||
#define RADV_MAX_RETRANSMIT_USEC (UINT32_MAX * USEC_PER_MSEC)
|
||||
#define RADV_MAX_UINT32_MSEC_USEC (UINT32_MAX * USEC_PER_MSEC)
|
||||
#define RADV_MAX_REACHABLE_TIME_USEC RADV_MAX_UINT32_MSEC_USEC
|
||||
#define RADV_MAX_RETRANSMIT_USEC RADV_MAX_UINT32_MSEC_USEC
|
||||
/* draft-ietf-6man-slaac-renum-02 section 4.1.1.
|
||||
* AdvPreferredLifetime: max(AdvDefaultLifetime, 3 * MaxRtrAdvInterval)
|
||||
* AdvValidLifetime: 2 * AdvPreferredLifetime */
|
||||
|
@ -393,7 +393,8 @@ DHCPPrefixDelegation.RouteMetric, config_parse_uint32,
|
||||
DHCPPrefixDelegation.NetLabel, config_parse_string, CONFIG_PARSE_STRING_SAFE, offsetof(Network, dhcp_pd_netlabel)
|
||||
DHCPPrefixDelegation.NFTSet, config_parse_nft_set, NFT_SET_PARSE_NETWORK, offsetof(Network, dhcp_pd_nft_set_context)
|
||||
IPv6SendRA.RouterLifetimeSec, config_parse_router_lifetime, 0, offsetof(Network, router_lifetime_usec)
|
||||
IPv6SendRA.RetransmitSec, config_parse_router_retransmit, 0, offsetof(Network, router_retransmit_usec)
|
||||
IPv6SendRA.ReachableTimeSec, config_parse_router_uint32_msec_usec, 0, offsetof(Network, router_reachable_usec)
|
||||
IPv6SendRA.RetransmitSec, config_parse_router_uint32_msec_usec, 0, offsetof(Network, router_retransmit_usec)
|
||||
IPv6SendRA.Managed, config_parse_bool, 0, offsetof(Network, router_managed)
|
||||
IPv6SendRA.OtherInformation, config_parse_bool, 0, offsetof(Network, router_other_information)
|
||||
IPv6SendRA.RouterPreference, config_parse_router_preference, 0, 0
|
||||
|
@ -246,6 +246,7 @@ struct Network {
|
||||
RADVPrefixDelegation router_prefix_delegation;
|
||||
usec_t router_lifetime_usec;
|
||||
uint8_t router_preference;
|
||||
usec_t router_reachable_usec;
|
||||
usec_t router_retransmit_usec;
|
||||
uint8_t router_hop_limit;
|
||||
bool router_managed;
|
||||
|
@ -577,6 +577,10 @@ static int radv_configure(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
r = sd_radv_set_reachable_time(link->radv, link->network->router_reachable_usec);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (link->network->router_retransmit_usec > 0) {
|
||||
r = sd_radv_set_retransmit(link->radv, link->network->router_retransmit_usec);
|
||||
if (r < 0)
|
||||
@ -1496,7 +1500,7 @@ int config_parse_router_lifetime(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_router_retransmit(
|
||||
int config_parse_router_uint32_msec_usec(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
@ -1508,7 +1512,7 @@ int config_parse_router_retransmit(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
usec_t usec, *router_retransmit_usec = ASSERT_PTR(data);
|
||||
usec_t usec, *router_usec = ASSERT_PTR(data);
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
@ -1517,7 +1521,7 @@ int config_parse_router_retransmit(
|
||||
assert(rvalue);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*router_retransmit_usec = 0;
|
||||
*router_usec = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1529,13 +1533,13 @@ int config_parse_router_retransmit(
|
||||
}
|
||||
|
||||
if (usec != USEC_INFINITY &&
|
||||
usec > RADV_MAX_RETRANSMIT_USEC) {
|
||||
usec > RADV_MAX_UINT32_MSEC_USEC) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Invalid [%s] %s=, ignoring assignment: %s", section, lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*router_retransmit_usec = usec;
|
||||
*router_usec = usec;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ RADVPrefixDelegation radv_prefix_delegation_from_string(const char *s) _pure_;
|
||||
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_router_prefix_delegation);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_router_lifetime);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_router_retransmit);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_router_uint32_msec_usec);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_router_preference);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_boolean);
|
||||
|
Loading…
x
Reference in New Issue
Block a user