Revert "IPv6 SLAAC: Clamp received PIO and RIO Lifetime Values"

This reverts commit 0cbd9193cd.
This reverts commit a5290915d5.

(cherry picked from commit ad5fdd9d62)
This commit is contained in:
Thomas Haller 2020-04-21 08:37:33 +02:00
parent 8b7f0c4606
commit 0ba9aff4bc
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -101,8 +101,6 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
int offset;
int hop_limit;
guint32 val;
guint32 clamp_pltime;
guint32 clamp_vltime;
/* Router discovery is subject to the following RFC documents:
*
@ -167,22 +165,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
changed |= NM_NDISC_CONFIG_GATEWAYS;
}
/* Addresses & Routes
*
* The Preferred Lifetime and Valid Lifetime of PIOs are capped to Router Lifetime
* and NM_NDISC_VLTIME_MULT * Preferred Lifetime, respectively.
*
* The Lifetime of RIOs is capped to the Router Lifetime (there is no point in
* maintaining a route if it employs a dead router).
*
* See draft-gont-6man-slaac-renum
*/
#define NM_NDISC_VLTIME_MULT ((guint32) 48)
clamp_pltime = ndp_msgra_router_lifetime (msgra);
/* clamp_pltime has at most 16 bit set, and multiplication cannot overflow. */
clamp_vltime = clamp_pltime * NM_NDISC_VLTIME_MULT;
/* Addresses & Routes */
ndp_msg_opt_for_each_offset (offset, msg, NDP_MSG_OPT_PREFIX) {
guint8 r_plen;
struct in6_addr r_network;
@ -203,7 +186,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
.network = r_network,
.plen = r_plen,
.timestamp = now,
.lifetime = NM_MIN (ndp_msg_opt_prefix_valid_time (msg, offset), clamp_vltime),
.lifetime = ndp_msg_opt_prefix_valid_time (msg, offset),
};
if (nm_ndisc_add_route (ndisc, &route))
@ -216,8 +199,8 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
NMNDiscAddress address = {
.address = r_network,
.timestamp = now,
.lifetime = NM_MIN (ndp_msg_opt_prefix_valid_time (msg, offset), clamp_vltime),
.preferred = NM_MIN (ndp_msg_opt_prefix_preferred_time (msg, offset), clamp_pltime),
.lifetime = ndp_msg_opt_prefix_valid_time (msg, offset),
.preferred = ndp_msg_opt_prefix_preferred_time (msg, offset),
};
if (address.preferred <= address.lifetime) {
@ -231,7 +214,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data)
.gateway = gateway_addr,
.plen = ndp_msg_opt_route_prefix_len (msg, offset),
.timestamp = now,
.lifetime = NM_MIN (ndp_msg_opt_route_lifetime (msg, offset), clamp_pltime),
.lifetime = ndp_msg_opt_route_lifetime (msg, offset),
.preference = _route_preference_coerce (ndp_msg_opt_route_preference (msg, offset)),
};