Skip to content

Commit

Permalink
refactor: Make called function inline
Browse files Browse the repository at this point in the history
  • Loading branch information
xnumad committed Feb 22, 2024
1 parent ccdd462 commit 8da5196
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 9 additions & 5 deletions sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include <kernel_defines.h>
#include <stdbool.h>
#if IS_ACTIVE(CONFIG_GNRC_IPV6_STABLE_PRIVACY)
#include "_nib-slaac.h"
#if IS_ACTIVE(CONFIG_GNRC_IPV6_STABLE_PRIVACY)
#include <hashes/sha256.h>
#include "ztimer.h"
#include "random.h"
Expand All @@ -36,19 +36,23 @@
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_6LN) || IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_SLAAC)
static char addr_str[IPV6_ADDR_MAX_STR_LEN];

#if !IS_ACTIVE(CONFIG_GNRC_IPV6_STABLE_PRIVACY)
void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
uint8_t pfx_len)
#else
inline void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
uint8_t pfx_len)
{
#if !IS_ACTIVE(CONFIG_GNRC_IPV6_STABLE_PRIVACY)
_auto_configure_addr_default(netif, pfx, pfx_len);
#else
_auto_configure_addr_with_dad_ctr(netif, pfx, pfx_len, 0);
#endif
}

#if IS_ACTIVE(CONFIG_GNRC_IPV6_STABLE_PRIVACY)
void _auto_configure_addr_with_dad_ctr(gnrc_netif_t *netif,
const ipv6_addr_t *pfx, uint8_t pfx_len,
uint8_t dad_ctr)
#else
void _auto_configure_addr_default(gnrc_netif_t *netif,
const ipv6_addr_t *pfx, uint8_t pfx_len)
#endif
{
ipv6_addr_t addr = IPV6_ADDR_UNSPECIFIED;
Expand Down
6 changes: 5 additions & 1 deletion sys/net/gnrc/network_layer/ipv6/nib/_nib-slaac.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,17 @@ extern "C" {
*/
void _auto_configure_addr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
uint8_t pfx_len);
#if IS_ACTIVE(CONFIG_GNRC_IPV6_STABLE_PRIVACY) || defined(DOXYGEN)

#if IS_ACTIVE(CONFIG_GNRC_IPV6_STABLE_PRIVACY)
/**
* @brief Overload of @ref _auto_configure_addr
* @param dad_ctr rfc7217 DAD_Counter
*/
void _auto_configure_addr_with_dad_ctr(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
uint8_t pfx_len, uint8_t dad_ctr);
#else
void _auto_configure_addr_default(gnrc_netif_t *netif, const ipv6_addr_t *pfx,
uint8_t pfx_len);
#endif

#else /* CONFIG_GNRC_IPV6_NIB_6LN || CONFIG_GNRC_IPV6_NIB_SLAAC */
Expand Down

0 comments on commit 8da5196

Please sign in to comment.