[riot-notifications] [RIOT-OS/RIOT] gnrc/netif: add gnrc_netif_ipv6_wait_for_global_address() (#16824)

benpicco notifications at github.com
Thu Sep 16 17:16:14 CEST 2021


@benpicco commented on this pull request.



> +{
+    unsigned now;
+
+    TEST_ASSERT_EQUAL_INT(TEST_NETIF_NUMOF, gnrc_netif_numof());
+
+    /* no event when adding addr to other interface */
+    _add_delayed_addr(&netif_test[1]);
+    now = xtimer_now_usec();
+    TEST_ASSERT(!gnrc_netif_ipv6_wait_for_global_address(&netif_test[0], 20));
+    TEST_ASSERT(20 <= ((xtimer_now_usec() - now) / 1000));
+
+    /* event when adding addr to any interface */
+    now = xtimer_now_usec();
+    _add_delayed_addr(&netif_test[0]);
+    TEST_ASSERT(gnrc_netif_ipv6_wait_for_global_address(NULL, 20));
+    TEST_ASSERT(((xtimer_now_usec() - now) / 1000) < 20);

`_add_delayed_addr()` waits 10ms for adding the prefix, so it should be

    10 <= diff < 20

IMHO checking that we returned before the timeout expired should be enough though. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16824#discussion_r710218546
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210916/ebd5cf4b/attachment.htm>


More information about the notifications mailing list