Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 60 additions & 9 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ name: Build and Test DCE

on:
push:
branches: [ sikabo_master ]
branches: [ master ]
# Run for every pull request (merge-request pipeline), whatever the target branch
pull_request:
branches: [ sikabo_master ]
workflow_dispatch:

# Cancel superseded runs of the same branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NS3_VER: "3.46"
NS3_VER: "3.49"

jobs:
build:
Expand All @@ -18,8 +23,6 @@ jobs:
fail-fast: false
matrix:
include:
- distro: ubuntu-22.04
image: ubuntu:22.04
- distro: ubuntu-24.04
image: ubuntu:24.04
- distro: debian-trixie
Expand All @@ -44,7 +47,17 @@ jobs:
libsqlite3-dev \
libxml2-dev \
wget \
make
make \
bc \
flex \
bison \
byacc \
gawk \
file \
xz-utils \
libssl-dev \
libdb-dev \
libsctp-dev

- name: Configure git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE/ns-3-dce"
Expand Down Expand Up @@ -88,24 +101,62 @@ jobs:
working-directory: ns-${{ env.NS3_VER }}
run: ./ns3 install

# Linux/FreeBSD kernel libraries, DCE builds of ip, iperf, thttpd,
# wget, ping and quagga, and the ns-3-dce-quagga module.
- name: Cache kernel stack dependencies
id: cache-kernel-deps
uses: actions/cache@v4
with:
path: |
deps/bin_dce
deps/kernel
deps/ns-3-dce-quagga
key: kernel-deps-${{ matrix.distro }}-${{ hashFiles('ns-3-dce/utils/build_kernel_deps.sh', 'ns-3-dce/utils/*.patch') }}

- name: Build kernel stack dependencies
if: steps.cache-kernel-deps.outputs.cache-hit != 'true'
working-directory: ns-3-dce
run: |
./utils/build_kernel_deps.sh "$GITHUB_WORKSPACE/deps"
rm -rf "$GITHUB_WORKSPACE/deps/src"

- name: Add Quagga module
run: cp -a deps/ns-3-dce-quagga ns-3-dce/myscripts/

- name: Configure DCE
working-directory: ns-3-dce
run: |
./waf configure \
--with-ns3="$GITHUB_WORKSPACE/build" \
--prefix="$GITHUB_WORKSPACE/build" \
--enable-kernel-stack="$GITHUB_WORKSPACE/deps/kernel" \
--enable-opt

- name: Build DCE
working-directory: ns-3-dce
run: ./waf build

- name: Build bash for DCE
- name: Install DCE binaries
working-directory: ns-3-dce
run: ./utils/build_bash.sh build/bin_dce
run: |
cp -a "$GITHUB_WORKSPACE/deps/bin_dce/." build/bin_dce/
./utils/build_bash.sh build/bin_dce

- name: Run DCE tests
working-directory: ns-3-dce
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/build/lib:${{ github.workspace }}/build/lib64
run: python3 test.py
run: python3 test.py -r

- name: Remove sockets from test output
if: always()
working-directory: ns-3-dce
run: if [ -d testpy-output ]; then find testpy-output -type s -delete; fi

- name: Upload test output
if: always()
uses: actions/upload-artifact@v4
with:
name: testpy-output-${{ matrix.distro }}
path: ns-3-dce/testpy-output
if-no-files-found: ignore
69 changes: 0 additions & 69 deletions .github/workflows/dce-gaction-test.yml

This file was deleted.

1 change: 1 addition & 0 deletions example/dce-mptcp-handoff-v4v6.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ int main (int argc, char *argv[])
WifiMacHelper mac;
YansWifiPhyHelper phy;
YansWifiChannelHelper phyChannel = YansWifiChannelHelper::Default ();
wifi.SetStandard (WIFI_STANDARD_80211a);
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");

// setup Wifi sta.
Expand Down
1 change: 1 addition & 0 deletions example/dce-mptcp-handoff-v6.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ int main (int argc, char *argv[])
WifiMacHelper mac;
YansWifiPhyHelper phy;
YansWifiChannelHelper phyChannel = YansWifiChannelHelper::Default ();
wifi.SetStandard (WIFI_STANDARD_80211a);
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");

