Bug 2254 - Ipv[4,6]RawSocket can return the wrong number of bytes sent.

This commit is contained in:
Tommaso Pecorella
2016-01-09 15:27:52 +01:00
parent 75c3876132
commit 5fcbe1f353
3 changed files with 6 additions and 3 deletions

View File

@@ -77,6 +77,7 @@ Bugs fixed
- Bug 2242 - Mobility of both sender PHY and receiver PHY set to sender mobility in lr-wpan-phy-test.cc example.
- Bug 2243 - TCP Socket Fork() fails to copy some parameters, causing connections to close prematurely on retransmit
- Bug 2246 - Some DSR LogComponents and classes are not defined in a unique way.
- Bug 2254 - Ipv[4,6]RawSocket can return the wrong number of bytes sent.
Known issues
------------

View File

@@ -237,6 +237,7 @@ Ipv4RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags,
if (route != 0)
{
NS_LOG_LOGIC ("Route exists");
uint32_t pktSize = p->GetSize ();
if (!m_iphdrincl)
{
ipv4->Send (p, route->GetSource (), dst, m_protocol, route);
@@ -245,9 +246,9 @@ Ipv4RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags,
{
ipv4->SendWithHeader (p, header, route);
}
NotifyDataSent (p->GetSize ());
NotifyDataSent (pktSize);
NotifySend (GetTxAvailable ());
return p->GetSize ();
return pktSize;
}
else
{

View File

@@ -245,6 +245,7 @@ int Ipv6RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address& toA
}
}
uint32_t pktSize = p->GetSize ();
if (m_src.IsAny ())
{
ipv6->Send (p, route->GetSource (), dst, m_protocol, route);
@@ -254,7 +255,7 @@ int Ipv6RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags, const Address& toA
ipv6->Send (p, m_src, dst, m_protocol, route);
}
// Return only payload size (as Linux does).
return p->GetSize () - hdr.GetSerializedSize ();
return pktSize - hdr.GetSerializedSize ();
}
else
{