gnrc_netif: remove filter parameter from _match_to_idx()
`_match_to_idx()` was removed from source address selection (which was the only one setting the filter parameter to a non-NULL value), so it is the parameter is not needed anymore.
This commit is contained in:
parent
e787f6b60d
commit
e9d75f5655
@ -474,7 +474,6 @@ void gnrc_netif_release(gnrc_netif_t *netif)
|
||||
}
|
||||
|
||||
#ifdef MODULE_GNRC_IPV6
|
||||
static inline bool _addr_anycast(const gnrc_netif_t *netif, unsigned idx);
|
||||
static int _addr_idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr);
|
||||
static int _group_idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr);
|
||||
|
||||
@ -501,9 +500,6 @@ static unsigned _match_to_len(const gnrc_netif_t *netif,
|
||||
*
|
||||
* @param[in] netif the network interface
|
||||
* @param[in] addr the address to match
|
||||
* @param[in] filter a bitfield with the bits at the position equal to the
|
||||
* indexes of the addresses you want to include in the
|
||||
* search set to one. NULL for all addresses
|
||||
*
|
||||
* @return index of the best match for @p addr
|
||||
* @return -1 if no match was found
|
||||
@ -511,8 +507,7 @@ static unsigned _match_to_len(const gnrc_netif_t *netif,
|
||||
* @pre `netif != NULL` and `addr != NULL`
|
||||
*/
|
||||
static int _match_to_idx(const gnrc_netif_t *netif,
|
||||
const ipv6_addr_t *addr,
|
||||
const uint8_t *filter);
|
||||
const ipv6_addr_t *addr);
|
||||
/**
|
||||
* @brief Determines the scope of the given address.
|
||||
*
|
||||
@ -700,7 +695,7 @@ int gnrc_netif_ipv6_addr_match(gnrc_netif_t *netif,
|
||||
{
|
||||
assert((netif != NULL) && (addr != NULL));
|
||||
gnrc_netif_acquire(netif);
|
||||
int idx = _match_to_idx(netif, addr, NULL);
|
||||
int idx = _match_to_idx(netif, addr);
|
||||
gnrc_netif_release(netif);
|
||||
return idx;
|
||||
}
|
||||
@ -818,11 +813,6 @@ int gnrc_netif_ipv6_group_idx(gnrc_netif_t *netif, const ipv6_addr_t *addr)
|
||||
return idx;
|
||||
}
|
||||
|
||||
static inline bool _addr_anycast(const gnrc_netif_t *netif, unsigned idx)
|
||||
{
|
||||
return (netif->ipv6.addrs_flags[idx] & GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST);
|
||||
}
|
||||
|
||||
static int _idx(const gnrc_netif_t *netif, const ipv6_addr_t *addr, bool mcast)
|
||||
{
|
||||
if (!ipv6_addr_is_unspecified(addr)) {
|
||||
@ -852,13 +842,12 @@ static unsigned _match_to_len(const gnrc_netif_t *netif,
|
||||
{
|
||||
assert((netif != NULL) && (addr != NULL));
|
||||
|
||||
int n = _match_to_idx(netif, addr, NULL);
|
||||
int n = _match_to_idx(netif, addr);
|
||||
return (n >= 0) ? ipv6_addr_match_prefix(&(netif->ipv6.addrs[n]), addr) : 0;
|
||||
}
|
||||
|
||||
static int _match_to_idx(const gnrc_netif_t *netif,
|
||||
const ipv6_addr_t *addr,
|
||||
const uint8_t *filter)
|
||||
const ipv6_addr_t *addr)
|
||||
{
|
||||
assert((netif != NULL) && (addr != NULL));
|
||||
|
||||
@ -867,10 +856,7 @@ static int _match_to_idx(const gnrc_netif_t *netif,
|
||||
for (int i = 0; i < GNRC_NETIF_IPV6_ADDRS_NUMOF; i++) {
|
||||
unsigned match;
|
||||
|
||||
if ((netif->ipv6.addrs_flags[i] == 0) ||
|
||||
((filter != NULL) && _addr_anycast(netif, i)) ||
|
||||
/* discard const intentionally */
|
||||
((filter != NULL) && !(bf_isset((uint8_t *)filter, i)))) {
|
||||
if (netif->ipv6.addrs_flags[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
match = ipv6_addr_match_prefix(&(netif->ipv6.addrs[i]), addr);
|
||||
@ -884,17 +870,15 @@ static int _match_to_idx(const gnrc_netif_t *netif,
|
||||
ipv6_addr_to_str(addr_str, &netif->ipv6.addrs[idx],
|
||||
sizeof(addr_str)),
|
||||
netif->pid);
|
||||
DEBUG("%s by %u bits (used as source address = %s)\n",
|
||||
DEBUG("%s by %u bits\n",
|
||||
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
|
||||
best_match,
|
||||
(filter != NULL) ? "true" : "false");
|
||||
best_match);
|
||||
}
|
||||
else {
|
||||
DEBUG("gnrc_netif: Did not found any address on interface %" PRIkernel_pid
|
||||
" matching %s (used as source address = %s)\n",
|
||||
" matching %s\n",
|
||||
netif->pid,
|
||||
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)),
|
||||
(filter != NULL) ? "true" : "false");
|
||||
ipv6_addr_to_str(addr_str, addr, sizeof(addr_str)));
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user