tap-bridge with p2p

249 views
Skip to first unread message

Zhouyou Gu

unread,
May 17, 2017, 10:15:36 PM5/17/17
to ns-3-users
Hi all
I meet a problem similar to 

After reading these, I am still not sure how should I use tap-bridge with p2p?
or they are just not compatible?

Thanks in advance

Version ns-3.26

#include <iostream>
#include <fstream>

#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/tap-bridge-module.h"
#include "ns3/point-to-point-helper.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("TapCsmaVirtualMachineExample");

int 
main (int argc, char *argv[])
{
  CommandLine cmd;
  cmd.Parse (argc, argv);

  //
  // We are interacting with the outside, real, world.  This means we have to 
  // interact in real-time and therefore means we have to use the real-time
  // simulator and take the time to calculate checksums.
  //
  GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));

  //
  // Create two ghost nodes.  The first will represent the virtual machine host
  // on the left side of the network; and the second will represent the VM on 
  // the right side.
  //
  NodeContainer nodes;
  nodes.Create (2);

  //
  // Use a CsmaHelper to get a CSMA channel created, and the needed net 
  // devices installed on both of the nodes.  The data rate and delay for the
  // channel can be set through the command-line parser.  For example,
  //
  // ./waf --run "tap=csma-virtual-machine --ns3::CsmaChannel::DataRate=10000000"
  //
  PointToPointHelper p2p;
  NetDeviceContainer devices = p2p.Install (nodes);

  //
  // Use the TapBridgeHelper to connect to the pre-configured tap devices for 
  // the left side.  We go with "UseBridge" mode since the CSMA devices support
  // promiscuous mode and can therefore make it appear that the bridge is 
  // extended into ns-3.  The install method essentially bridges the specified
  // tap to the specified CSMA device.
  //
  TapBridgeHelper tapBridge;
  tapBridge.SetAttribute ("Mode", StringValue ("UseBridge"));
  tapBridge.SetAttribute ("DeviceName", StringValue ("tap-left"));
  tapBridge.Install (nodes.Get (0), devices.Get (0));

  //
  // Connect the right side tap to the right side CSMA device on the right-side
  // ghost node.
  //
  tapBridge.SetAttribute ("DeviceName", StringValue ("tap-right"));
  tapBridge.Install (nodes.Get (1), devices.Get (1));
  p2p.EnablePcapAll("taplink");
  //
  // Run the simulation for ten minutes to give the user time to play around
  //
  Simulator::Stop (Seconds (600.));
  Simulator::Run ();
  Simulator::Destroy ();
}

export NS_LOG=PointToPointChannel

0s -1 PointToPointChannel:PointToPointChannel()
0s -1 PointToPointChannel:Attach(0x9037a0, 0x902b80)
0s -1 PointToPointChannel:Attach(0x9037a0, 0x903160)
0.022638s 0 PointToPointChannel:TransmitStart(0x9037a0, 0x902370, 0x902b80)
0.022638s 0 PointToPointChannel:TransmitStart(): [LOGIC] UID is 0)
0.023176s 0 PointToPointChannel:TransmitStart(0x9037a0, 0x8e9610, 0x902b80)
0.023176s 0 PointToPointChannel:TransmitStart(): [LOGIC] UID is 1)
0.023183s 0 PointToPointChannel:TransmitStart(0x9037a0, 0x8c5e80, 0x902b80)
0.023183s 0 PointToPointChannel:TransmitStart(): [LOGIC] UID is 2)
assert failed. cond="false", msg="PPP Protocol number not defined!", file=../src/point-to-point/model/point-to-point-net-device.cc, line=775
terminate called without an active exception


export NS_LOG=PointToPointNetDevice
(the last few line in the log)

0.019022s 0 PointToPointNetDevice:TransmitStart(0x1ba0b80, 0x1ba0370)
0.019022s 0 PointToPointNetDevice:TransmitStart(): [LOGIC] UID is 1)
0.019022s 0 PointToPointNetDevice:TransmitStart(): [LOGIC] Schedule TransmitCompleteEvent in 3e-09sec
0.019022s 0 PointToPointNetDevice:TransmitComplete(0x1ba0b80)
0.019022s 0 PointToPointNetDevice:TransmitComplete(): [LOGIC] No pending packets in device queue after tx complete
0.019022s 0 PointToPointNetDevice:TransmitComplete(): [DEBUG] The device queue is being woken up (0 packets and 0 bytes inside)
0.021022s 1 PointToPointNetDevice:Receive(0x1ba1160, 0x1ba0370)
0.021022s 1 PointToPointNetDevice:ProcessHeader(0x1ba1160, 0x1ba0370, 0)
0.021022s 1 PointToPointNetDevice:PppToEther()
0.021022s 1 PointToPointNetDevice:GetRemote(0x1ba1160)
0.026086s 0 PointToPointNetDevice:Send(0x1ba0b80, 0x1ba0370, 02-06-ff:ff:ff:ff:ff:ff, 2054)
0.026086s 0 PointToPointNetDevice:Send(): [LOGIC] p=0x1ba0370, dest=0x7fffd2e24b30
0.026086s 0 PointToPointNetDevice:Send(): [LOGIC] UID is 2
0.026086s 0 PointToPointNetDevice:IsLinkUp(0x1ba0b80)
0.026086s 0 PointToPointNetDevice:AddHeader(0x1ba0b80, 0x1ba0370, 2054)
0.026086s 0 PointToPointNetDevice:EtherToPpp()
assert failed. cond="false", msg="PPP Protocol number not defined!", file=../src/point-to-point/model/point-to-point-net-device.cc, line=775
terminate called without an active exception




Tommaso Pecorella

unread,
May 18, 2017, 7:13:27 PM5/18/17
to ns-3-users
Hi,

it seems that you're sending something "strange" through the TAP.
Try printing the offending protocol number by changing the ASSERT message.

T.
Reply all
Reply to author
Forward
0 new messages