Hi
The following findings and statements are mostly based on observation
and I'm not an IP guru, so take the following with a grain of salt.
Having, among others, IPv6 and LWIP_ND6_ALLOW_RA_UPDATES enabled, an
"IPv6 router advertisement" that specifies an MTU causes LWIP to update
its internal MTU size to the advertised one. Therefore, any forthcoming
packet will be treated by this new MTU. The problem with this (IMO) is
that this mistakenly not only happens for IPv6 packets but also for
forthcoming IPv4 packets.
IMHO, the MTUs for both versions of IP should be treated separately, at
least this is what my Ubuntu 16.04/64bit seems to do: It uses 1500 Bytes
MTU for IPv4 (as reported by 'ifconfig') and uses 1480, as advertised by
our router (reported by 'traceroute6
xxx:xxx:xxxx::0204:3dff:fe00:2864'). Moreover, Wireshark actually
doubles that, as the IPv4 packets sent from Linux to the LWIP embedded
device use up to 1500 payload, where as the responses from the LWIP
embedded device occupy at most 1480 Bytes.
As for now, I've patched my (not 100% up to date) version of LWIP with
the attached patch, whereas both MTU's are initially set to 1500.
What do you think? Have I found a bug and shall I open a bug report or
am I wrong?
Thanks,
Raphael
Index: os/lwip/src/core/ipv6/nd6.c
===================================================================
--- os/lwip/src/core/ipv6/nd6.c (revision 8271)
+++ os/lwip/src/core/ipv6/nd6.c (working copy)
@@ -462,7 +462,7 @@
mtu_opt = (struct mtu_option *)buffer;
if (htonl(mtu_opt->mtu) >= 1280) {
#if LWIP_ND6_ALLOW_RA_UPDATES
- inp->mtu = (u16_t)htonl(mtu_opt->mtu);
+ inp->mtu_ipv6 = (u16_t)htonl(mtu_opt->mtu);
#endif /* LWIP_ND6_ALLOW_RA_UPDATES */
}
break;
@@ -1523,7 +1523,7 @@
if (ip6_addr_islinklocal(ip6addr) ||
nd6_is_prefix_in_netif(ip6addr, netif)) {
/* Destination in local link. */
- destination_cache[nd6_cached_destination_index].pmtu = netif->mtu;
+ destination_cache[nd6_cached_destination_index].pmtu = netif->mtu_ipv6;
ip6_addr_copy(destination_cache[nd6_cached_destination_index].next_hop_addr, destination_cache[nd6_cached_destination_index].destination_addr);
} else {
/* We need to select a router. */
@@ -1788,7 +1788,7 @@
}
if (netif != NULL) {
- return netif->mtu;
+ return netif->mtu_ipv6;
}
return 1280; /* Minimum MTU */
Index: os/lwip/src/include/lwip/netif.h
===================================================================
--- os/lwip/src/include/lwip/netif.h (revision 8271)
+++ os/lwip/src/include/lwip/netif.h (working copy)
@@ -261,6 +261,7 @@
#endif /* LWIP_CHECKSUM_CTRL_PER_NETIF*/
/** maximum transfer unit (in bytes) */
u16_t mtu;
+ u16_t mtu_ipv6;
/** number of bytes used in hwaddr */
u8_t hwaddr_len;
/** link level hardware address of this interface */
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users