[riot-notifications] [RIOT-OS/RIOT] sys/net/dhcpv6: Add IA_NA support to the DHCPv6 client (#16228)

Jan Romann notifications at github.com
Tue Aug 10 21:46:37 CEST 2021


@JKRhb commented on this pull request.



> +    return extract_global_address(child), extract_global_address(child)
+
+
+def check_ia_na_addr(ia_na_addr):
+    """Check if the expected IA_NA address has been assigned"""
+    return IPv6Address(ia_na_addr) in IPv6Network("{}/64".format(IA_NA_ADDRESS_POOL_PREFIX))
+
+
+def check_ia_pd_addr(ia_pd_addr, global_pfx):
+    """Check if the expected IA_PD address has been assigned"""
+    return ia_pd_addr.startswith(global_pfx)
+
+
+def check_global_addrs(ia_na_addr, ia_pd_addr, global_pfx):
+    """Perform IA_NA check for the first and IA_PD for the second address"""
+    return check_ia_na_addr(ia_na_addr) and check_ia_pd_addr(ia_pd_addr, global_pfx)

You are right, this is actually a blank spot. While your suggestion certainly works, maybe returning a dictionary instead could be a bit easier to read? I think this should also provide a better error message if the assertion fails.

```suggestion
    return {
        "ia_na_check": check_ia_na_addr(ia_na_addr), 
        "ia_pd_check": check_ia_pd_addr(ia_pd_addr, global_pfx),        
    }
```

-- 
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/16228#discussion_r686272682
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210810/dec1dc75/attachment.htm>


More information about the notifications mailing list