net/lwip: handle without SLLA option in RA.
This commit added exception in RA handling routine.
In case of received RA message,
- Without SLLA option.
- but, src address is already in neighbor cache entry.
, RA handler should set isrouter flag to TRUE.
@@ -765,11 +765,10 @@ void nd6_input(struct pbuf *p, struct netif *inp)
struct nd6_neighbor_cache_entry *nce_update = NULL;
- if (nce_flag) {
s8_t j;
j = nd6_find_neighbor_cache_entry(ip6_current_src_addr());
- if (j < 0) {
+ if (nce_flag && j < 0) {
j = nd6_new_neighbor_cache_entry();
if (j < 0) {
pbuf_free(p);
@@ -782,7 +781,9 @@ void nd6_input(struct pbuf *p, struct netif *inp)
neighbor_cache[j].netif = inp;
neighbor_cache[j].q = NULL;
neighbor_cache[j].state = ND6_STALE;
- } else {
+ neighbor_cache[j].isrouter = 1;
+ nce_update = &(neighbor_cache[j]);
+ } else if (nce_flag && j >= 0) {
if (neighbor_cache[j].state == ND6_INCOMPLETE) {
neighbor_cache[j].state = ND6_STALE;
}
@@ -791,9 +792,11 @@ void nd6_input(struct pbuf *p, struct netif *inp)
SMEMCPY(neighbor_cache[j].lladdr, ND6H_LLADDR_OPT_ADDR(lladdr_opt), inp->hwaddr_len);
neighbor_cache[j].state = ND6_STALE;
}
- }
neighbor_cache[j].isrouter = 1;
nce_update = &(neighbor_cache[j]);
+ } else if (j >= 0) {
+ neighbor_cache[j].isrouter = 1;
+ /* TODO: Should change neighbor_cache state? */
}
/* Re-set default timer values. */
@@ -859,8 +862,8 @@ void nd6_input(struct pbuf *p, struct netif *inp)
/* RFC 4861, 6.3.5. Timing out Prefixes and Default Routers */
if (default_router_list[i].neighbor_entry) {
default_router_list[i].neighbor_entry->isrouter = 0;
- default_router_list[i].neighbor_entry = NULL;
nd6_free_expired_router_in_destination_cache(&(default_router_list[i].neighbor_entry->next_hop_address));
+ default_router_list[i].neighbor_entry = NULL;
}
default_router_list[i].invalidation_timer = 0;
default_router_list[i].flags = 0;
