Bug 1810 - IP packets can be sent on NetDevices not respecting the minimum MTU requirements
--- a/RELEASE_NOTES Thu Dec 12 18:50:20 2013 +0100
+++ b/RELEASE_NOTES Thu Dec 12 19:36:16 2013 +0100
@@ -50,6 +50,7 @@
- Bug 1798 - Changing the rate of onOffApplication might stop transmission
- Bug 1802 - FlowMon header deserialization problem with IPv4 fragments
- Bug 1807 - Multiple bugs in Ipv4L3Protocol::LocalDeliver
+- Bug 1810 - IP packets can be sent on NetDevices not respecting the minimum MTU requirements
Release 3.18.1
==============
--- a/src/internet/model/ipv4-l3-protocol.cc Thu Dec 12 18:50:20 2013 +0100
+++ b/src/internet/model/ipv4-l3-protocol.cc Thu Dec 12 19:36:16 2013 +0100
@@ -1095,11 +1095,23 @@
{
NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
- interface->SetUp ();
+
+ // RFC 791, pg.25:
+ // Every internet module must be able to forward a datagram of 68
+ // octets without further fragmentation. This is because an internet
+ // header may be up to 60 octets, and the minimum fragment is 8 octets.
+ if (interface->GetDevice ()->GetMtu () >= 68)
+ {
+ interface->SetUp ();
- if (m_routingProtocol != 0)
+ if (m_routingProtocol != 0)
+ {
+ m_routingProtocol->NotifyInterfaceUp (i);
+ }
+ }
+ else
{
- m_routingProtocol->NotifyInterfaceUp (i);
+ NS_LOG_LOGIC ("Interface " << int(i) << " is set to be down for IPv4. Reason: not respecting minimum IPv4 MTU (68 octects)");
}
}
--- a/src/internet/model/ipv6-l3-protocol.cc Thu Dec 12 18:50:20 2013 +0100
+++ b/src/internet/model/ipv6-l3-protocol.cc Thu Dec 12 19:36:16 2013 +0100
@@ -486,11 +486,23 @@
NS_LOG_FUNCTION (this << i);
Ptr<Ipv6Interface> interface = GetInterface (i);
- interface->SetUp ();
+ // RFC 2460, Section 5, pg. 24:
+ // IPv6 requires that every link in the internet have an MTU of 1280
+ // octets or greater. On any link that cannot convey a 1280-octet
+ // packet in one piece, link-specific fragmentation and reassembly must
+ // be provided at a layer below IPv6.
+ if (interface->GetDevice ()->GetMtu () >= 1280)
+ {
+ interface->SetUp ();
- if (m_routingProtocol != 0)
+ if (m_routingProtocol != 0)
+ {
+ m_routingProtocol->NotifyInterfaceUp (i);
+ }
+ }
+ else
{
- m_routingProtocol->NotifyInterfaceUp (i);
+ NS_LOG_LOGIC ("Interface " << int(i) << " is set to be down for IPv6. Reason: not respecting minimum IPv6 MTU (1280 octects)");
}
}