// setup Wifi sta.
Expand Down
19 changes: 0 additions & 19 deletions example/dce-tcp-ns3-nsc-comparison.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,6 @@ main (int argc, char *argv[])
sock_factory = "ns3::TcpSocketFactory";
internetStack.Install (nodes);
}
else if (m_stack == "nsc-linux")
{
internetStack.Install (routers);
sock_factory = "ns3::TcpSocketFactory";
internetStack.SetTcp ("ns3::NscTcpL4Protocol",
"Library", StringValue ("liblinux2.6.26.so"));
internetStack.Install (lefts);
internetStack.Install (rights);
// Config::Set ("/NodeList/*/$ns3::Ns3NscStack<linux2.6.26>/net.ipv4.tcp_congestion_control",
// StringValue ("reno"));
}
else if (m_stack == "nsc-freebsd")
{
// didn't work under 64bit (12/11/13)
sock_factory = "ns3::TcpSocketFactory";
internetStack.SetTcp ("ns3::NscTcpL4Protocol",
"Library", StringValue ("libfreebsd5.3.so"));
internetStack.Install (nodes);
}
else
{
NS_ASSERT_MSG (0, "no stack " << m_stack << " is available");
Expand Down
3 changes: 2 additions & 1 deletion example/examples-to-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
("dce-ping-mt1 --kernel=1", "True", "True"),
("dce-mt2 --kernel=1", "True", "True"),
("dce-mt3 --kernel=1", "True", "True"),
("dce-xfrm", "False", "False"),
# Runs, but libos 4.4 cannot install IPsec states (ENOSYS)
("dce-xfrm", "True", "True"),
# ("dce-ltp", "True", "True"),
("dce-cradle-mptcp", "True", "True"),
("dce-iperf-mptcp", "IPERF_DCE_FOUND == True", "IPERF_DCE_FOUND == True"),
Expand Down
2 changes: 1 addition & 1 deletion helper/dce-manager-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "ipv4-linux.h"
#include "dce-application-helper.h"
#include "ns3/ipv4-routing-protocol.h"
#include "ns3/ipv4-global-routing.h"
#include "ns3/global-routing.h"
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
Expand Down
2 changes: 2 additions & 0 deletions model/dce-manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ DceManager::CreateProcess (std::string name, std::string stdinfilename, std::vec
process->pgid = 0;
process->pid = pid ? pid : AllocatePid ();
process->manager = this;
process->getoptStarted = false;
sigemptyset (&process->pendingSignals);

SetDefaultSigHandler (process->signalHandlers);
Expand Down Expand Up @@ -544,6 +545,7 @@ DceManager::CreateThread (struct Process *process)
thread->pollTable = 0;
thread->ioWait = std::make_pair ((UnixFd*)0,(WaitQueueEntry*)0);
sigemptyset (&thread->signalMask);
sigemptyset (&thread->sigwaitSet);
if (!process->threads.empty ())
{
// copy all key values.
Expand Down
28 changes: 21 additions & 7 deletions model/dce-signal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,27 @@ int dce_sigwait (const sigset_t *set, int *sig)
NS_LOG_FUNCTION (current << UtilsGetNodeId () << set << sig);
NS_ASSERT (current != 0);

int ret = 0;
// NEED TO WORK!!
// XXX: we need to add signal num notiifcation
current->process->manager->Wait ();
// sigdelset (&current->pendingSignals, numnum);

return ret;
while (true)
{
for (int s = 1; s < NSIG; s++)
{
if (sigismember (set, s) != 1)
{
continue;
}
if (sigismember (&current->pendingSignals, s) == 1
|| sigismember (&current->process->pendingSignals, s) == 1)
{
sigdelset (&current->pendingSignals, s);
sigdelset (&current->process->pendingSignals, s);
sigemptyset (&current->sigwaitSet);
*sig = s;
return 0;
}
}
current->sigwaitSet = *set;
current->process->manager->Wait ();
}
}
int dce_sigprocmask (int how, const sigset_t *set, sigset_t *oldset)
{
Expand Down
19 changes: 19 additions & 0 deletions model/dce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,23 @@ const char * dce_inet_ntop (int af, const void *src,
}
return retval;
}
// glibc keeps getopt parsing state (e.g. the position inside a cluster of
// short options) in a hidden static shared by all simulated processes.
// optind = 0 makes glibc reinitialize it: always on a process' first call,
// and when another process used getopt last and this one is at the start
// of its arguments.
static void
ResetGetoptIfOtherProcess (Process *process)
{
static Process *lastProcess = 0;
if (!process->getoptStarted || (lastProcess != process && optind <= 1))
{
optind = 0;
}
process->getoptStarted = true;
lastProcess = process;
}

int dce_getopt (int argc, char * const argv[], const char *optstring)
{
NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << argc << argv << optstring);
Expand All @@ -464,6 +481,7 @@ int dce_getopt (int argc, char * const argv[], const char *optstring)
optind = *process->poptind;
opterr = *process->popterr;
optopt = *process->poptopt;
ResetGetoptIfOtherProcess (process);
int retval = getopt (argc, argv, optstring);
*process->poptarg = optarg;
*process->poptind = optind;
Expand Down Expand Up @@ -495,6 +513,7 @@ int dce_getopt_long (int argc, char * const argv[], const char *optstring,
optind = *process->poptind;
opterr = *process->popterr;
optopt = *process->poptopt;
ResetGetoptIfOtherProcess (process);
int retval = getopt_long (argc, argv, optstring, longopts, longindex);
*process->poptarg = optarg;
*process->poptind = optind;
Expand Down
20 changes: 11 additions & 9 deletions model/freebsd/ipv4-freebsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv4-interface.h"
#include "ns3/ipv4-global-routing.h"
#include "ns3/arp-l3-protocol.h"
#include "ns3/global-routing.h"
#include "ns3/ipv4-routing-table-entry.h"
#include "dce-application-helper.h"
#include "freebsd-socket-fd-factory.h"
Expand Down Expand Up @@ -98,7 +99,9 @@ Ipv4FreeBSD::AddInterface (Ptr<NetDevice> device)
{
NS_LOG_FUNCTION (this << &device);

Ptr<Node> node = GetObject<Node> ();
Ptr<Ipv4Interface> interface = CreateObject<Ipv4Interface> ();
interface->SetNode (node);
interface->SetDevice (device);
interface->SetForwarding (m_ipForward);
return AddIpv4Interface (interface);
Expand Down Expand Up @@ -395,10 +398,6 @@ Ipv4FreeBSD::SelectSourceAddress (Ptr<const NetDevice> device,
for (uint32_t j = 0; j < GetNAddresses (i); j++)
{
iaddr = GetAddress (i, j);
if (iaddr.IsSecondary ())
{
continue;
}
if (iaddr.GetScope () > scope)
{
continue;
Expand All @@ -425,10 +424,6 @@ Ipv4FreeBSD::SelectSourceAddress (Ptr<const NetDevice> device,
for (uint32_t j = 0; j < GetNAddresses (i); j++)
{
iaddr = GetAddress (i, j);
if (iaddr.IsSecondary ())
{
continue;
}
if (iaddr.GetScope () != Ipv4InterfaceAddress::LINK
&& iaddr.GetScope () <= scope)
{
Expand Down Expand Up @@ -561,6 +556,13 @@ Ipv4FreeBSD::InstallNode (Ptr<Node> node)
factory.SetTypeId ("ns3::Ipv4FreeBSD");
Ptr<Object> protocol = factory.Create <Object> ();
node->AggregateObject (protocol);
// ns3::Ipv4Interface creates an ARP cache for devices that need ARP once it
// knows its node. The FreeBSD kernel does ARP itself, so this ArpL3Protocol
// is never registered as a protocol handler and stays inert.
if (!node->GetObject<ArpL3Protocol> ())
{
node->AggregateObject (CreateObject<ArpL3Protocol> ());
}
Ipv4GlobalRoutingHelper globalRouting;
// Set routing
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
Expand Down
Loading