Bug #1613 - Can't build ns-3-dev with g++ 4.7.2 & Bug FdNetDevice can't build in OS X

This commit is contained in:
Alina Quereilhac
2013-03-29 16:10:12 +01:00
parent d2f222fb91
commit 64eb45017f
14 changed files with 360 additions and 106 deletions

View File

@@ -3,10 +3,17 @@ import os
def post_register_types(root_module):
enabled_features = os.environ['NS3_ENABLED_FEATURES'].split(',')
if 'EmuFdNetDevice' not in enabled_features:
root_module.classes.remove(root_module['ns3::EmuFdNetDeviceHelper'])
if 'TapFdNetDevice' not in enabled_features:
root_module.classes.remove(root_module['ns3::TapFdNetDeviceHelper'])
if 'PlanetLabFdNetDevice' not in enabled_features:
root_module.classes.remove(root_module['ns3::PlanetLabFdNetDeviceHelper'])
if 'FdNetDevice' not in enabled_features:
for clsname in ['FdNetDevice', 'FdNetDeviceHelper', 'FdNetDeviceFdReader',
'EmuFdNetDeviceHelper', 'PlanetLabFdNetDeviceHelper',
'TapFdNetDeviceHelper']:
for clsname in ['FdNetDevice', 'FdNetDeviceHelper', 'FdNetDeviceFdReader']:
root_module.classes.remove(root_module['ns3::%s' % clsname])
root_module.enums.remove(root_module['ns3::FdNetDeviceHelper::EncapsulationMode'])

View File

@@ -35,10 +35,6 @@ NS_LOG_COMPONENT_DEFINE ("DummyNetworkExample");
int
main (int argc, char *argv[])
{
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
NodeContainer nodes;
nodes.Create (2);

View File

@@ -45,17 +45,27 @@
// ---- (Internet) -------
//
// To use this example:
// 1) The ns-3 will create the TAP device for you in the host machine.
// 1) ns-3 will create the TAP device for you in the host machine.
// For this you need to provide the network address to allocate IP addresses
// for the TAP/TU device and the ns-3 FdNetDevice.
// for the TAP device and the ns-3 FdNetDevice.
//
// 2) Take into consideration that this experiment requires the host to be able to
// forward the traffic generated by the simulation to the Internet.
// 2) Take into consideration that this experiment requires the host to be able
// to forward the traffic generated by the simulation to the Internet.
// So for Linux systems, make sure to configure:
// # echo 1 > /proc/sys/net/ipv4/ip_forward
//
// 3) Once the experiment is running you can ping the FdNetDevice IP address from
// the host machine.
// Also enable natting so the traffic sent on the Internet are able to
// reach back the TAP.
// - TAP-network-address is the same as 'tapNetwork'
// - net-device-ip is be the IP address of the network device connected to the internet
// # iptables -t nat -A POSTROUTING -s <TAP-network-addres>/24 -j SNAT --to-source <net-device-ip>
//
// 3) Before running the example make sure that the tap creator binary has root suid
//
// # chown root.root build/src/fd-net-device/ns3-dev-tap-device-creator
// # sudo chmod 4755 build/src/fd-net-device/ns3-dev-tap-device-creator
//
#include "ns3/abort.h"
#include "ns3/core-module.h"

View File

@@ -56,13 +56,11 @@ NS_LOG_COMPONENT_DEFINE ("FdNetDeviceSaturationExample");
int
main (int argc, char *argv[])
{
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
uint16_t sinkPort = 8000;
uint32_t packetSize = 10000; // bytes
std::string dataRate("1000Mb/s");
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
std::string dataRate("10Mb/s");
NS_LOG_INFO ("Create Node");
NodeContainer nodes;
@@ -105,8 +103,8 @@ main (int argc, char *argv[])
PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
ApplicationContainer sinkApp = sinkHelper.Install (serverNode);
sinkApp.Start (Seconds (0.0));
sinkApp.Stop (Seconds (40.0));
fd.EnablePcap ("fd-server", serverDevice);
sinkApp.Stop (Seconds (30.0));
fd.EnablePcap ("fd2fd-onoff-server", serverDevice);
// client
AddressValue serverAddress (InetSocketAddress (serverIp, sinkPort));
@@ -117,11 +115,11 @@ main (int argc, char *argv[])
onoff.SetAttribute ("DataRate", DataRateValue (dataRate));
onoff.SetAttribute ("PacketSize", UintegerValue (packetSize));
ApplicationContainer clientApps = onoff.Install (clientNode);
clientApps.Start (Seconds (1.0));
clientApps.Stop (Seconds (39.0));
fd.EnablePcap ("fd-client", clientDevice);
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (29.0));
fd.EnablePcap ("fd2fd-onoff-client", clientDevice);
Simulator::Stop (Seconds (40.0));
Simulator::Stop (Seconds (30.0));
Simulator::Run ();
Simulator::Destroy ();
}

