[riot-notifications] [RIOT-OS/RIOT] gnrc_tcp-change and verfy addrs in use (#10963)

Martine Lenders notifications at github.com
Thu Feb 7 10:28:06 CET 2019


miri64 commented on this pull request.



>  
 int main(void)
 {
+    gnrc_netif_t *netif;
+
+    if (!(netif = gnrc_netif_iter(NULL))) {
+        printf("No valid network interface found\n");
+        return -1;
+    }
+
+    /* Set pre-configured IP address */
+    char if_pid[] = {netif->pid + '0', '\0'};
+    char *cmd[] = {"ifconfig", if_pid, "add", "unicast", LOCAL_ADDR};
+    _gnrc_netif_config(5, cmd);

I know you did this already in the server application, but why are you using the shell command for this? [Here's a nice function](http://doc.riot-os.org/group__net__gnrc__netif.html#gaf96707a5e322b5fa8458fba45de01837) that does exactly the same but much leaner without any string conversions.

> @@ -72,6 +78,25 @@ int main(void)
     return 0;
 }
 
+bool verify_ip_addr(gnrc_netif_t *netif)

Yes this has nothing to do with this and IMHO this function is unnecessary. When I said make sure it is valid I meant when you add it by setting the appropriate flags, not actually checking the validity with a function.

> @@ -54,6 +76,25 @@ int main(void)
     return 0;
 }
 
+bool verify_ip_addr(gnrc_netif_t *netif)
+{
+    ipv6_addr_t must_match;
+
+    if (!ipv6_addr_from_str(&must_match, LOCAL_ADDR)) {
+        return false;
+    }
+
+    for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; ++i) {
+        bool ip_match = ipv6_addr_equal(&must_match, &(netif->ipv6.addrs[i]));

Yepp, this has nothing to do with forwarding decisions here.

> Without looking into the code I guess you need a next-hop entry in the NIB. @miri64?!

Yes

-- 
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/10963#pullrequestreview-200984133
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190207/b1b9a141/attachment.html>


More information about the notifications mailing list