bug 859 - Output interface estimation for the source address bound socket in IPv4 Raw socket
--- a/src/internet-stack/ipv4-raw-socket-impl.cc Wed Apr 07 16:56:46 2010 +0200
+++ b/src/internet-stack/ipv4-raw-socket-impl.cc Thu Apr 08 11:26:46 2010 +0900
@@ -178,6 +178,14 @@
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)
--- a/src/internet-stack/wscript Wed Apr 07 16:56:46 2010 +0200
+++ b/src/internet-stack/wscript Thu Apr 08 11:26:46 2010 +0900
@@ -75,6 +75,7 @@
'tcp-test.cc',
'udp-test.cc',
'ipv4-test.cc',
+ 'ipv4-raw-test.cc',
'ipv4-l4-protocol.cc',
'udp-header.cc',
'tcp-header.cc',