diff options
Diffstat (limited to 'src/core/ndisc')
| -rw-r--r-- | src/core/ndisc/nm-lndp-ndisc.c | 20 | ||||
| -rw-r--r-- | src/core/ndisc/nm-ndisc.c | 4 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/core/ndisc/nm-lndp-ndisc.c b/src/core/ndisc/nm-lndp-ndisc.c index 33e9ebf3..f0de2fd5 100644 --- a/src/core/ndisc/nm-lndp-ndisc.c +++ b/src/core/ndisc/nm-lndp-ndisc.c @@ -218,10 +218,22 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) /* Address */ if (r_plen == 64 && ndp_msg_opt_prefix_flag_auto_addr_conf(msg, offset)) { - const guint32 valid_time = ndp_msg_opt_prefix_valid_time(msg, offset); - const guint32 preferred_time = - NM_MIN(ndp_msg_opt_prefix_preferred_time(msg, offset), valid_time); - const NMNDiscAddress address = { + const guint32 valid_time = ndp_msg_opt_prefix_valid_time(msg, offset); + const guint32 preferred_time = ndp_msg_opt_prefix_preferred_time(msg, offset); + NMNDiscAddress address; + + /* + * RFC 4862 Section 5.5.3 states: + * c) If the preferred lifetime is greater than the valid lifetime, + * silently ignore the Prefix Information option. A node MAY wish to + * log a system management error in this case. + */ + if (preferred_time > valid_time) { + _LOGW("skipping PIO - preferred lifetime > valid lifetime"); + continue; + } + + address = (NMNDiscAddress) { .address = r_network, .expiry_msec = _nm_ndisc_lifetime_to_expiry(now_msec, valid_time), .expiry_preferred_msec = _nm_ndisc_lifetime_to_expiry(now_msec, preferred_time), diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c index ad2edd8d..1a2bf480 100644 --- a/src/core/ndisc/nm-ndisc.c +++ b/src/core/ndisc/nm-ndisc.c @@ -1490,7 +1490,7 @@ clean_addresses(NMNDisc *ndisc, gint64 now_msec, NMNDiscConfigMap *changed, gint g_array_set_size(rdata->addresses, j); } - if (_array_set_size_max(rdata->gateways, priv->config.max_addresses)) + if (_array_set_size_max(rdata->addresses, priv->config.max_addresses)) *changed |= NM_NDISC_CONFIG_ADDRESSES; } @@ -1830,7 +1830,7 @@ _config_init(NMNDiscConfig *config, const NMNDiscConfig *src) nm_assert(config); g_return_if_fail(src); - /* we only allow to set @config if it was cleared (or is not yet initialized). */ + /* we only allow one to set @config if it was cleared (or is not yet initialized). */ nm_assert(!config->l3cfg); nm_assert(!config->ifname); nm_assert(!config->network_id); |