bug 859 - Output interface estimation for the source address bound socket in IPv4 Raw socket

This commit is contained in:
Hajime Tazaki committed 2010-04-08 11:26:46 +09:00
1 parent 598520e474
commit 2eb560a9f7
2 files changed
+9

No files matched your search

@@ -178,6 +178,14 @@ Ipv4RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags,
SocketErrno errno_ = ERROR_NOTERROR;//do not use errno as it is the standard C last error number
Ptr<Ipv4Route> route;
Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a source address
if (!oif && m_src != Ipv4Address::GetAny ())
{
int32_t index = ipv4->GetInterfaceForAddress (m_src);
NS_ASSERT (index >= 0);
oif = ipv4->GetNetDevice (index);
NS_LOG_LOGIC ("Set index " << oif << "from source " << m_src);
}
// TBD-- we could cache the route and just check its validity
route = ipv4->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_);
if (route != 0)
+1
View File
@@ -75,6 +75,7 @@ def build(bld):
'tcp-test.cc',
'udp-test.cc',
'ipv4-test.cc',
'ipv4-raw-test.cc',
'ipv4-l4-protocol.cc',
'udp-header.cc',
'tcp-header.cc',