Bug 1807 - Multiple bugs in Ipv4L3Protocol::LocalDeliver
authorTommaso Pecorella <tommaso.pecorella@unifi.it>
Mon, 02 Dec 2013 19:36:49 +0100
changeset 10457 299e2483e596
parent 10456 e4bc52ceab4d
child 10458 20987b07dbd4
Bug 1807 - Multiple bugs in Ipv4L3Protocol::LocalDeliver
RELEASE_NOTES
src/internet/model/ipv4-l3-protocol.cc
--- a/RELEASE_NOTES	Sat Nov 30 12:38:22 2013 +0100
+++ b/RELEASE_NOTES	Mon Dec 02 19:36:49 2013 +0100
@@ -28,6 +28,7 @@
 - Bug 1777 - Implement the more direct way of "using" configuration of existing tap interface
 - Bug 1776 - Improve CRC performance for CsmaNetDevice in emulation modes
 - Bug 1798 - Changing the rate of onOffApplication might stop transmission
+- Bug 1807 - Multiple bugs in Ipv4L3Protocol::LocalDeliver
 
 Release 3.18.1
 ==============
--- a/src/internet/model/ipv4-l3-protocol.cc	Sat Nov 30 12:38:22 2013 +0100
+++ b/src/internet/model/ipv4-l3-protocol.cc	Mon Dec 02 19:36:49 2013 +0100
@@ -890,18 +890,19 @@
           return;
         }
       NS_LOG_LOGIC ("Got last fragment, Packet is complete " << *p );
+      ipHeader.SetFragmentOffset (0);
     }
 
-  m_localDeliverTrace (ip, packet, iif);
+  m_localDeliverTrace (ipHeader, p, iif);
 
-  Ptr<IpL4Protocol> protocol = GetProtocol (ip.GetProtocol ());
+  Ptr<IpL4Protocol> protocol = GetProtocol (ipHeader.GetProtocol ());
   if (protocol != 0)
     {
       // we need to make a copy in the unlikely event we hit the
       // RX_ENDPOINT_UNREACH codepath
       Ptr<Packet> copy = p->Copy ();
       enum IpL4Protocol::RxStatus status = 
-        protocol->Receive (p, ip, GetInterface (iif));
+        protocol->Receive (p, ipHeader, GetInterface (iif));
       switch (status) {
         case IpL4Protocol::RX_OK:
         // fall through
@@ -910,8 +911,8 @@
         case IpL4Protocol::RX_CSUM_FAILED:
           break;
         case IpL4Protocol::RX_ENDPOINT_UNREACH:
-          if (ip.GetDestination ().IsBroadcast () == true ||
-              ip.GetDestination ().IsMulticast () == true)
+          if (ipHeader.GetDestination ().IsBroadcast () == true ||
+              ipHeader.GetDestination ().IsMulticast () == true)
             {
               break; // Do not reply to broadcast or multicast
             }
@@ -920,15 +921,15 @@
           for (uint32_t i = 0; i < GetNAddresses (iif); i++)
             {
               Ipv4InterfaceAddress addr = GetAddress (iif, i);
-              if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination ().CombineMask (addr.GetMask ()) &&
-                  ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ()))
+              if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ipHeader.GetDestination ().CombineMask (addr.GetMask ()) &&
+                  ipHeader.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ()))
                 {
                   subnetDirected = true;
                 }
             }
           if (subnetDirected == false)
             {
-              GetIcmp ()->SendDestUnreachPort (ip, copy);
+              GetIcmp ()->SendDestUnreachPort (ipHeader, copy);
             }
         }
     }