View | Details | Raw Unified | Return to bug 868
Collapse All | Expand All

(-)a/src/internet-stack/ipv4-l3-protocol.cc (-2 / +2 lines)
 Lines 594-600    Link Here 
594
      ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
594
      ipHeader = BuildHeader (source, destination, protocol, packet->GetSize (), ttl, mayFragment);
595
      int32_t interface = GetInterfaceForDevice (route->GetOutputDevice ());
595
      int32_t interface = GetInterfaceForDevice (route->GetOutputDevice ());
596
      m_sendOutgoingTrace (ipHeader, packet, interface);
596
      m_sendOutgoingTrace (ipHeader, packet, interface);
597
      SendRealOut (route, packet, ipHeader);
597
      SendRealOut (route, packet->Copy (), ipHeader);
598
      return; 
598
      return; 
599
    } 
599
    } 
600
  // 4) packet is not broadcast, and is passed in with a route entry but route->GetGateway is not set (e.g., on-demand)
600
  // 4) packet is not broadcast, and is passed in with a route entry but route->GetGateway is not set (e.g., on-demand)
 Lines 624-630    Link Here 
624
    {
624
    {
625
      int32_t interface = GetInterfaceForDevice (newRoute->GetOutputDevice ());
625
      int32_t interface = GetInterfaceForDevice (newRoute->GetOutputDevice ());
626
      m_sendOutgoingTrace (ipHeader, packet, interface);
626
      m_sendOutgoingTrace (ipHeader, packet, interface);
627
      SendRealOut (newRoute, packet, ipHeader);
627
      SendRealOut (newRoute, packet->Copy (), ipHeader);
628
    }
628
    }
629
  else
629
  else
630
    {
630
    {
(-)a/src/internet-stack/ipv4-raw-test.cc (-7 / +4 lines)
 Lines 120-128    Link Here 
120
Ipv4RawSocketImplTest::DoSendData (Ptr<Socket> socket, std::string to)
120
Ipv4RawSocketImplTest::DoSendData (Ptr<Socket> socket, std::string to)
121
{
121
{
122
  Address realTo = InetSocketAddress (Ipv4Address(to.c_str()), 0);
122
  Address realTo = InetSocketAddress (Ipv4Address(to.c_str()), 0);
123
  socket->SendTo (Create<Packet> (123), 0, realTo);
123
  NS_TEST_EXPECT_MSG_EQ (socket->SendTo (Create<Packet> (123), 0, realTo),
124
  // NS_TEST_EXPECT_MSG_NE (socket->SendTo (Create<Packet> (123), 0, realTo),
124
                         123, to);
125
  //                        -1, to);
126
}
125
}
127
126
128
void
127
void
 Lines 205-211    Link Here 
205
  // Create the IPv4 Raw sockets
204
  // Create the IPv4 Raw sockets
206
  Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<Ipv4RawSocketFactory> ();
205
  Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<Ipv4RawSocketFactory> ();
207
  Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
206
  Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket ();
208
  NS_TEST_EXPECT_MSG_EQ (rxSocket->Bind (InetSocketAddress (Ipv4Address ("0.0.0.0.0"), 0)), 0, "trivial");
207
  NS_TEST_EXPECT_MSG_EQ (rxSocket->Bind (InetSocketAddress (Ipv4Address ("0.0.0.0"), 0)), 0, "trivial");
209
  rxSocket->SetRecvCallback (MakeCallback (&Ipv4RawSocketImplTest::ReceivePkt, this));
208
  rxSocket->SetRecvCallback (MakeCallback (&Ipv4RawSocketImplTest::ReceivePkt, this));
210
209
211
  Ptr<Socket> rxSocket2 = rxSocketFactory->CreateSocket ();
210
  Ptr<Socket> rxSocket2 = rxSocketFactory->CreateSocket ();
 Lines 230-236    Link Here 
230
229
231
  SendData (txSocket, "255.255.255.255");
230
  SendData (txSocket, "255.255.255.255");
232
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 143, "recv: 255.255.255.255");
231
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 143, "recv: 255.255.255.255");
233
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket2->GetSize (), 143, "second socket should not receive it (it is bound specifically to the second interface's address");
232
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket2->GetSize (), 0, "second socket should not receive it (it is bound specifically to the second interface's address");
234
233
235
  m_receivedPacket->RemoveAllByteTags ();
234
  m_receivedPacket->RemoveAllByteTags ();
236
  m_receivedPacket2->RemoveAllByteTags ();
235
  m_receivedPacket2->RemoveAllByteTags ();
 Lines 240-248    Link Here 
240
239
241
  txSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.2"), 0));
240
  txSocket->Bind (InetSocketAddress (Ipv4Address ("10.0.0.2"), 0));
242
  SendData (txSocket, "224.0.0.9");
241
  SendData (txSocket, "224.0.0.9");
243
#if 0
244
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 143, "recv: 224.0.0.9");
242
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket->GetSize (), 143, "recv: 224.0.0.9");
245
#endif
246
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket2->GetSize (), 0, "second socket should not receive it (it is bound specifically to the second interface's address");
243
  NS_TEST_EXPECT_MSG_EQ (m_receivedPacket2->GetSize (), 0, "second socket should not receive it (it is bound specifically to the second interface's address");
247
244
248
  m_receivedPacket->RemoveAllByteTags ();
245
  m_receivedPacket->RemoveAllByteTags ();

Return to bug 868