[riot-notifications] [RIOT-OS/RIOT] Add MUD URL option to DHCPv6 client (#15508)

benpicco notifications at github.com
Thu Nov 26 21:35:11 CET 2020


@benpicco commented on this pull request.



> @@ -707,6 +718,23 @@ static void _solicit_servers(event_t *event)
     msg_len += _compose_elapsed_time_opt(time);
     msg_len += _compose_oro_opt((dhcpv6_opt_oro_t *)&send_buf[msg_len], oro_opts,
                                 ARRAY_SIZE(oro_opts));
+
+    #ifdef MUD_URL
+    char mud_url[] = MUD_URL;
+    if (strlen(mud_url) <= 253 && strlen(mud_url) > 0) {

That should probably be a define. (`0xFF - sizeof(dhcpv6_opt_mud_url_t)`?)

Also, no need to check the length for being 0, rather add a config option to enable the MUD option.
The "RIOT way" to do this would probably be by introducing a pseudo-module `gnrc_dhcpv6_client_mud_url` (`makefiles/pseudomodules.inc.mk`), then you can check

```C
if (IS_USED(MODULE_GNRC_DHCPV6_CLIENT_MUD_URL)) {
    …
}
```

Also, since this string is set at compile-time and can't be changed, you might as well use an `assert()` here. This will crash the application, but since the string is not expected to change, we don't have to perform the check each time in release mode.

-- 
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/15508#discussion_r531216557
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201126/7ab36177/attachment-0001.htm>


More information about the notifications mailing list