Skip to content

Commit

Permalink
NEW API for do address decrecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiskanen committed Apr 18, 2019
1 parent 7864962 commit d03187e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/Core/include/ns_address_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ void addr_fast_timer(struct protocol_interface_info_entry *cur, uint_fast16_t ti
void addr_slow_timer(struct protocol_interface_info_entry *cur, uint_fast16_t seconds);
struct if_address_entry *addr_add(struct protocol_interface_info_entry *cur, const uint8_t address[__static 16], uint_fast8_t prefix_len, if_address_source_t source, uint32_t valid_lifetime, uint32_t preferred_lifetime, bool skip_dad);
int_fast8_t addr_delete(struct protocol_interface_info_entry *cur, const uint8_t address[__static 16]);
int_fast8_t addr_deprecate(struct protocol_interface_info_entry *cur, const uint8_t address[static 16]);
void addr_delete_matching(struct protocol_interface_info_entry *cur, const uint8_t *prefix, uint8_t prefix_len, if_address_source_t source);
void addr_delete_entry(struct protocol_interface_info_entry *cur, if_address_entry_t *addr);
void addr_set_non_preferred(struct protocol_interface_info_entry *cur, if_address_source_t source);
Expand Down
13 changes: 13 additions & 0 deletions source/Core/ns_address_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,19 @@ int_fast8_t addr_delete(protocol_interface_info_entry_t *cur, const uint8_t addr
return -1;
}

int_fast8_t addr_deprecate(protocol_interface_info_entry_t *cur, const uint8_t address[static 16])
{
ns_list_foreach(if_address_entry_t, e, &cur->ip_addresses) {
if (memcmp(e->address, address, 16) == 0) {
tr_debug("Deprecate address %s", trace_ipv6(e->address));
addr_lifetime_update(cur, e, 0, 0, 30 * 60); //Accept max 30 min lifetime
return 0;
}
}

return -1;
}

void addr_delete_matching(protocol_interface_info_entry_t *cur, const uint8_t *prefix, uint8_t prefix_len, if_address_source_t source)
{
ns_list_foreach_safe(if_address_entry_t, e, &cur->ip_addresses) {
Expand Down
5 changes: 5 additions & 0 deletions test/nanostack/unittest/stub/address_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ int_fast8_t addr_delete(protocol_interface_info_entry_t *cur, const uint8_t addr
return address_stub.int8_value;
}

int_fast8_t addr_deprecate(protocol_interface_info_entry_t *cur, const uint8_t address[static 16])
{
return address_stub.int8_value;
}

void addr_delete_matching(protocol_interface_info_entry_t *cur, const uint8_t *prefix, uint8_t prefix_len, if_address_source_t source)
{
}
Expand Down

0 comments on commit d03187e

Please sign in to comment.