diff options
-rw-r--r-- | src/ndisc/nm-lndp-ndisc.c | 8 | ||||
-rw-r--r-- | src/ndisc/nm-ndisc.c | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/ndisc/nm-lndp-ndisc.c b/src/ndisc/nm-lndp-ndisc.c index 8bb1812764..48a17bdf4f 100644 --- a/src/ndisc/nm-lndp-ndisc.c +++ b/src/ndisc/nm-lndp-ndisc.c @@ -221,10 +221,10 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) .preferred = ndp_msg_opt_prefix_preferred_time (msg, offset), }; - if (address.preferred > address.lifetime) - address.preferred = address.lifetime; - if (nm_ndisc_complete_and_add_address (ndisc, &address)) - changed |= NM_NDISC_CONFIG_ADDRESSES; + if (address.preferred <= address.lifetime) { + if (nm_ndisc_complete_and_add_address (ndisc, &address)) + changed |= NM_NDISC_CONFIG_ADDRESSES; + } } } ndp_msg_opt_for_each_offset(offset, msg, NDP_MSG_OPT_ROUTE) { diff --git a/src/ndisc/nm-ndisc.c b/src/ndisc/nm-ndisc.c index a6b4453891..9c80c0ec15 100644 --- a/src/ndisc/nm-ndisc.c +++ b/src/ndisc/nm-ndisc.c @@ -416,6 +416,7 @@ nm_ndisc_add_address (NMNDisc *ndisc, const NMNDiscAddress *new) nm_assert (new->timestamp > 0 && new->timestamp < G_MAXINT32); nm_assert (!IN6_IS_ADDR_UNSPECIFIED (&new->address)); nm_assert (!IN6_IS_ADDR_LINKLOCAL (&new->address)); + nm_assert (new->preferred <= new->lifetime); for (i = 0; i < rdata->addresses->len; i++) { NMNDiscAddress *item = &g_array_index (rdata->addresses, NMNDiscAddress, i); |