From 1801fc6c19bb10ff9d87b0fc494b93f052e25a73 Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Mon, 6 Mar 2017 02:09:25 +0100 Subject: [PATCH] internet: fix commit 12733:b3104511face --- src/internet/model/ipv4-raw-socket-impl.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/internet/model/ipv4-raw-socket-impl.cc b/src/internet/model/ipv4-raw-socket-impl.cc index e186fe44e..0459622cd 100644 --- a/src/internet/model/ipv4-raw-socket-impl.cc +++ b/src/internet/model/ipv4-raw-socket-impl.cc @@ -265,9 +265,14 @@ Ipv4RawSocketImpl::SendTo (Ptr p, uint32_t flags, } } - if (dst.IsBroadcast () || dst.IsLocalMulticast () || subnetDirectedBroadcast) + if (dst.IsBroadcast () || subnetDirectedBroadcast) { - if (m_boundnetdevice == 0) + Ptr boundNetDevice = m_boundnetdevice; + if (ipv4->GetNInterfaces () == 1) + { + boundNetDevice = ipv4->GetNetDevice (0); + } + if (boundNetDevice == 0) { NS_LOG_DEBUG ("dropped because no outgoing route."); return -1; @@ -282,7 +287,7 @@ Ipv4RawSocketImpl::SendTo (Ptr p, uint32_t flags, Ptr route = Create (); route->SetSource (src); route->SetDestination (dst); - route->SetOutputDevice (m_boundnetdevice); + route->SetOutputDevice (boundNetDevice); ipv4->Send (p, route->GetSource (), dst, m_protocol, route); } else @@ -294,7 +299,7 @@ Ipv4RawSocketImpl::SendTo (Ptr p, uint32_t flags, Ptr route = Create (); route->SetSource (src); route->SetDestination (dst); - route->SetOutputDevice (m_boundnetdevice); + route->SetOutputDevice (boundNetDevice); ipv4->SendWithHeader (p, header, route); } NotifyDataSent (pktSize);