[riot-notifications] [RIOT-OS/RIOT] gnrc/netif: add IPv6 event bus (#14022)

benpicco notifications at github.com
Wed May 13 15:41:52 CEST 2020


Try with `gnrc_netif_get_bus(&netifs[0], GNRC_NETIF_BUS_IPV6);` instead of `gnrc_netif_get_bus(gnrc_netif_iter(NULL), GNRC_NETIF_BUS_IPV6);`:

```patch
--- a/tests/gnrc_netif/Makefile
+++ b/tests/gnrc_netif/Makefile
@@ -3,6 +3,7 @@ include ../Makefile.tests_common
 USEMODULE += embunit
 USEMODULE += gnrc_netif
 USEMODULE += gnrc_pktdump
+USEMODULE += gnrc_netif_bus
 USEMODULE += gnrc_sixlowpan
 USEMODULE += gnrc_sixlowpan_iphc
 USEMODULE += gnrc_ipv6
diff --git a/tests/gnrc_netif/main.c b/tests/gnrc_netif/main.c
index 13f6cdffe3..a3ee2a15cb 100644
--- a/tests/gnrc_netif/main.c
+++ b/tests/gnrc_netif/main.c
@@ -251,6 +251,12 @@ static void test_ipv6_addr_add__success(void)
 {
     static const ipv6_addr_t addr = { .u8 = NETIF0_IPV6_LL };
     int idx;
+    msg_t m;
+    msg_bus_entry_t sub;
+    msg_bus_t *bus = gnrc_netif_get_bus(&netifs[0], GNRC_NETIF_BUS_IPV6);
+
+    msg_bus_attach(bus, &sub);
+    msg_bus_subscribe(&sub, GNRC_IPV6_EVENT_ADDR_VALID);
 
     TEST_ASSERT(0 <= (idx = gnrc_netif_ipv6_addr_add_internal(&netifs[0], &addr, 64U,
                                                      GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID)));
@@ -261,6 +267,9 @@ static void test_ipv6_addr_add__success(void)
     TEST_ASSERT_EQUAL_INT(GNRC_NETIF_IPV6_ADDRS_FLAGS_STATE_VALID,
                           netifs[0].ipv6.addrs_flags[idx]);
     TEST_ASSERT(ipv6_addr_equal(&addr, &netifs[0].ipv6.addrs[idx]));
+    TEST_ASSERT(xtimer_msg_receive_timeout(&m, 1000000) >= 0);
+    TEST_ASSERT(memcmp(&addr, m.content.ptr, sizeof(addr)) == 0);
+    msg_bus_detach(bus, &sub);
 }
 
 static void test_ipv6_addr_add__readd_with_free_entry(void)
```

-- 
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/14022#issuecomment-627994495
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200513/2278175d/attachment.htm>


More information about the notifications mailing list