mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #928 from authmillenon/ndp-nce-remove
Make neighbor cache remove function public
This commit is contained in:
commit
951cc0cdc2
@ -145,6 +145,17 @@ uint8_t ndp_neighbor_cache_add(int if_id, const ipv6_addr_t *ipaddr,
|
||||
const void *lladdr, uint8_t lladdr_len,
|
||||
uint8_t isrouter, ndp_nce_state_t state,
|
||||
ndp_nce_type_t type, uint16_t ltime);
|
||||
|
||||
/**
|
||||
* @brief Removes an address from the neighbor cache by IPv6 address.
|
||||
*
|
||||
* @param[in] ipaddr IPv6 address to remove, leave NULL if you only want
|
||||
* to remove by Link-layer address.
|
||||
*
|
||||
* @return 1 on success, 0 otherwise.
|
||||
*/
|
||||
uint8_t ndp_neighbor_cache_remove(const ipv6_addr_t *ipaddr);
|
||||
|
||||
ndp_neighbor_cache_t *ndp_neighbor_cache_search(ipv6_addr_t *ipaddr);
|
||||
ndp_neighbor_cache_t *ndp_get_ll_address(ipv6_addr_t *ipaddr);
|
||||
int ndp_addr_is_on_link(ipv6_addr_t *dest_addr);
|
||||
|
@ -145,7 +145,6 @@ uint8_t recvd_pref_len = 0;
|
||||
|
||||
void def_rtr_lst_add(ipv6_addr_t *ipaddr, uint32_t rtr_ltime);
|
||||
void def_rtr_lst_rem(ndp_default_router_list_t *entry);
|
||||
void nbr_cache_rem(ipv6_addr_t *addr);
|
||||
|
||||
/**
|
||||
* @brief Set Source link-layer address option according to interface
|
||||
@ -1127,7 +1126,7 @@ void recv_nbr_sol(void)
|
||||
/* update neighbor cache entry */
|
||||
if (opt_aro_buf->reg_ltime == 0) {
|
||||
/* delete neighbor cache entry */
|
||||
nbr_cache_rem(&nbr_entry->addr);
|
||||
ndp_neighbor_cache_remove(&nbr_entry->addr);
|
||||
}
|
||||
else {
|
||||
set_remaining_time(&(nbr_entry->ltime), (uint32_t)opt_aro_buf->reg_ltime);
|
||||
@ -1587,18 +1586,22 @@ void nbr_cache_auto_rem(void)
|
||||
}
|
||||
}
|
||||
|
||||
void nbr_cache_rem(ipv6_addr_t *addr)
|
||||
uint8_t ndp_neighbor_cache_remove(const ipv6_addr_t *ipaddr)
|
||||
{
|
||||
int i;
|
||||
uint8_t removed = 0;
|
||||
|
||||
for (i = 0; i < NBR_CACHE_SIZE; i++) {
|
||||
if (memcmp(&(nbr_cache[i].addr.uint8[0]), &(addr->uint8[0]), 16) == 0) {
|
||||
if (memcmp(&(nbr_cache[i].addr.uint8[0]), &(ipaddr->uint8[0]), 16) == 0) {
|
||||
memmove(&(nbr_cache[i]), &(nbr_cache[nbr_count]),
|
||||
sizeof(ndp_neighbor_cache_t));
|
||||
memset(&(nbr_cache[nbr_count]), 0, sizeof(ndp_neighbor_cache_t));
|
||||
nbr_count--;
|
||||
removed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user