sudo tunctl -t tap-device
ifconfig tap-device 10.0.0.2/24 promisc up
uint16_t PointToPointNetDevice::EtherToPpp (uint16_t proto)
{
NS_LOG_FUNCTION_NOARGS();
switch(proto)
{
case 0x0800: return 0x0021; //IPv4
case 0x86DD: return 0x0057; //IPv6
default: NS_ASSERT_MSG (false, "PPP Protocol number not defined!");
}
return 0;
}
...
+0.243931000s 0 PointToPointNetDevice:Send(0x561084e70190, 0x561084e71fc0, 02-06-ff:ff:ff:ff:ff:ff, 2054)
+0.243931000s 0 PointToPointNetDevice:Send(): [LOGIC] p=0x561084e71fc0, dest=0x7ffdc6e53470
+0.243931000s 0 PointToPointNetDevice:Send(): [LOGIC] UID is 1
+0.243931000s 0 PointToPointNetDevice:IsLinkUp(0x561084e70190)
+0.243931000s 0 PointToPointNetDevice:AddHeader(0x561084e70190, 0x561084e71fc0, 2054)
+0.243931000s 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=705
terminate called without an active exception
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/tap-bridge-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/internet-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("TapWithPPP");
int
main (int argc, char *argv[])
{
LogComponentEnable("PointToPointNetDevice", LOG_ALL);
LogComponentEnable("PointToPointNetDevice", LOG_PREFIX_ALL);
CommandLine cmd;
cmd.Parse (argc, argv);
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
NodeContainer nodes;
nodes.Create (2);
InternetStackHelper stack;
stack.Install (nodes);
PointToPointHelper pointToPoint;
NetDeviceContainer devicesPPP;
devicesPPP = pointToPoint.Install (nodes.Get (0), nodes.Get (1));
Ipv4AddressHelper ipv4Address;
ipv4Address.SetBase ("10.0.0.0", "255.255.255.0");
Ipv4InterfaceContainer ipv4Interface = ipv4Address.Assign (devicesPPP);
TapBridgeHelper tapBridge;
tapBridge.SetAttribute ("Mode", StringValue ("UseLocal"));
tapBridge.SetAttribute ("DeviceName", StringValue ("tap-device"));
tapBridge.Install (nodes.Get(0), devicesPPP.Get (0));
Simulator::Stop (Seconds (3600.));
Simulator::Run ();
Simulator::Destroy ();
}