diff options
| author | Dirk Ziegelmeier <[email protected]> | 2019-05-06 12:37:19 +0200 |
|---|---|---|
| committer | Dirk Ziegelmeier <[email protected]> | 2019-05-06 12:37:19 +0200 |
| commit | 0255106d553f0c46130168fafc1ec169debed053 (patch) | |
| tree | 9c33c0bd3590a3109c441c280bcee38d36ada4ee | |
| parent | ff17530997f45ddb86b0b18d8dd42046fc4689a2 (diff) | |
Fix bug #56136: The netif->mtu6 was updated by Router Advertisement abnomally
Using patch from Gao Quingahui plus improvement
| -rw-r--r-- | src/core/ipv6/nd6.c | 2 | ||||
| -rw-r--r-- | src/core/netif.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index 267ee671..9cafd483 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -701,7 +701,7 @@ nd6_input(struct pbuf *p, struct netif *inp) #if LWIP_ND6_ALLOW_RA_UPDATES if (inp->mtu) { /* don't set the mtu for IPv6 higher than the netif driver supports */ - inp->mtu6 = LWIP_MIN(inp->mtu, (u16_t)mtu32); + inp->mtu6 = LWIP_MIN(LWIP_MIN(inp->mtu, inp->mtu6), (u16_t)mtu32); } else { inp->mtu6 = (u16_t)mtu32; } diff --git a/src/core/netif.c b/src/core/netif.c index 5250c6b6..460258a5 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -1058,6 +1058,10 @@ netif_set_link_down(struct netif *netif) acd_network_changed_link_down(netif); #endif /* LWIP_ACD */ +#if LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES + netif->mtu6 = netif->mtu; +#endif + NETIF_LINK_CALLBACK(netif); #if LWIP_NETIF_EXT_STATUS_CALLBACK { |
