diff -r cc28af24a31f -r a3afed368709 src/internet-stack/ipv4-raw-socket-impl.cc --- a/src/internet-stack/ipv4-raw-socket-impl.cc Tue Jul 06 20:27:51 2010 -0400 +++ b/src/internet-stack/ipv4-raw-socket-impl.cc Wed Jul 07 23:58:40 2010 +0900 @@ -185,6 +185,7 @@ InetSocketAddress ad = InetSocketAddress::ConvertFrom (toAddress); Ptr ipv4 = m_node->GetObject (); Ipv4Address dst = ad.GetIpv4 (); + Ipv4Address src = m_src; if (ipv4->GetRoutingProtocol ()) { Ipv4Header header; @@ -197,16 +198,17 @@ { p->RemoveHeader (header); dst = header.GetDestination (); + src = header.GetSource (); } 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 ()) + if (!oif && src != Ipv4Address::GetAny ()) { - int32_t index = ipv4->GetInterfaceForAddress (m_src); + int32_t index = ipv4->GetInterfaceForAddress (src); NS_ASSERT (index >= 0); oif = ipv4->GetNetDevice (index); - NS_LOG_LOGIC ("Set index " << oif << "from source " << m_src); + NS_LOG_LOGIC ("Set index " << oif << "from source " << src); } // TBD-- we could cache the route and just check its validity