[riot-notifications] [RIOT-OS/RIOT] net/gnrc/ipv6: move gnrc_util_conf_prefix() to common code (#16672)

Martine Lenders notifications at github.com
Fri Jul 23 15:49:39 CEST 2021


@miri64 requested changes on this pull request.



> +
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief   Configures a prefix delegation lease that is provided by the server.
+ *
+ * @param[in] netif     Network interface the prefix delegation was for.
+ * @param[in] pfx       Prefix for the prefix delegation.
+ * @param[in] pfx_len   Length of @p pfx in bits.
+ * @param[in] valid     Valid lifetime of the prefix delegation.
+ * @param[in] pref      Preferred lifetime of the prefix delegation.
+ * @param[in] tentative Add new prefix as tentative.
+ */
+void gnrc_util_conf_prefix(gnrc_netif_t *netif, const ipv6_addr_t *pfx,

This might surprise you, but why not move it to `gnrc_netif_conf_prefix()` in `net/gnrc/netif/internal.h` or maybe `net/gnrc/netif/helper.h`? Since in this case this is all about interface configuration (setting a prefix in the NIB for an interface, setting an address for that prefix on an interface, ...), I think in this case it fits there.

> + *
+ * @author  Martine Lenders <m.lenders at fu-berlin.de>
+ */
+#ifndef NET_GNRC_IPV6_UTIL_H
+#define NET_GNRC_IPV6_UTIL_H
+
+#include "net/ipv6/addr.h"
+#include "net/gnrc/netif.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief   Configures a prefix delegation lease that is provided by the server.
+ *

Please add some details on what this does entail. From a user perspective: there is already `gnrc_ipv6_nib_pl_add()` so, why is this better / more feature-some?

> + * @brief   GNRC IPv6 utility functions
+ *
+ * @author  Martine Lenders <m.lenders at fu-berlin.de>
+ */
+#ifndef NET_GNRC_IPV6_UTIL_H
+#define NET_GNRC_IPV6_UTIL_H
+
+#include "net/ipv6/addr.h"
+#include "net/gnrc/netif.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief   Configures a prefix delegation lease that is provided by the server.

Prefix delegation is a DHCPv6 thing, I don't see any DHCPv6-stuff in the code, so this wording might be confusing.

> +#include "net/gnrc/netif/internal.h"
+
+#define ENABLE_DEBUG 0
+#include "debug.h"
+
+static char addr_str[IPV6_ADDR_MAX_STR_LEN];
+
+static bool _ctx_match(const gnrc_sixlowpan_ctx_t *ctx,
+                       const ipv6_addr_t *prefix, uint8_t prefix_len)
+{
+    return (ctx != NULL) &&
+           (ctx->prefix_len == prefix_len) &&
+           (ipv6_addr_match_prefix(&ctx->prefix, prefix) >= prefix_len);
+}
+
+static void _update_6ctx(const ipv6_addr_t *prefix, uint8_t prefix_len,

OK, then this should be documented...

-- 
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/16672#pullrequestreview-713744197
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210723/1941949b/attachment.htm>


More information about the notifications mailing list