Skip to content

Commit 473267a

Browse files
Patrick Rohrkuba-moo
authored andcommitted
net: add sysctl to disable rfc4862 5.5.3e lifetime handling
This change adds a sysctl to opt-out of RFC4862 section 5.5.3e's valid lifetime derivation mechanism. RFC4862 section 5.5.3e prescribes that the valid lifetime in a Router Advertisement PIO shall be ignored if it less than 2 hours and to reset the lifetime of the corresponding address to 2 hours. An in-progress 6man draft (see draft-ietf-6man-slaac-renum-07 section 4.2) is currently looking to remove this mechanism. While this draft has not been moving particularly quickly for other reasons, there is widespread consensus on section 4.2 which updates RFC4862 section 5.5.3e. Cc: Maciej Żenczykowski <[email protected]> Cc: Lorenzo Colitti <[email protected]> Cc: Jen Linkova <[email protected]> Signed-off-by: Patrick Rohr <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8989682 commit 473267a

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

Documentation/networking/ip-sysctl.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,17 @@ accept_ra_pinfo - BOOLEAN
23112311
- enabled if accept_ra is enabled.
23122312
- disabled if accept_ra is disabled.
23132313

2314+
ra_honor_pio_life - BOOLEAN
2315+
Whether to use RFC4862 Section 5.5.3e to determine the valid
2316+
lifetime of an address matching a prefix sent in a Router
2317+
Advertisement Prefix Information Option.
2318+
2319+
- If enabled, the PIO valid lifetime will always be honored.
2320+
- If disabled, RFC4862 section 5.5.3e is used to determine
2321+
the valid lifetime of the address.
2322+
2323+
Default: 0 (disabled)
2324+
23142325
accept_ra_rt_info_min_plen - INTEGER
23152326
Minimum prefix length of Route Information in RA.
23162327

include/linux/ipv6.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ struct ipv6_devconf {
8282
__u32 ioam6_id_wide;
8383
__u8 ioam6_enabled;
8484
__u8 ndisc_evict_nocarrier;
85+
__u8 ra_honor_pio_life;
8586

8687
struct ctl_table_header *sysctl_header;
8788
};

net/ipv6/addrconf.c

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
236236
.ioam6_id = IOAM6_DEFAULT_IF_ID,
237237
.ioam6_id_wide = IOAM6_DEFAULT_IF_ID_WIDE,
238238
.ndisc_evict_nocarrier = 1,
239+
.ra_honor_pio_life = 0,
239240
};
240241

241242
static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -297,6 +298,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
297298
.ioam6_id = IOAM6_DEFAULT_IF_ID,
298299
.ioam6_id_wide = IOAM6_DEFAULT_IF_ID_WIDE,
299300
.ndisc_evict_nocarrier = 1,
301+
.ra_honor_pio_life = 0,
300302
};
301303

302304
/* Check if link is ready: is it up and is a valid qdisc available */
@@ -2657,22 +2659,23 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
26572659
stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ;
26582660
else
26592661
stored_lft = 0;
2660-
if (!create && stored_lft) {
2662+
2663+
/* RFC4862 Section 5.5.3e:
2664+
* "Note that the preferred lifetime of the
2665+
* corresponding address is always reset to
2666+
* the Preferred Lifetime in the received
2667+
* Prefix Information option, regardless of
2668+
* whether the valid lifetime is also reset or
2669+
* ignored."
2670+
*
2671+
* So we should always update prefered_lft here.
2672+
*/
2673+
update_lft = !create && stored_lft;
2674+
2675+
if (update_lft && !in6_dev->cnf.ra_honor_pio_life) {
26612676
const u32 minimum_lft = min_t(u32,
26622677
stored_lft, MIN_VALID_LIFETIME);
26632678
valid_lft = max(valid_lft, minimum_lft);
2664-
2665-
/* RFC4862 Section 5.5.3e:
2666-
* "Note that the preferred lifetime of the
2667-
* corresponding address is always reset to
2668-
* the Preferred Lifetime in the received
2669-
* Prefix Information option, regardless of
2670-
* whether the valid lifetime is also reset or
2671-
* ignored."
2672-
*
2673-
* So we should always update prefered_lft here.
2674-
*/
2675-
update_lft = 1;
26762679
}
26772680

26782681
if (update_lft) {
@@ -6846,6 +6849,15 @@ static const struct ctl_table addrconf_sysctl[] = {
68466849
.mode = 0644,
68476850
.proc_handler = proc_dointvec,
68486851
},
6852+
{
6853+
.procname = "ra_honor_pio_life",
6854+
.data = &ipv6_devconf.ra_honor_pio_life,
6855+
.maxlen = sizeof(u8),
6856+
.mode = 0644,
6857+
.proc_handler = proc_dou8vec_minmax,
6858+
.extra1 = SYSCTL_ZERO,
6859+
.extra2 = SYSCTL_ONE,
6860+
},
68496861
#ifdef CONFIG_IPV6_ROUTER_PREF
68506862
{
68516863
.procname = "accept_ra_rtr_pref",

0 commit comments

Comments
 (0)