net/lwip: modify PMTU update routine when receiving RA with MTU
This commit modifies the codes which updates PMTU in destination cache
when Router Advertisement with MTU is received. The modified routine
will try to update PMTU on all entries in destination cache.
@@ -650,13 +650,17 @@ void nd6_input(struct pbuf *p, struct netif *inp)
#if LWIP_ND6_ALLOW_RA_UPDATES
inp->mtu = (u16_t) lwip_htonl(ND6H_MTU_OPT_MTU(mtu_opt));
for (i = 0; i < LWIP_ND6_NUM_DESTINATIONS; i++) {
- if (ip6_addr_cmp(ip6_current_src_addr(), &(destination_cache[i].next_hop_addr))) {
+ if (! ip6_addr_isany(&(destination_cache[i].destination_addr))) {
struct timeval curtime;
TIME_GET(curtime);
+ if (TIME_INITIALIZED(destination_cache[i].pmtu_update_time) ||
+ (inp->mtu <= destination_cache[i].pmtu) ||
+ (TIME_DIFF_SEC(destination_cache[i].pmtu_update_time, curtime) >= (10 * 60) /* 10 minutes */)) {
destination_cache[i].pmtu = inp->mtu;
destination_cache[i].pmtu_update_time = curtime;
}
}
+ }
#endif /* LWIP_ND6_ALLOW_RA_UPDATES */
}
break;
