diff options
| author | Michael Biebl <biebl@debian.org> | 2020-04-11 21:28:04 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-04-11 21:28:04 +0200 |
| commit | 1e5977b62f896e844b548c3007ace9e1dfa7f9ed (patch) | |
| tree | 7a7416ed410e72b6200f3d860fd315ec11cc106b /src/ndisc | |
| parent | b012fa6e1d808e0736c009799c62d835cbfcc1dd (diff) | |
New upstream version 1.23.90 upstream/1.23.90
Diffstat (limited to 'src/ndisc')
| -rw-r--r-- | src/ndisc/nm-fake-ndisc.c | 8 | ||||
| -rw-r--r-- | src/ndisc/nm-lndp-ndisc.c | 84 | ||||
| -rw-r--r-- | src/ndisc/nm-ndisc.c | 73 | ||||
| -rw-r--r-- | src/ndisc/tests/meson.build | 2 | ||||
| -rw-r--r-- | src/ndisc/tests/test-ndisc-fake.c | 17 |
5 files changed, 100 insertions, 84 deletions
diff --git a/src/ndisc/nm-fake-ndisc.c b/src/ndisc/nm-fake-ndisc.c index 020764d3..5f4594b9 100644 --- a/src/ndisc/nm-fake-ndisc.c +++ b/src/ndisc/nm-fake-ndisc.c @@ -62,7 +62,7 @@ struct _NMFakeRNDiscClass { G_DEFINE_TYPE (NMFakeNDisc, nm_fake_ndisc, NM_TYPE_NDISC) -#define NM_FAKE_NDISC_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMFakeNDisc, NM_IS_FAKE_NDISC) +#define NM_FAKE_NDISC_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMFakeNDisc, NM_IS_FAKE_NDISC, NMNDisc) /*****************************************************************************/ @@ -234,7 +234,7 @@ receive_ra (gpointer user_data) NMNDiscDataInternal *rdata = ndisc->rdata; FakeRa *ra = priv->ras->data; NMNDiscConfigMap changed = 0; - gint32 now = nm_utils_get_monotonic_timestamp_s (); + gint32 now = nm_utils_get_monotonic_timestamp_sec (); guint i; NMNDiscDHCPLevel dhcp_level; @@ -326,7 +326,7 @@ receive_ra (gpointer user_data) static void start (NMNDisc *ndisc) { - NMFakeNDiscPrivate *priv = NM_FAKE_NDISC_GET_PRIVATE ((NMFakeNDisc *) ndisc); + NMFakeNDiscPrivate *priv = NM_FAKE_NDISC_GET_PRIVATE (ndisc); FakeRa *ra; /* Queue up the first fake RA */ @@ -366,7 +366,7 @@ nm_fake_ndisc_new (int ifindex, const char *ifname) static void dispose (GObject *object) { - NMFakeNDiscPrivate *priv = NM_FAKE_NDISC_GET_PRIVATE ((NMFakeNDisc *) object); + NMFakeNDiscPrivate *priv = NM_FAKE_NDISC_GET_PRIVATE (object); nm_clear_g_source (&priv->receive_ra_id); diff --git a/src/ndisc/nm-lndp-ndisc.c b/src/ndisc/nm-lndp-ndisc.c index 6f2815ef..b698489c 100644 --- a/src/ndisc/nm-lndp-ndisc.c +++ b/src/ndisc/nm-lndp-ndisc.c @@ -24,9 +24,7 @@ typedef struct { struct ndp *ndp; - - GIOChannel *event_channel; - guint event_id; + GSource *event_source; } NMLndpNDiscPrivate; /*****************************************************************************/ @@ -44,14 +42,14 @@ struct _NMLndpNDiscClass { G_DEFINE_TYPE (NMLndpNDisc, nm_lndp_ndisc, NM_TYPE_NDISC) -#define NM_LNDP_NDISC_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMLndpNDisc, NM_IS_LNDP_NDISC) +#define NM_LNDP_NDISC_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMLndpNDisc, NM_IS_LNDP_NDISC, NMNDisc) /*****************************************************************************/ static gboolean send_rs (NMNDisc *ndisc, GError **error) { - NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE ((NMLndpNDisc *) ndisc); + NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE (ndisc); struct ndp_msg *msg; int errsv; @@ -99,10 +97,12 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) NMNDiscConfigMap changed = 0; struct ndp_msgra *msgra = ndp_msgra (msg); struct in6_addr gateway_addr; - gint32 now = nm_utils_get_monotonic_timestamp_s (); + gint32 now = nm_utils_get_monotonic_timestamp_sec (); int offset; int hop_limit; guint32 val; + guint32 clamp_pltime; + guint32 clamp_vltime; /* Router discovery is subject to the following RFC documents: * @@ -167,7 +167,22 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) changed |= NM_NDISC_CONFIG_GATEWAYS; } - /* Addresses & Routes */ + /* 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_vltime = (clamp_pltime < G_MAXUINT32 / NM_NDISC_VLTIME_MULT) + ? clamp_pltime * NM_NDISC_VLTIME_MULT + : G_MAXUINT32; + ndp_msg_opt_for_each_offset (offset, msg, NDP_MSG_OPT_PREFIX) { guint8 r_plen; struct in6_addr r_network; @@ -188,7 +203,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) .network = r_network, .plen = r_plen, .timestamp = now, - .lifetime = ndp_msg_opt_prefix_valid_time (msg, offset), + .lifetime = NM_MIN (ndp_msg_opt_prefix_valid_time (msg, offset), clamp_vltime), }; if (nm_ndisc_add_route (ndisc, &route)) @@ -201,8 +216,8 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) NMNDiscAddress address = { .address = r_network, .timestamp = now, - .lifetime = ndp_msg_opt_prefix_valid_time (msg, offset), - .preferred = ndp_msg_opt_prefix_preferred_time (msg, offset), + .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), }; if (address.preferred <= address.lifetime) { @@ -216,7 +231,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 = ndp_msg_opt_route_lifetime (msg, offset), + .lifetime = NM_MIN (ndp_msg_opt_route_lifetime (msg, offset), clamp_pltime), .preference = _route_preference_coerce (ndp_msg_opt_route_preference (msg, offset)), }; @@ -231,7 +246,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) /* DNS information */ ndp_msg_opt_for_each_offset(offset, msg, NDP_MSG_OPT_RDNSS) { - static struct in6_addr *addr; + struct in6_addr *addr; int addr_index; ndp_msg_opt_rdnss_for_each_addr (addr, addr_index, msg, offset) { @@ -260,7 +275,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) NMNDiscDNSDomain dns_domain = { .domain = domain, .timestamp = now, - .lifetime = ndp_msg_opt_rdnss_lifetime (msg, offset), + .lifetime = ndp_msg_opt_dnssl_lifetime (msg, offset), }; /* Pad the lifetime somewhat to give a bit of slack in cases @@ -346,9 +361,9 @@ typedef struct { static gboolean send_ra (NMNDisc *ndisc, GError **error) { - NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE ((NMLndpNDisc *) ndisc); + NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE (ndisc); NMNDiscDataInternal *rdata = ndisc->rdata; - gint32 now = nm_utils_get_monotonic_timestamp_s (); + gint32 now = nm_utils_get_monotonic_timestamp_sec (); int errsv; struct in6_addr *addr; struct ndp_msg *msg; @@ -484,17 +499,19 @@ receive_rs (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) } static gboolean -event_ready (GIOChannel *source, GIOCondition condition, NMNDisc *ndisc) +event_ready (int fd, + GIOCondition condition, + gpointer user_data) { - _nm_unused gs_unref_object NMNDisc *ndisc_keep_alive = g_object_ref (ndisc); + gs_unref_object NMNDisc *ndisc = g_object_ref (NM_NDISC (user_data)); nm_auto_pop_netns NMPNetns *netns = NULL; - NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE ((NMLndpNDisc *) ndisc); + NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE (ndisc); _LOGD ("processing libndp events"); if (!nm_ndisc_netns_push (ndisc, &netns)) { /* something is very wrong. Stop handling events. */ - priv->event_id = 0; + nm_clear_g_source_inst (&priv->event_source); return G_SOURCE_REMOVE; } @@ -505,17 +522,23 @@ event_ready (GIOChannel *source, GIOCondition condition, NMNDisc *ndisc) static void start (NMNDisc *ndisc) { - NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE ((NMLndpNDisc *) ndisc); - int fd = ndp_get_eventfd (priv->ndp); + NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE (ndisc); + int fd; + + g_return_if_fail (!priv->event_source); - g_return_if_fail (!priv->event_channel); - g_return_if_fail (!priv->event_id); + fd = ndp_get_eventfd (priv->ndp); - priv->event_channel = g_io_channel_unix_new (fd); - priv->event_id = g_io_add_watch (priv->event_channel, G_IO_IN, (GIOFunc) event_ready, ndisc); + priv->event_source = nm_g_unix_fd_source_new (fd, + G_IO_IN, + G_PRIORITY_DEFAULT, + event_ready, + ndisc, + NULL); + g_source_attach (priv->event_source, NULL); /* Flush any pending messages to avoid using obsolete information */ - event_ready (priv->event_channel, 0, ndisc); + event_ready (fd, 0, ndisc); switch (nm_ndisc_get_node_type (ndisc)) { case NM_NDISC_NODE_TYPE_HOST: @@ -592,7 +615,7 @@ nm_lndp_ndisc_new (NMPlatform *platform, 1, G_MAXINT32, NM_NDISC_ROUTER_SOLICITATION_INTERVAL_DEFAULT), NULL); - priv = NM_LNDP_NDISC_GET_PRIVATE ((NMLndpNDisc *) ndisc); + priv = NM_LNDP_NDISC_GET_PRIVATE (ndisc); errsv = ndp_open (&priv->ndp); @@ -610,11 +633,10 @@ nm_lndp_ndisc_new (NMPlatform *platform, static void dispose (GObject *object) { - NMNDisc *ndisc = (NMNDisc *) object; - NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE ((NMLndpNDisc *) ndisc); + NMNDisc *ndisc = NM_NDISC (object); + NMLndpNDiscPrivate *priv = NM_LNDP_NDISC_GET_PRIVATE (ndisc); - nm_clear_g_source (&priv->event_id); - g_clear_pointer (&priv->event_channel, g_io_channel_unref); + nm_clear_g_source_inst (&priv->event_source); if (priv->ndp) { switch (nm_ndisc_get_node_type (ndisc)) { diff --git a/src/ndisc/nm-ndisc.c b/src/ndisc/nm-ndisc.c index 0afca26b..bb3a92b0 100644 --- a/src/ndisc/nm-ndisc.c +++ b/src/ndisc/nm-ndisc.c @@ -173,7 +173,7 @@ _get_exp (char *buf, gsize buf_size, gint64 now_ns, gint64 expiry_time) return "permanent"; l = g_snprintf (buf, buf_size, "%.4f", - ((double) ((expiry_time * NM_UTILS_NS_PER_SECOND) - now_ns)) / ((double) NM_UTILS_NS_PER_SECOND)); + ((double) ((expiry_time * NM_UTILS_NSEC_PER_SEC) - now_ns)) / ((double) NM_UTILS_NSEC_PER_SEC)); nm_assert (l < buf_size); return buf; } @@ -442,8 +442,15 @@ nm_ndisc_add_address (NMNDisc *ndisc, } if (existing) { + /* A Valid Lifetime of 0 eliminates the corresponding address(es). This deviates + * from RFC4862 Section 5.5.3, item e), as recommended in IETF draft draft-gont-6man-slaac-renum. + */ + if (new->lifetime == 0) { + g_array_remove_index (rdata->addresses, i); + return TRUE; + } + if (from_ra) { - const gint32 NM_NDISC_PREFIX_LFT_MIN = 7200; /* seconds, RFC4862 5.5.3.e */ gint64 old_expiry_lifetime, old_expiry_preferred; old_expiry_lifetime = get_expiry (existing); @@ -452,25 +459,16 @@ nm_ndisc_add_address (NMNDisc *ndisc, if (new->lifetime == NM_NDISC_INFINITY) existing->lifetime = NM_NDISC_INFINITY; else { - gint64 new_lifetime, remaining_lifetime; + gint64 new_lifetime; - /* see RFC4862 5.5.3.e */ - if (existing->lifetime == NM_NDISC_INFINITY) - remaining_lifetime = G_MAXINT64; - else - remaining_lifetime = ((gint64) existing->timestamp) + ((gint64) existing->lifetime) - ((gint64) now_s); + /* Honor small valid lifetimes, as discussed in + * draft-gont-6man-slaac-renum, to allow for more timelier + * reaction to renumbering events. This deviates from + * RFC4862 Section 5.5.3, item e). + */ new_lifetime = ((gint64) new->timestamp) + ((gint64) new->lifetime) - ((gint64) now_s); - - if ( new_lifetime > (gint64) NM_NDISC_PREFIX_LFT_MIN - || new_lifetime > remaining_lifetime) { - existing->timestamp = now_s; - existing->lifetime = CLAMP (new_lifetime, (gint64) 0, (gint64) (G_MAXUINT32 - 1)); - } else if (remaining_lifetime <= (gint64) NM_NDISC_PREFIX_LFT_MIN) { - /* keep the current lifetime. */ - } else { - existing->timestamp = now_s; - existing->lifetime = NM_NDISC_PREFIX_LFT_MIN; - } + existing->timestamp = now_s; + existing->lifetime = CLAMP (new_lifetime, (gint64) 0, (gint64) (G_MAXUINT32 - 1)); } if (new->preferred == NM_NDISC_INFINITY) { @@ -487,11 +485,6 @@ nm_ndisc_add_address (NMNDisc *ndisc, || old_expiry_preferred != get_expiry_preferred (existing); } - if (new->lifetime == 0) { - g_array_remove_index (rdata->addresses, i); - return TRUE; - } - if ( get_expiry (existing) == get_expiry (new) && get_expiry_preferred (existing) == get_expiry_preferred (new)) return FALSE; @@ -676,7 +669,7 @@ nm_ndisc_add_dns_domain (NMNDisc *ndisc, const NMNDiscDNSDomain *new) _different_message = g_strcmp0 (priv->last_error, error->message) != 0; \ _NMLOG (_different_message ? LOGL_WARN : LOGL_DEBUG, __VA_ARGS__); \ if (_different_message) { \ - g_clear_pointer (&priv->last_error, g_free); \ + nm_clear_g_free (&priv->last_error); \ priv->last_error = g_strdup (error->message); \ } \ } G_STMT_END @@ -697,13 +690,13 @@ send_rs_timeout (NMNDisc *ndisc) if (klass->send_rs (ndisc, &error)) { _LOGD ("router solicitation sent"); priv->solicitations_left--; - g_clear_pointer (&priv->last_error, g_free); + nm_clear_g_free (&priv->last_error); } else { _MAYBE_WARN ("failure sending router solicitation: %s", error->message); g_clear_error (&error); } - priv->last_rs = nm_utils_get_monotonic_timestamp_s (); + priv->last_rs = nm_utils_get_monotonic_timestamp_sec (); if (priv->solicitations_left > 0) { _LOGD ("scheduling router solicitation retry in %d seconds.", (int) priv->router_solicitation_interval); @@ -727,7 +720,7 @@ solicit_routers (NMNDisc *ndisc) if (priv->send_rs_id) return; - now = nm_utils_get_monotonic_timestamp_s (); + now = nm_utils_get_monotonic_timestamp_sec (); priv->solicitations_left = priv->router_solicitations; t = (((gint64) priv->last_rs) + priv->router_solicitation_interval) - now; @@ -748,10 +741,10 @@ announce_router (NMNDisc *ndisc) if (!nm_ndisc_netns_push (ndisc, &netns)) return G_SOURCE_REMOVE; - priv->last_ra = nm_utils_get_monotonic_timestamp_s (); + priv->last_ra = nm_utils_get_monotonic_timestamp_sec (); if (klass->send_ra (ndisc, &error)) { _LOGD ("router advertisement sent"); - g_clear_pointer (&priv->last_error, g_free); + nm_clear_g_free (&priv->last_error); } else { _MAYBE_WARN ("failure sending router advertisement: %s", error->message); g_clear_error (&error); @@ -788,7 +781,7 @@ announce_router_initial (NMNDisc *ndisc) priv->announcements_left = NM_NDISC_ROUTER_ADVERTISEMENTS_DEFAULT; /* Unschedule an unsolicited resend if we are allowed to send now. */ - if (G_LIKELY (nm_utils_get_monotonic_timestamp_s () - priv->last_ra > NM_NDISC_ROUTER_ADVERT_DELAY)) + if (G_LIKELY (nm_utils_get_monotonic_timestamp_sec () - priv->last_ra > NM_NDISC_ROUTER_ADVERT_DELAY)) nm_clear_g_source (&priv->send_ra_id); /* Schedule the initial send rather early. Clamp the delay by minimal @@ -807,7 +800,7 @@ announce_router_solicited (NMNDisc *ndisc) _LOGD ("will send an solicited router advertisement"); /* Unschedule an unsolicited resend if we are allowed to send now. */ - if (nm_utils_get_monotonic_timestamp_s () - priv->last_ra > NM_NDISC_ROUTER_ADVERT_DELAY) + if (nm_utils_get_monotonic_timestamp_sec () - priv->last_ra > NM_NDISC_ROUTER_ADVERT_DELAY) nm_clear_g_source (&priv->send_ra_id); if (!priv->send_ra_id) { @@ -965,7 +958,7 @@ nm_ndisc_dad_failed (NMNDisc *ndisc, const struct in6_addr *address, gboolean em if (IN6_ARE_ADDR_EQUAL (&item->address, address)) { char sbuf[NM_UTILS_INET_ADDRSTRLEN]; - _LOGD ("DAD failed for discovered address %s", nm_utils_inet6_ntop (address, sbuf)); + _LOGD ("DAD failed for discovered address %s", _nm_utils_inet6_ntop (address, sbuf)); changed = TRUE; if (!complete_address (ndisc, item)) { g_array_remove_index (rdata->addresses, i); @@ -1031,7 +1024,7 @@ _config_changed_log (NMNDisc *ndisc, NMNDiscConfigMap changed) if (!_LOGD_ENABLED ()) return; - now_ns = nm_utils_get_monotonic_timestamp_ns (); + now_ns = nm_utils_get_monotonic_timestamp_nsec (); priv = NM_NDISC_GET_PRIVATE (ndisc); rdata = &priv->rdata; @@ -1068,7 +1061,7 @@ _config_changed_log (NMNDisc *ndisc, NMNDiscConfigMap changed) inet_ntop (AF_INET6, &route->network, addrstr, sizeof (addrstr)); _LOGD (" route %s/%u via %s pref %s exp %s", addrstr, (guint) route->plen, - nm_utils_inet6_ntop (&route->gateway, sbuf), + _nm_utils_inet6_ntop (&route->gateway, sbuf), nm_icmpv6_router_pref_to_string (route->preference, str_pref, sizeof (str_pref)), get_exp (str_exp, now_ns, route)); } @@ -1245,7 +1238,7 @@ timeout_cb (gpointer user_data) NMNDisc *self = user_data; NM_NDISC_GET_PRIVATE (self)->timeout_id = 0; - check_timestamps (self, nm_utils_get_monotonic_timestamp_s (), 0); + check_timestamps (self, nm_utils_get_monotonic_timestamp_sec (), 0); return G_SOURCE_REMOVE; } @@ -1256,7 +1249,7 @@ nm_ndisc_ra_received (NMNDisc *ndisc, gint32 now, NMNDiscConfigMap changed) nm_clear_g_source (&priv->ra_timeout_id); nm_clear_g_source (&priv->send_rs_id); - g_clear_pointer (&priv->last_error, g_free); + nm_clear_g_free (&priv->last_error); check_timestamps (ndisc, now, changed); } @@ -1265,7 +1258,7 @@ nm_ndisc_rs_received (NMNDisc *ndisc) { NMNDiscPrivate *priv = NM_NDISC_GET_PRIVATE (ndisc); - g_clear_pointer (&priv->last_error, g_free); + nm_clear_g_free (&priv->last_error); announce_router_solicited (ndisc); } @@ -1370,7 +1363,7 @@ nm_ndisc_init (NMNDisc *ndisc) priv->rdata.public.hop_limit = 64; /* Start at very low number so that last_rs - router_solicitation_interval - * is much lower than nm_utils_get_monotonic_timestamp_s() at startup. + * is much lower than nm_utils_get_monotonic_timestamp_sec() at startup. */ priv->last_rs = G_MININT32; } @@ -1384,7 +1377,7 @@ dispose (GObject *object) nm_clear_g_source (&priv->ra_timeout_id); nm_clear_g_source (&priv->send_rs_id); nm_clear_g_source (&priv->send_ra_id); - g_clear_pointer (&priv->last_error, g_free); + nm_clear_g_free (&priv->last_error); nm_clear_g_source (&priv->timeout_id); diff --git a/src/ndisc/tests/meson.build b/src/ndisc/tests/meson.build index c81e24ad..349eebba 100644 --- a/src/ndisc/tests/meson.build +++ b/src/ndisc/tests/meson.build @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1+ + test_unit = 'test-ndisc-fake' exe = executable( diff --git a/src/ndisc/tests/test-ndisc-fake.c b/src/ndisc/tests/test-ndisc-fake.c index 8bdc053d..7a5eea01 100644 --- a/src/ndisc/tests/test-ndisc-fake.c +++ b/src/ndisc/tests/test-ndisc-fake.c @@ -157,7 +157,7 @@ static void test_simple (void) { NMFakeNDisc *ndisc = ndisc_new (); - guint32 now = nm_utils_get_monotonic_timestamp_s (); + guint32 now = nm_utils_get_monotonic_timestamp_sec (); TestData data = { g_main_loop_new (NULL, FALSE), 0, 0, now }; guint id; @@ -217,9 +217,8 @@ test_everything_changed (NMNDisc *ndisc, const NMNDiscData *rdata, guint changed g_assert_cmpint (rdata->gateways_n, ==, 1); match_gateway (rdata, 0, "fe80::2", data->timestamp1, 10, NM_ICMPV6_ROUTER_PREF_MEDIUM); - g_assert_cmpint (rdata->addresses_n, ==, 2); - match_address (rdata, 0, "2001:db8:a:a::1", data->timestamp1, 10, 0); - match_address (rdata, 1, "2001:db8:a:b::1", data->timestamp1, 10, 10); + g_assert_cmpint (rdata->addresses_n, ==, 1); + match_address (rdata, 0, "2001:db8:a:b::1", data->timestamp1, 10, 10); g_assert_cmpint (rdata->routes_n, ==, 1); match_route (rdata, 0, "2001:db8:a:b::", 64, "fe80::2", data->timestamp1, 10, 10); g_assert_cmpint (rdata->dns_servers_n, ==, 1); @@ -239,7 +238,7 @@ static void test_everything (void) { NMFakeNDisc *ndisc = ndisc_new (); - guint32 now = nm_utils_get_monotonic_timestamp_s (); + guint32 now = nm_utils_get_monotonic_timestamp_sec (); TestData data = { g_main_loop_new (NULL, FALSE), 0, 0, now }; guint id; @@ -313,7 +312,7 @@ static void test_preference_order (void) { NMFakeNDisc *ndisc = ndisc_new (); - guint32 now = nm_utils_get_monotonic_timestamp_s (); + guint32 now = nm_utils_get_monotonic_timestamp_sec (); TestData data = { g_main_loop_new (NULL, FALSE), 0, 0, now }; guint id; @@ -386,7 +385,7 @@ static void test_preference_changed (void) { NMFakeNDisc *ndisc = ndisc_new (); - guint32 now = nm_utils_get_monotonic_timestamp_s (); + guint32 now = nm_utils_get_monotonic_timestamp_sec (); TestData data = { g_main_loop_new (NULL, FALSE), 0, 0, now }; guint id; @@ -440,7 +439,7 @@ success_timeout (TestData *data) static void test_dns_solicit_loop_rs_sent (NMFakeNDisc *ndisc, TestData *data) { - guint32 now = nm_utils_get_monotonic_timestamp_s (); + guint32 now = nm_utils_get_monotonic_timestamp_sec (); guint id; if (data->rs_counter > 0 && data->rs_counter < 6) { @@ -472,7 +471,7 @@ static void test_dns_solicit_loop (void) { NMFakeNDisc *ndisc = ndisc_new (); - guint32 now = nm_utils_get_monotonic_timestamp_s (); + guint32 now = nm_utils_get_monotonic_timestamp_sec (); TestData data = { g_main_loop_new (NULL, FALSE), 0, 0, now, 0 }; guint id; |