# HG changeset patch # Parent 9b1f69a8add78949b664da2ace2649772257afca diff -r 9b1f69a8add7 src/internet-stack/ipv4-raw-socket-impl.cc --- a/src/internet-stack/ipv4-raw-socket-impl.cc Sun Apr 04 22:53:18 2010 +0900 +++ b/src/internet-stack/ipv4-raw-socket-impl.cc Sun Apr 04 22:54:03 2010 +0900 @@ -179,6 +179,14 @@ SocketErrno errno_ = ERROR_NOTERROR;//do not use errno as it is the standard C last error number Ptr route; Ptr 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)