Skip to content

Ns 3.49 updates (replacing #148 and #149) - #153

Open
tomhenderson wants to merge 8 commits into
direct-code-execution:masterfrom
tomhenderson:ns-3.49-updates
Open

tomhenderson wants to merge 8 commits into
direct-code-execution:masterfrom
tomhenderson:ns-3.49-updates

Conversation

@tomhenderson

@tomhenderson tomhenderson commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

This MR is intended to merge both #148 and #149's commits, with a couple of others that I found during testing on Ubuntu 26.04. This should bring ns-3-dce up to ns-3.49 compatibility with Python 3.14 and gcc-15.2.

I plan to close #148 and #149 if this merges.


Summary by cubic

Brings ns-3-dce to ns-3.49 compatibility on Python 3.14 and gcc 15.2, merging the pending work from the two existing PRs plus additional fixes found while testing on Ubuntu 26.04.

CI and build

  • Replaces the obsolete bake-based workflow with build-and-test on ns-3.49; kernel-stack dependencies (Linux/FreeBSD libos, ip, iperf, thttpd, wget, ping, quagga) are now built by utils/build_kernel_deps.sh and cached.
  • Drops Ubuntu 22.04 from CI (its CMake predates ns-3.49) and removes the NSC-based option from dce-tcp-ns3-nsc-comparison.

Compatibility fixes

  • Adapts to ns-3.48/3.49 API changes: moved headers, removed secondary-address checks, and the new Address::Register signature.
  • Implements sigwait() and resets glibc's getopt state per simulated process.
  • Adds Linux semantics for the ns-3 stack: IPv6 UDP sockets, multicast group join/leave, pktinfo options, raw-only protocol delivery, connection-success notification, and local multicast delivery to raw sockets.
  • Makes netlink and pktinfo interface indexes use Linux conventions (NetDevice index + 1).
  • Fixes std::ofstream by mapping fopencookie-backed streams to their DCE fd in fileno().
  • Enables previously disabled select/poll/tcp-socket/signal and quagga tests; all 79 pass on Ubuntu 24.04 and Debian trixie.

Written for commit a4d6ca1. Summary will update on new commits.

View guided diff

tomhenderson and others added 8 commits November 15, 2026 18:17
DCE's fopencookie-backed FILE* streams have no underlying fd, so fileno()
returned -1. libstdc++'s filebuf does raw lseek() on that fd, failing with
EBADF and setting the failbit on ofstream close(). Track each cookie stream's
DCE fd and return it from dce_fileno(). Add an ofstream test case.

Signed-off-by: Anders Martinsson <anders.martinsson@sikabo.com>
Run the GitHub Actions workflow on pushes to master and on every pull request, and drop the obsolete bake-based workflow (Ubuntu 20.04 runners and upload-artifact@v1 no longer exist).

Add utils/build_kernel_deps.sh, which builds what bake used to provide: net-next-nuse (Linux 4.4 libos), freebsd-sim, DCE builds of ip, iperf, thttpd, wget, ping/ping6 and quagga, and the ns-3-dce-quagga module, patched for current ns-3 and toolchains (GCC 11-14, Make 4.4). The workflow caches its output and configures DCE with --enable-kernel-stack.

Fix DCE for ns-3.46 and Linux semantics:
- set the node on Ipv4Interfaces (Linux and FreeBSD glue) and give kernel-stack nodes an inert ArpL3Protocol for CSMA devices
- notify connection success for connectionless kernel sockets
- deliver multicast locally in Ipv4DceRouting (raw sockets, OSPF)
- implement sigwait()
- ns-3 stream sockets: connect() succeeds when the peer accepts and closes at once, and reports ECONNREFUSED when refused
- ns-3 stack: IPv6 UDP sockets, IPV6_JOIN/LEAVE_GROUP, IPV6_RECVPKTINFO, ICMP6_FILTER, IPV6_PKTINFO on send, no IPv6 header on raw receive, delivery for raw-only IPv6 protocols such as OSPFv3
- netlink and pktinfo use Linux-style interface indexes consistently
- reset glibc's getopt state for each simulated process
- drop the NSC stacks from dce-tcp-ns3-nsc-comparison; use 802.11a in the MPTCP handoff examples

Enable the disabled select/poll/tcp-socket/signal process-manager tests, all quagga test cases and the dce-xfrm example. 79/79 pass on Ubuntu 22.04, Ubuntu 24.04 and Debian trixie with ns-3.46.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Ipv4InterfaceAddress no longer has secondary addresses: drop the IsSecondary() checks in the Linux and FreeBSD IPv4 glue
- Ipv4GlobalRouting moved to ns3/global-routing.h
- Address::Register() now takes the address kind and its length
- CI: build against ns-3.49; drop Ubuntu 22.04, whose CMake (3.22) is older than ns-3.49 requires

79/79 tests and examples pass on Ubuntu 24.04 and Debian trixie.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Netlink address attributes carry raw bytes with no address type, and
the deserializer read them into a default-constructed ns3::Address.
This relied on two behaviors that ns-3.49 removed: Address::CopyFrom
on an untyped Address (now a fatal assert) and type-0 addresses
passing CheckCompatible in ConvertFrom. Infer the concrete type from
the payload length instead: 4 bytes is IPv4, 16 is IPv6 and 6 is a
MAC address, which are the only lengths these attributes use.

Assisted-by: Claude Fable 5.2

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

21 issues found across 38 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="netlink/netlink-socket.cc">

<violation number="1" location="netlink/netlink-socket.cc:801">
P2: This changes RTM_GETADDR indices to one-based NetDevice indices without updating `DoInterfaceAddressMessage` to translate them back, so address operations using a dumped index address the wrong interface. Convert the netlink index to the corresponding IP-interface index before the existing bounds checks and updates.</violation>
</file>

<file name="model/dce.cc">

<violation number="1" location="model/dce.cc:458">
P1: This condition does not isolate glibc’s hidden cluster state between processes. `optind == 1` can mean that a process is midway through `-abc`, while `optind > 1` still leaves another process’s `__nextchar` active, causing options to be returned from the wrong argv or clusters to repeat; preserve per-process parser state or use a reentrant getopt implementation.</violation>
</file>

<file name="utils/build_kernel_deps.sh">

<violation number="1" location="utils/build_kernel_deps.sh:30">
P2: The dependency build pins the NUSE and FreeBSD inputs to mutable branch names, so a fresh run can silently build different kernel libraries without any change in this repository. Pin these inputs to immutable commit IDs and update them explicitly when upgrading.</violation>

<violation number="2" location="utils/build_kernel_deps.sh:52">
P2: `fetch_git` reuses any existing directory without validating its requested revision, so rerunning with an old checkout can build sources different from the revisions declared by this script. Verify the checkout and update or recreate it when the revision does not match.</violation>

<violation number="3" location="utils/build_kernel_deps.sh:93">
P2: The script cannot be rerun with its preserved source tree: after the first successful run, `git apply --check` fails because the FreeBSD patch is already applied, and `set -e` exits before rebuilding. Treat an already-applied patch as success while still failing on a genuine mismatch.</violation>

<violation number="4" location="utils/build_kernel_deps.sh:130">
P1: The script treats any patch failure as success, so an upstream source-layout change produces an unpatched binary instead of stopping. Distinguish an already-applied patch from a genuine failure and abort when neither state applies.</violation>

<violation number="5" location="utils/build_kernel_deps.sh:138">
P1: This downloads source over plain HTTP without an integrity check, allowing a network attacker to inject code into the DCE binary built by CI or a developer. Use a trusted HTTPS source and verify a pinned archive digest before extraction.</violation>

<violation number="6" location="utils/build_kernel_deps.sh:170">
P2: This suppresses every iputils patch failure, not just the already-applied case. A changed or corrupted source can therefore produce a binary without the DCE ping fix, whose patch explicitly prevents a busy-spin path; accept only a successful forward or already-applied reverse check.</violation>
</file>

<file name="model/dce-signal.cc">

<violation number="1" location="model/dce-signal.cc:120">
P2: `dce_sigwait` can consume both a thread-directed and process-directed instance of the same signal. Remove only the pending set that supplied the match, or the other signal is lost.</violation>

<violation number="2" location="model/dce-signal.cc:127">
P1: `dce_sigwait` records a masked signal in `sigwaitSet`, but `dce_pthread_kill` wakes blocked targets only when the signal is unmasked. When an application blocks the signal before `pthread_kill`/`sigwait`, the pending bit never wakes this waiter and `sigwait` can sleep forever; make the thread-directed wake path honor `sigwaitSet`.</violation>
</file>

<file name="model/unix-socket-fd.cc">

<violation number="1" location="model/unix-socket-fd.cc:430">
P2: Reject non-multicast `ipv6mr_multiaddr` values before updating `Ipv6L3Protocol`; Linux returns `EINVAL` for `IPV6_JOIN_GROUP`/`IPV6_LEAVE_GROUP` with an invalid group address.</violation>

<violation number="2" location="model/unix-socket-fd.cc:451">
P2: Joining a group leaves the node subscribed when the DCE socket closes, because `Close` never removes this membership. Track memberships per descriptor and drop them on close, preserving the membership while other descriptors still use the group.</violation>

<violation number="3" location="model/unix-socket-fd.cc:530">
P2: `ICMP6_FILTER` reports success without applying the caller's filter, so applications that block ICMPv6 types still receive those messages. Store the per-socket filter and apply it before queuing raw IPv6 packets.</violation>
</file>

<file name="model/unix-datagram-socket-fd.cc">

<violation number="1" location="model/unix-datagram-socket-fd.cc:305">
P2: An invalid nonzero `IPV6_PKTINFO.ipi6_ifindex` is silently treated as no interface selection, so a link-local send can use a different interface instead of returning `ENODEV` as Linux does. Reject an index greater than `GetNDevices()` before falling back to the zero-index behavior.</violation>

<violation number="2" location="model/unix-datagram-socket-fd.cc:386">
P2: Connected IPv6 sockets ignore `IPV6_PKTINFO` because `outDev` is passed only through `MainSendTo`. Apply the temporary device binding in the `MainSend` path too.</violation>
</file>

<file name="netlink/netlink-attribute.cc">

<violation number="1" location="netlink/netlink-attribute.cc:227">
P1: `start.Read` copies the wire-controlled `remaining` bytes into a fixed-size buffer, but `NS_ASSERT` is the only bound. In optimized builds, a malformed netlink attribute can overwrite the stack; reject or skip oversized payloads before copying.</violation>
</file>

<file name="model/process.h">

<violation number="1" location="model/process.h:143">
P2: Forked processes lose the new fopencookie stream-to-DCE-fd mappings. Copy or rebuild `openStreamFds` when `DceManager::Clone` creates the child, otherwise `dce_fileno` returns `-1` for inherited cookie streams.</violation>
</file>

<file name="model/dce-stdio.cc">

<violation number="1" location="model/dce-stdio.cc:177">
P2: `openStreamFds` entries survive successful `exec`: the exec path closes old streams with `dce_fclose_onexec` instead of `remove_stream` and clears only `openStreams`. Erase each mapping when that path closes a stream, or clear the map after successful exec cleanup, to avoid stale mappings and map growth across repeated execs.</violation>
</file>

<file name="model/ns3-socket-fd-factory.cc">

<violation number="1" location="model/ns3-socket-fd-factory.cc:161">
P2: This shim remains registered after its raw socket closes. Remove it when the last matching raw socket is destroyed; otherwise later packets for that protocol are silently consumed instead of receiving normal ICMPv6 unknown-protocol handling.</violation>
</file>

<file name="model/ipv4-dce-routing.cc">

<violation number="1" location="model/ipv4-dce-routing.cc:73">
P2: A matching static multicast route bypasses the new local-delivery path, so raw-socket routing daemons still miss those packets. Keep multicast local delivery alongside multicast forwarding, rather than making it conditional on the base `RouteInput` returning false.</violation>

<violation number="2" location="model/ipv4-dce-routing.cc:83">
P2: This branch claims every multicast packet after local delivery, preventing any lower-priority routing protocol from forwarding or handling it. Preserve `false` for multicast packets that DCE cannot route, or restrict this local-delivery path to multicast traffic that DCE explicitly owns.</violation>
</file>

Reply to a comment to ask cubic a question or push back. It learns from your replies.

View guided diff | Re-trigger cubic

Comment thread model/dce.cc
ResetGetoptIfOtherProcess (Process *process)
{
static Process *lastProcess = 0;
if (!process->getoptStarted || (lastProcess != process && optind <= 1))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This condition does not isolate glibc’s hidden cluster state between processes. optind == 1 can mean that a process is midway through -abc, while optind > 1 still leaves another process’s __nextchar active, causing options to be returned from the wrong argv or clusters to repeat; preserve per-process parser state or use a reentrant getopt implementation.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At model/dce.cc, line 458:

<comment>This condition does not isolate glibc’s hidden cluster state between processes. `optind == 1` can mean that a process is midway through `-abc`, while `optind > 1` still leaves another process’s `__nextchar` active, causing options to be returned from the wrong argv or clusters to repeat; preserve per-process parser state or use a reentrant getopt implementation.</comment>

<file context>
@@ -446,6 +446,23 @@ const char * dce_inet_ntop (int af, const void *src,
+ResetGetoptIfOtherProcess (Process *process)
+{
+  static Process *lastProcess = 0;
+  if (!process->getoptStarted || (lastProcess != process && optind <= 1))
+    {
+      optind = 0;
</file context>

fetch_tar "https://sourceforge.net/projects/iperf/files/iperf-${IPERF_VERSION}.tar.gz/download" "iperf-${IPERF_VERSION}"
(
cd "${SRC}/iperf-${IPERF_VERSION}"
patch -p1 -N -s < "${DCE_DIR}/utils/iperf_4_dce.patch" || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The script treats any patch failure as success, so an upstream source-layout change produces an unpatched binary instead of stopping. Distinguish an already-applied patch from a genuine failure and abort when neither state applies.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At utils/build_kernel_deps.sh, line 130:

<comment>The script treats any patch failure as success, so an upstream source-layout change produces an unpatched binary instead of stopping. Distinguish an already-applied patch from a genuine failure and abort when neither state applies.</comment>

<file context>
@@ -0,0 +1,200 @@
+fetch_tar "https://sourceforge.net/projects/iperf/files/iperf-${IPERF_VERSION}.tar.gz/download" "iperf-${IPERF_VERSION}"
+(
+    cd "${SRC}/iperf-${IPERF_VERSION}"
+    patch -p1 -N -s < "${DCE_DIR}/utils/iperf_4_dce.patch" || true
+    ./configure -q CFLAGS="-g -fPIC ${LEGACY_CFLAGS}" CXXFLAGS="-g -fPIC -U_FORTIFY_SOURCE" \
+        LDFLAGS="-pie -rdynamic" > /dev/null
</file context>

cp "${SRC}/iperf-${IPERF_VERSION}/src/iperf" "${BIN_DCE}/"

echo "== thttpd ${THTTPD_VERSION}"
fetch_tar "http://www.acme.com/software/thttpd/thttpd-${THTTPD_VERSION}.tar.gz" "thttpd-${THTTPD_VERSION}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This downloads source over plain HTTP without an integrity check, allowing a network attacker to inject code into the DCE binary built by CI or a developer. Use a trusted HTTPS source and verify a pinned archive digest before extraction.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At utils/build_kernel_deps.sh, line 138:

<comment>This downloads source over plain HTTP without an integrity check, allowing a network attacker to inject code into the DCE binary built by CI or a developer. Use a trusted HTTPS source and verify a pinned archive digest before extraction.</comment>

<file context>
@@ -0,0 +1,200 @@
+cp "${SRC}/iperf-${IPERF_VERSION}/src/iperf" "${BIN_DCE}/"
+
+echo "== thttpd ${THTTPD_VERSION}"
+fetch_tar "http://www.acme.com/software/thttpd/thttpd-${THTTPD_VERSION}.tar.gz" "thttpd-${THTTPD_VERSION}"
+(
+    cd "${SRC}/thttpd-${THTTPD_VERSION}"
</file context>

Comment thread model/dce-signal.cc
return 0;
}
}
current->sigwaitSet = *set;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: dce_sigwait records a masked signal in sigwaitSet, but dce_pthread_kill wakes blocked targets only when the signal is unmasked. When an application blocks the signal before pthread_kill/sigwait, the pending bit never wakes this waiter and sigwait can sleep forever; make the thread-directed wake path honor sigwaitSet.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At model/dce-signal.cc, line 127:

<comment>`dce_sigwait` records a masked signal in `sigwaitSet`, but `dce_pthread_kill` wakes blocked targets only when the signal is unmasked. When an application blocks the signal before `pthread_kill`/`sigwait`, the pending bit never wakes this waiter and `sigwait` can sleep forever; make the thread-directed wake path honor `sigwaitSet`.</comment>

<file context>
@@ -106,13 +106,27 @@ int dce_sigwait (const sigset_t *set, int *sig)
+              return 0;
+            }
+        }
+      current->sigwaitSet = *set;
+      current->process->manager->Wait ();
+    }
</file context>

Comment on lines +227 to +243
NS_ASSERT (remaining <= Address::MAX_SIZE);
start.Read (buf, remaining);
if (remaining == 4)
{
m_address = Ipv4Address::Deserialize (buf);
}
else if (remaining == 16)
{
m_address = Ipv6Address::Deserialize (buf);
}
else if (remaining == 6)
{
Mac48Address mac;
mac.CopyFrom (buf);
m_address = mac;
}
len = remaining;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: start.Read copies the wire-controlled remaining bytes into a fixed-size buffer, but NS_ASSERT is the only bound. In optimized builds, a malformed netlink attribute can overwrite the stack; reject or skip oversized payloads before copying.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At netlink/netlink-attribute.cc, line 227:

<comment>`start.Read` copies the wire-controlled `remaining` bytes into a fixed-size buffer, but `NS_ASSERT` is the only bound. In optimized builds, a malformed netlink attribute can overwrite the stack; reject or skip oversized payloads before copying.</comment>

<file context>
@@ -223,8 +223,24 @@ NetlinkAttributeValue::DeserializeWithType (Buffer::Iterator& start,
-      ReadFrom (start, m_address, remaining);
-      len = m_address.GetLength ();
+      uint8_t buf[Address::MAX_SIZE];
+      NS_ASSERT (remaining <= Address::MAX_SIZE);
+      start.Read (buf, remaining);
+      if (remaining == 4)
</file context>
Suggested change
NS_ASSERT (remaining <= Address::MAX_SIZE);
start.Read (buf, remaining);
if (remaining == 4)
{
m_address = Ipv4Address::Deserialize (buf);
}
else if (remaining == 16)
{
m_address = Ipv6Address::Deserialize (buf);
}
else if (remaining == 6)
{
Mac48Address mac;
mac.CopyFrom (buf);
m_address = mac;
}
len = remaining;
if (remaining <= Address::MAX_SIZE)
{
start.Read (buf, remaining);
if (remaining == 4)
{
m_address = Ipv4Address::Deserialize (buf);
}
else if (remaining == 16)
{
m_address = Ipv6Address::Deserialize (buf);
}
else if (remaining == 6)
{
Mac48Address mac;
mac.CopyFrom (buf);
m_address = mac;
}
}
else
{
start.Next (remaining);
}
len = remaining;

result = -1;
manager->ExecOnMain (MakeEvent (&UnixDatagramSocketFd::MainSendTo,
this, &result, packet, flags, ad));
this, &result, packet, flags, ad, outDev));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Connected IPv6 sockets ignore IPV6_PKTINFO because outDev is passed only through MainSendTo. Apply the temporary device binding in the MainSend path too.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At model/unix-datagram-socket-fd.cc, line 386:

<comment>Connected IPv6 sockets ignore `IPV6_PKTINFO` because `outDev` is passed only through `MainSendTo`. Apply the temporary device binding in the `MainSend` path too.</comment>

<file context>
@@ -356,7 +383,7 @@ UnixDatagramSocketFd::DoSendmsg (const struct msghdr *msg, int flags)
           result = -1;
           manager->ExecOnMain (MakeEvent (&UnixDatagramSocketFd::MainSendTo,
-                                          this, &result, packet, flags, ad));
+                                          this, &result, packet, flags, ad, outDev));
         }
       else