View File

@@ -0,0 +1,81 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2012 University of Washington, 2012 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
// Network topology
//
#include <sys/socket.h>
#include <errno.h>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/fd-net-device-module.h"
#include "ns3/applications-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("RealtimeDummyNetworkExample");
int
main (int argc, char *argv[])
{
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
NodeContainer nodes;
nodes.Create (2);
InternetStackHelper stack;
stack.Install (nodes);
FdNetDeviceHelper fd;
NetDeviceContainer devices = fd.Install (nodes);
int sv[2];
if (socketpair (AF_UNIX, SOCK_DGRAM, 0, sv) < 0)
{
NS_FATAL_ERROR ("Error creating pipe=" << strerror (errno));
}
Ptr<NetDevice> d1 = devices.Get (0);
Ptr<FdNetDevice> device1 = d1->GetObject<FdNetDevice> ();
device1->SetFileDescriptor (sv[0]);
Ptr<NetDevice> d2 = devices.Get (1);
Ptr<FdNetDevice> device2 = d2->GetObject<FdNetDevice> ();
device2->SetFileDescriptor (sv[1]);
Ipv4AddressHelper addresses;
addresses.SetBase ("10.0.0.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = addresses.Assign (devices);
Ptr<V4Ping> app = CreateObject<V4Ping> ();
app->SetAttribute ("Remote", Ipv4AddressValue (interfaces.GetAddress (0)));
app->SetAttribute ("Verbose", BooleanValue (true));
nodes.Get (1)->AddApplication (app);
app->SetStartTime (Seconds (0.0));
app->SetStopTime (Seconds (4.0));
fd.EnablePcapAll ("realtime-dummy-network", false);
Simulator::Stop (Seconds (5.));
Simulator::Run ();
Simulator::Destroy ();
}

View File

@@ -0,0 +1,127 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2012 University of Washington, 2012 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Alina Quereilhac <alina.quereilhac@inria.fr>
*
*/
//
// node 0 node 1
// +----------------+ +----------------+
// | ns-3 TCP | | ns-3 TCP |
// +----------------+ +----------------+
// | 10.1.1.1 | | 10.1.1.2 |
// +----------------+ socketpair +----------------+
// | fd-net-device |--------------| fd-net-device |
// +----------------+ +----------------+
//
// This example is aimed at meassuring the thoughput of the FdNetDevice
// in a pure simulation. For this purpose two FdNetDevices, attached to
// different nodes but in a same simulation, are connected using a socket pair.
// TCP traffic is sent at a saturating data rate. Then the thoughput can
// be obtained from the generated .pcap files.
//
// Steps to run the experiment:
//
// $ ./waf --run="fd2fd-onoff"
//
#include <sys/socket.h>
#include <errno.h>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/fd-net-device-module.h"
#include "ns3/applications-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("RealtimeFdNetDeviceSaturationExample");
int
main (int argc, char *argv[])
{
uint16_t sinkPort = 8000;
uint32_t packetSize = 10000; // bytes
std::string dataRate("1000Mb/s");
GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
NS_LOG_INFO ("Create Node");
NodeContainer nodes;
nodes.Create (2);
NS_LOG_INFO ("Create Device");
FdNetDeviceHelper fd;
NetDeviceContainer devices = fd.Install (nodes);
int sv[2];
if (socketpair (AF_UNIX, SOCK_DGRAM, 0, sv) < 0)
{
NS_FATAL_ERROR ("Error creating pipe=" << strerror (errno));
}
Ptr<NetDevice> d1 = devices.Get (0);
Ptr<FdNetDevice> clientDevice = d1->GetObject<FdNetDevice> ();
clientDevice->SetFileDescriptor (sv[0]);
Ptr<NetDevice> d2 = devices.Get (1);
Ptr<FdNetDevice> serverDevice = d2->GetObject<FdNetDevice> ();
serverDevice->SetFileDescriptor (sv[1]);
NS_LOG_INFO ("Add Internet Stack");
InternetStackHelper internetStackHelper;
internetStackHelper.SetIpv4StackInstall(true);
internetStackHelper.Install (nodes);
NS_LOG_INFO ("Create IPv4 Interface");
Ipv4AddressHelper addresses;
addresses.SetBase ("10.0.0.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = addresses.Assign (devices);
Ptr<Node> clientNode = nodes.Get (0);
Ipv4Address serverIp = interfaces.GetAddress (1);
Ptr<Node> serverNode = nodes.Get (1);
// server
Address sinkLocalAddress (InetSocketAddress (serverIp, sinkPort));
PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
ApplicationContainer sinkApp = sinkHelper.Install (serverNode);
sinkApp.Start (Seconds (0.0));
sinkApp.Stop (Seconds (40.0));
fd.EnablePcap ("rt-fd2fd-onoff-server", serverDevice);
// client
AddressValue serverAddress (InetSocketAddress (serverIp, sinkPort));
OnOffHelper onoff ("ns3::TcpSocketFactory", Address ());
onoff.SetAttribute ("Remote", serverAddress);
onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
onoff.SetAttribute ("DataRate", DataRateValue (dataRate));
onoff.SetAttribute ("PacketSize", UintegerValue (packetSize));
ApplicationContainer clientApps = onoff.Install (clientNode);
clientApps.Start (Seconds (1.0));
clientApps.Stop (Seconds (39.0));
fd.EnablePcap ("rt-fd2fd-onoff-client", clientDevice);
Simulator::Stop (Seconds (40.0));
Simulator::Run ();
Simulator::Destroy ();
}

View File

@@ -2,27 +2,35 @@
def build(bld):
env = bld.env
if env['ENABLE_FDNETDEV']:
obj = bld.create_ns3_program('dummy-network', ['fd-net-device', 'internet', 'applications'])
obj.source = 'dummy-network.cc'
obj = bld.create_ns3_program('fd2fd-onoff', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd2fd-onoff.cc'
if not env['ENABLE_FDNETDEV']:
return
if bld.env['ENABLE_TAP']:
obj = bld.create_ns3_program('fd-emu-ping', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-emu-ping.cc'
obj = bld.create_ns3_program('fd-emu-udp-echo', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-emu-udp-echo.cc'
obj = bld.create_ns3_program('fd-emu-onoff', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-emu-onoff.cc'
obj = bld.create_ns3_program('dummy-network', ['fd-net-device', 'internet', 'applications'])
obj.source = 'dummy-network.cc'
obj = bld.create_ns3_program('fd2fd-onoff', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd2fd-onoff.cc'
if bld.env['ENABLE_TAP']:
obj = bld.create_ns3_program('fd-tap-ping', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-tap-ping.cc'
obj = bld.create_ns3_program('fd-tap-ping6', ['fd-net-device', 'internet', 'applications', 'csma'])
obj.source = 'fd-tap-ping6.cc'
if bld.env["ENABLE_REAL_TIME"]:
obj = bld.create_ns3_program('realtime-dummy-network', ['fd-net-device', 'internet', 'applications'])
obj.source = 'realtime-dummy-network.cc'
obj = bld.create_ns3_program('realtime-fd2fd-onoff', ['fd-net-device', 'internet', 'applications'])
obj.source = 'realtime-fd2fd-onoff.cc'
if bld.env['ENABLE_PLANETLAB']:
obj = bld.create_ns3_program('fd-planetlab-ping', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-planetlab-ping.cc'
if bld.env['ENABLE_TAP']:
obj = bld.create_ns3_program('fd-emu-ping', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-emu-ping.cc'
obj = bld.create_ns3_program('fd-emu-udp-echo', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-emu-udp-echo.cc'
obj = bld.create_ns3_program('fd-emu-onoff', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-emu-onoff.cc'
if bld.env['ENABLE_TAP']:
obj = bld.create_ns3_program('fd-tap-ping', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-tap-ping.cc'
obj = bld.create_ns3_program('fd-tap-ping6', ['fd-net-device', 'internet', 'applications', 'csma'])
obj.source = 'fd-tap-ping6.cc'
if bld.env['ENABLE_PLANETLAB']:
obj = bld.create_ns3_program('fd-planetlab-ping', ['fd-net-device', 'internet', 'applications'])
obj.source = 'fd-planetlab-ping.cc'

View File

@@ -30,7 +30,6 @@
#include <net/ethernet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netpacket/packet.h>
#include <arpa/inet.h>
#include "creator-utils.h"

View File

@@ -194,8 +194,6 @@ EmuFdNetDeviceHelper::CreateFileDescriptor (void) const
{
NS_LOG_FUNCTION (this);
#ifdef HAVE_RAW_SOCKET_CREATOR
//
// We want to create a raw socket for our net device. Unfortunately for us
// you have to have root privileges to do that. Instead of running the
@@ -407,13 +405,6 @@ EmuFdNetDeviceHelper::CreateFileDescriptor (void) const
}
NS_FATAL_ERROR ("Did not get the raw socket from the socket creator");
}
#else
NS_FATAL_ERROR ("RAW_SOCKET_CREATOR is not defined in your system.");
#endif /* HAVE_RAW_SOCKET_CREATOR */
}
} // namespace ns3

View File

@@ -121,8 +121,6 @@ PlanetLabFdNetDeviceHelper::CreateFileDescriptor (void) const
{
NS_LOG_FUNCTION (this);
#ifdef HAVE_PLANETLAB_TAP_CREATOR
//
// We're going to fork and exec that program soon, but first we need to have
// a socket to talk to it with. So we create a local interprocess (Unix)
@@ -330,12 +328,6 @@ PlanetLabFdNetDeviceHelper::CreateFileDescriptor (void) const
NS_FATAL_ERROR ("Did not get the raw socket from the socket creator");
}
#else
NS_FATAL_ERROR ("PLANETLAB_TAP_CREATOR is not defined in your system.");
#endif /* HAVE_PLANETLAB_CREATOR */
}
} // namespace ns3

View File

@@ -296,7 +296,7 @@ main (int argc, char *argv[])
char *path = NULL;
int tap = false;
int pi = false;
int prefix = NULL;
int prefix = -1;
while ((c = getopt (argc, argv, "vd:i:m:n:I:P:thp:")) != -1)
{
@@ -357,7 +357,7 @@ main (int argc, char *argv[])
}
if (ip6)
{
ABORT_IF (prefix == NULL, "Prefix is a required argument", 0);
ABORT_IF (prefix == -1, "Prefix is a required argument", 0);
LOG ("Provided IP v6 Address is \"" << ip6 << "\"");
LOG ("Provided IP v6 Prefix is \"" << prefix << "\"");
}

View File

@@ -147,7 +147,6 @@ TapFdNetDeviceHelper::CreateFileDescriptor (void) const
{
NS_LOG_FUNCTION (this);
#ifdef HAVE_TAP_CREATOR
//
// We're going to fork and exec that program soon, but first we need to have
// a socket to talk to it with. So we create a local interprocess (Unix)
@@ -264,8 +263,8 @@ TapFdNetDeviceHelper::CreateFileDescriptor (void) const
//
// Execute the socket creation process image.
//
status = ::execlp (TAP_CREATOR,
TAP_CREATOR, // argv[0] (filename)
status = ::execlp (TAP_DEV_CREATOR,
TAP_DEV_CREATOR, // argv[0] (filename)
ossDeviceName.str ().c_str (), // argv[1] (-d<device name>)
ossMac.str ().c_str (), // argv[2] (-m<MAC address>
ossIp4.str ().c_str (), // argv[3] (-i<IP v4 address>)
@@ -401,12 +400,6 @@ TapFdNetDeviceHelper::CreateFileDescriptor (void) const
NS_FATAL_ERROR ("Did not get the raw socket from the socket creator");
}
#else
NS_FATAL_ERROR ("TAP_CREATOR is not defined in your system.");
#endif /* HAVE_TAP_CREATOR */
}
} // namespace ns3

View File

@@ -10,8 +10,12 @@
cpp_examples = [
("dummy-network", "True", "True"),
("fd-emu-ping", "False", "True"),
("fd-emu-onoff", "False", "True"),
("fd-emu-udp-echo", "False", "True"),
("realtime-dummy-network", "False", "True"),
("fd2fd-onoff", "False", "True"),
("fd-tap-ping", "False", "True"),
("realtime-fd2fd-onoff", "False", "True"),
]
# A list of Python examples to run in order to ensure that they remain

View File

@@ -6,44 +6,22 @@ def configure(conf):
conf.env['ENABLE_FDNETDEV'] = False
if conf.env['ENABLE_THREADING']:
# Check for system dependencies
have_sysioctl = conf.check_nonfatal(header_name='sys/ioctl.h',
define_name = 'HAVE_SYS_IOCTL_H')
have_netif = conf.check_nonfatal(header_name='net/if.h',
define_name = 'HAVE_IF_NETS_H')
# Enable use of TUN/TAP helper
conf.env['ENABLE_TAP'] = conf.check_nonfatal(
header_name='linux/if_tun.h',
define_name='HAVE_IF_TUN_H') and have_sysioctl and have_netif
if conf.env['ENABLE_TAP']:
conf.define('HAVE_TAP_CREATOR', 1)
# Enable use of raw socket (EMU) helper.
conf.env['ENABLE_EMU'] = conf.check_nonfatal(
header_name='netpacket/packet.h',
define_name='HAVE_PACKET_H') and have_sysioctl and have_netif
if conf.env['ENABLE_EMU']:
conf.define('HAVE_RAW_SOCKET_CREATOR', 1)
# Enable use of PlanetLab TAP helper
# TODO: How to validate
(sysname, nodename, release, version, machine) = os.uname()
if release.find('onelab') != -1:
conf.env['ENABLE_PLANETLAB'] = True
conf.define('HAVE_PLANETLAB_TAP_CREATOR', 1)
# Enable the FdNetDevice module.
# Our only requirement is threading support.
conf.env['ENABLE_FDNETDEV'] = True
conf.report_optional_feature("FdNetDevice",
"File Descriptor Net Device",
"File descriptor NetDevice",
True,
"FdNetDevice module enabled")
else:
conf.report_optional_feature("FdNetDevice",
"File Descriptor Net Device",
"File descriptor NetDevice",
False,
"needs threading support which is not available")
@@ -56,6 +34,58 @@ def configure(conf):
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('fd-net-device')
# Next, check for whether specialized FdNetDevice features are enabled
# such as tap device support, raw socket support, and planetlab
if conf.env['ENABLE_FDNETDEV']:
conf.env['ENABLE_TAP'] = conf.check_nonfatal(
header_name='linux/if_tun.h',
define_name='HAVE_IF_TUN_H') and have_sysioctl and have_netif
if conf.env['ENABLE_TAP']:
conf.report_optional_feature("TapFdNetDevice",
"Tap FdNetDevice",
True,
"Tap support enabled")
else:
conf.report_optional_feature("TapFdNetDevice",
"Tap FdNetDevice",
False,
"needs linux/if_tun.h")
# Enable use of raw socket (EMU) helper.
conf.env['ENABLE_EMU'] = conf.check_nonfatal(
header_name='netpacket/packet.h',
define_name='HAVE_PACKET_H') and have_sysioctl and have_netif
if conf.env['ENABLE_EMU']:
conf.report_optional_feature("EmuFdNetDevice",
"Emulation FdNetDevice",
True,
"Emulation support enabled")
else:
conf.report_optional_feature("EmuFdNetDevice",
"Emulation FdNetDevice",
False,
"needs netpacket/packet.h")
# Enable use of PlanetLab TAP helper
# TODO: How to validate
(sysname, nodename, release, version, machine) = os.uname()
if release.find('onelab') != -1:
conf.env['ENABLE_PLANETLAB'] = True
if conf.env['ENABLE_PLANETLAB']:
conf.report_optional_feature("PlanetLabFdNetDevice",
"PlanetLab FdNetDevice",
True,
"Planetlab support enabled")
else:
conf.report_optional_feature("PlanetLabFdNetDevice",
"PlanetLab FdNetDevice",
False,
"PlanetLab operating system not detected")
def build(bld):
# Don't do anything for this module if emu's not enabled.
if not bld.env['ENABLE_FDNETDEV']:
@@ -65,9 +95,6 @@ def build(bld):
module.source = [
'model/fd-net-device.cc',
'helper/fd-net-device-helper.cc',
'helper/tap-fd-net-device-helper.cc',
'helper/emu-fd-net-device-helper.cc',
'helper/planetlab-fd-net-device-helper.cc',
'helper/encode-decode.cc',
'helper/creator-utils.cc',
]
@@ -77,24 +104,37 @@ def build(bld):
headers.source = [
'model/fd-net-device.h',
'helper/fd-net-device-helper.h',
'helper/tap-fd-net-device-helper.h',
'helper/emu-fd-net-device-helper.h',
'helper/planetlab-fd-net-device-helper.h',
]
if bld.env['ENABLE_TAP']:
if not bld.env['PLATFORM'].startswith('freebsd'):
creator = bld.create_suid_program('tap-creator')
module.source.extend([
'helper/tap-fd-net-device-helper.cc',
])
headers.source.extend([
'helper/tap-fd-net-device-helper.h',
])
creator = bld.create_suid_program('tap-device-creator')
creator.source = [
'helper/tap-creator.cc',
'helper/tap-device-creator.cc',
'helper/encode-decode.cc',
'helper/creator-utils.cc',
]
module.env.append_value("DEFINES",
"TAP_CREATOR=\"%s\"" % (creator.target,))
"TAP_DEV_CREATOR=\"%s\"" % (creator.target,))
if bld.env['ENABLE_EMU']:
module.source.extend([
'helper/emu-fd-net-device-helper.cc',
])
headers.source.extend([
'helper/emu-fd-net-device-helper.h',
])
creator = bld.create_suid_program('raw-sock-creator')
creator.source = [
'helper/raw-sock-creator.cc',
@@ -106,6 +146,14 @@ def build(bld):
"RAW_SOCK_CREATOR=\"%s\"" % (creator.target,))
if bld.env['ENABLE_PLANETLAB']:
module.source.extend([
'helper/planetlab-fd-net-device-helper.cc',
])
headers.source.extend([
'helper/planetlab-fd-net-device-helper.h',
])
creator = bld.create_suid_program('planetlab-tap-creator')
creator.source = [
'helper/planetlab-tap-creator.cc',