</file context>

Ptr<Ipv6L3Protocol> ipv6 = GetObject<Ipv6L3Protocol> ();
if (ipv6 && protocol > 0 && !ipv6->GetProtocol (protocol))
{
ipv6->Insert (CreateObject<DceIpv6RawOnlyProtocol> (protocol));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This shim remains registered after its raw socket closes. Remove it when the last matching raw socket is destroyed; otherwise later packets for that protocol are silently consumed instead of receiving normal ICMPv6 unknown-protocol handling.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At model/ns3-socket-fd-factory.cc, line 161:

<comment>This shim remains registered after its raw socket closes. Remove it when the last matching raw socket is destroyed; otherwise later packets for that protocol are silently consumed instead of receiving normal ICMPv6 unknown-protocol handling.</comment>

<file context>
@@ -121,9 +155,22 @@ Ns3SocketFdFactory::CreateSocket (int domain, int type, int protocol)
+            Ptr<Ipv6L3Protocol> ipv6 = GetObject<Ipv6L3Protocol> ();
+            if (ipv6 && protocol > 0 && !ipv6->GetProtocol (protocol))
+              {
+                ipv6->Insert (CreateObject<DceIpv6RawOnlyProtocol> (protocol));
+              }
           } break;
</file context>

Comment thread model/ipv4-dce-routing.cc
{
NS_LOG_FUNCTION (this << p << header << idev);

if (Ipv4StaticRouting::RouteInput (p, header, idev, ucb, mcb, lcb, ecb))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: A matching static multicast route bypasses the new local-delivery path, so raw-socket routing daemons still miss those packets. Keep multicast local delivery alongside multicast forwarding, rather than making it conditional on the base RouteInput returning false.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At model/ipv4-dce-routing.cc, line 73:

<comment>A matching static multicast route bypasses the new local-delivery path, so raw-socket routing daemons still miss those packets. Keep multicast local delivery alongside multicast forwarding, rather than making it conditional on the base `RouteInput` returning false.</comment>

<file context>
@@ -63,6 +63,29 @@ Ipv4DceRouting::~Ipv4DceRouting ()
+{
+  NS_LOG_FUNCTION (this << p << header << idev);
+
+  if (Ipv4StaticRouting::RouteInput (p, header, idev, ucb, mcb, lcb, ecb))
+    {
+      return true;
</file context>

Comment thread model/ipv4-dce-routing.cc
// listen on raw sockets for groups like 224.0.0.5, receive it.
if (header.GetDestination ().IsMulticast () && !lcb.IsNull ())
{
lcb (p, header, m_ipv4->GetInterfaceForDevice (idev));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This branch claims every multicast packet after local delivery, preventing any lower-priority routing protocol from forwarding or handling it. Preserve false for multicast packets that DCE cannot route, or restrict this local-delivery path to multicast traffic that DCE explicitly owns.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At model/ipv4-dce-routing.cc, line 83:

<comment>This branch claims every multicast packet after local delivery, preventing any lower-priority routing protocol from forwarding or handling it. Preserve `false` for multicast packets that DCE cannot route, or restrict this local-delivery path to multicast traffic that DCE explicitly owns.</comment>

<file context>
@@ -63,6 +63,29 @@ Ipv4DceRouting::~Ipv4DceRouting ()
+  // listen on raw sockets for groups like 224.0.0.5, receive it.
+  if (header.GetDestination ().IsMulticast () && !lcb.IsNull ())
+    {
+      lcb (p, header, m_ipv4->GetInterfaceForDevice (idev));
+      return true;
+    }
</file context>

Comment thread model/dce-signal.cc
Comment on lines +120 to +121
sigdelset (&current->pendingSignals, s);
sigdelset (&current->process->pendingSignals, s);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: dce_sigwait can consume both a thread-directed and process-directed instance of the same signal. Remove only the pending set that supplied the match, or the other signal is lost.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At model/dce-signal.cc, line 120:

<comment>`dce_sigwait` can consume both a thread-directed and process-directed instance of the same signal. Remove only the pending set that supplied the match, or the other signal is lost.</comment>

<file context>
@@ -106,13 +106,27 @@ int dce_sigwait (const sigset_t *set, int *sig)
+          if (sigismember (&current->pendingSignals, s) == 1
+              || sigismember (&current->process->pendingSignals, s) == 1)
+            {
+              sigdelset (&current->pendingSignals, s);
+              sigdelset (&current->process->pendingSignals, s);
+              sigemptyset (&current->sigwaitSet);
</file context>
Suggested change
sigdelset (&current->pendingSignals, s);
sigdelset (&current->process->pendingSignals, s);
if (sigismember (&current->pendingSignals, s) == 1)
{
sigdelset (&current->pendingSignals, s);
}
else
{
sigdelset (&current->process->pendingSignals, s);
}

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants