Submitted:
01 November 2026
Posted:
03 November 2026
You are already at the latest version
Abstract
Routing entries can influence route discovery even after their forwarding paths have failed. We study a loop-prevention guard in ns-3.47 Ad hoc On-Demand Distance Vector (AODV) routing that suppresses a request when its sender matches the next hop of an existing destination entry. Retained INVALID entries can trigger this guard. In a four-node counterexample formed through ordinary protocol events, exempting only INVALID entries changes main-flow delivery from 0/95 to 95/95 packets, with a 14.5 ms first-arrival wait. A 24-run matrix separates retention from deletion, cold start, and a second topology. Isolated request-handler tests confirm the branch boundary, while temporal regressions distinguish the targeted exemption from removing the protection entirely: a constructed reverse-dependence test produces an active route cycle and packet return only without the guard. Across six 25-node environments with 5985 offered packets each, delivery improves in four, remains unchanged in one, and decreases by 56 packets in one. The negative case localizes losses to address resolution on a shared path prefix. The study identifies a state-dependent discovery failure and shows why its local repair must be assessed together with protective checks and network-level effects.
Keywords:
ad hoc networks
; AODV
; route discovery
; routing state
; network simulation
; regression testing
1. Introduction
On-demand routing protocols discover paths only when traffic requires them, and much of what the community knows about their behavior comes from discrete-event simulation. In studies of wireless ad hoc networks, the ns-3 simulator [1] is a standard substrate for comparing routing protocols on delivery statistics; a recent FANET study in this journal, for example, evaluates routing options in ns-3 against AODV baselines through packet-delivery ratios and latency [2]. Such comparisons take it for granted that the protocol implementation inside the simulator behaves as the specification intends. We examine how a retained route entry can affect discovery after the route has failed, and trace the consequences from the request handler to network-wide delivery.
Ad hoc On-Demand Distance Vector (AODV) routing [3] maintains a routing table whose entries are not simply present or absent. When a route breaks or its lifetime expires, the entry is not immediately deleted: it is marked invalid and retained for a bounded time before being purged, so that sequence-number bookkeeping and route error (RERR) processing can still refer to it [3]. Although an invalid entry is ineligible for data forwarding and intermediate replies, its sequence number and other historical fields remain available to the protocol.
In ns-3’s AODV implementation, one such consumer is a request-suppression guard. Added at the end of 2010 as a fix for a loop formed through request processing [4], the guard drops an incoming route request (RREQ) when the neighbor from which the request arrived matches the next hop of a route entry returned by the route lookup for the requested destination. For a usable route, this condition plausibly signals a loop in the making. The lookup feeding the guard does not filter out retained invalid entries; it returns their state, but the guard does not use that state. As a result, state left behind by ordinary protocol history—a route that was formed, broke, and was invalidated but not yet purged—can cause a node to discard requests for a destination that is reachable again. The network may be geometrically connected, the destination may be one hop away from a forwarder, and discovery still fails.
This paper addresses three research questions regarding that interaction: (RQ1) how exactly a retained INVALID entry blocks a new discovery; (RQ2) which state boundaries decide the effect, separating retention itself from invalidation history; and (RQ3) what the safety regression boundaries and network-wide consequences of a local exemption are.
We identify a route-discovery failure in ns-3.47 AODV and show how ordinary protocol events create the retained state that triggers it. A targeted INVALID-only exemption isolates the failure, while deletion, cold-start, and second-topology controls establish when it occurs. Real-handler fixtures and temporal regressions distinguish this exemption from removing the guard. Finally, paired comparisons across all six 25-node environments trace the consequences beyond the changed branch, including a negative delivery outcome whose losses on the affected flow are largely localized to address resolution.
2. Background and Related Work
2.1. AODV Route-Entry States and Retained Invalid State
AODV discovers routes on demand: a source broadcasts an RREQ, and either the destination or an intermediate node with a sufficiently fresh active route returns a route reply (RREP) [3]. Every routing-table entry carries a destination, a next hop, a hop count, a sequence number, and a lifetime. The specification distinguishes between an entry’s existence and its usability: a node may answer a RREQ from its table only if it has an active route with a destination sequence number that is not older than the one carried in the request [3]. When a route breaks or its lifetime expires, the entry is invalidated and then deleted after a bounded interval; while invalidated it can still participate in RERR generation and sequence-number bookkeeping, but is ineligible for data forwarding or intermediate replies [3].
The ns-3 implementation mirrors this distinction with three route flags, which we write as the formal state names VALID, INVALID, and IN_SEARCH. A VALID entry is usable; an INVALID entry is retained but unusable, and is eventually removed by a purge; an IN_SEARCH entry records a discovery in progress. The crucial point for this paper is that the implementation’s routing-table lookup returns INVALID entries as well as VALID ones, together with a validity marker. Whether the caller uses that marker decides the semantics: for forwarding and replying, invalid entries are filtered out; for the guard examined here, they are not.
2.2. The 2010 Same-Next-Hop Guard in ns-3
The guard at the center of this study was added to ns-3’s AODV request-processing code in December 2010, motivated by a report that a route loop could be formed through RREQ processing [4]. The change is eight lines: after the routing-table lookup for the requested destination, the handler unconditionally returns if the stored next hop equals the neighbor from which the RREQ arrived. The guard is still present in the current development tree and was present in release 3.19 [5]; the version examined here is ns-3.47.
The lookup also returns retained INVALID entries, allowing the guard to act on a route that is already unusable. A source-level comparison with INET’s AODV model illustrates another way to qualify the check: there, the same-next-hop return lies inside an active-route branch that also requires a valid sequence number and freshness [6]. This static comparison helps distinguish the state predicates. Our intervention changes just the INVALID case in ns-3, retaining its existing sequence-number and reply rules.
2.3. Verification, Implementation Testing, and the Position of This Study
AODV verification provides important context for this state boundary. The untimed AWN model supports loop-freedom and route-correctness results under a model that abstracts from route expiry [7]. Sequence-number monotonicity alone is insufficient to establish loop freedom across plausible interpretations of AODV [8]. Time has also been studied explicitly: Chiyangwa and Kwiatkowska analyze AODV timing and route lifetimes using UPPAAL [9]; Bres et al. introduce T-AWN, including invalid-route retention and deletion, and exhibit routing loops associated with premature expiry [10]. Our study examines a complementary effect: an invalid entry suppresses route discovery while it is still retained, through a specific branch in the ns-3 implementation.
At the implementation level, automated adversarial testing of unmodified routing implementations has shown that narrow, implementation-specific conditions can have real consequences: a campaign over five protocol implementations found dozens of attack behaviors and a small number of benign bugs, including two in an AODV implementation arising from kernel notification ordering [11]. Its benign implementation findings also illustrate the value of testing event ordering across protocol interfaces. Network-simulator conformance has also been examined through metamorphic testing. Chen et al. test an OMNeT++ AODV implementation using relations between executions, including a relation that deletes routing-table entries and requests rediscovery [12]. The present deletion control has a related purpose, but it is paired with a normally formed retained-state counterexample, a branch-specific intervention, and observed system-level side effects. Quantitative temporal verification in other simulation domains likewise emphasizes that model behavior is itself an object of validation [13].
These studies motivate testing both protocol state and its implementation. We connect the two through a naturally formed retained entry, a targeted change to the request handler, and controls that follow the effect from discovery to packet delivery.
3. Materials and Methods
3.1. Implementation Subject and Protocol Versions
All experiments use ns-3.47 [1] with its AODV implementation, operated over IEEE 802.11g ad hoc mode with quality-of-service extensions disabled. Three behavior variants were used, differing in exactly one condition:
- stock: the original behavior with observation instrumentation;
- INVALID-only: the same-next-hop guard is skipped when, and only when, the route lookup returns an INVALID entry. The guard remains in force for VALID and IN_SEARCH entries; destination sequence-number processing is unchanged; and INVALID entries remain ineligible to generate intermediate RREPs;
- no-guard: the entire guard is removed. This variant was used only in the temporal regression (Section 3.5) to separate the role of the entire guard from that of its state qualification.
The paired delivery and control-cost comparisons use common application and PPDU observations. Additional routing-state, packet-path, and lifecycle traces diagnose particular experiments. The minimal paired scenarios use matching observation code, and their main-flow prehistories agree before the changed branch. Table 1 summarizes the common simulation configuration; expanded settings are provided in Supplementary Table S2.
3.2. Naturally Formed State in a Four-Node Scenario
The core scenario uses four nodes, labeled S, B, C, and D (nodes 0–3). S, B, and C are static at , , and ; D starts at , remains there until 10 s, and then moves along a fixed trace to at s, at s, and at s, remaining there until the end of the 45 s run. This constructed regression trace uses segment speeds of 35–70 m/s to produce the required route break and subsequent reconnection. The run has two phases:
- a warm-up flow from B to D (40 packets), which is delivered along B→S→D and installs valid entries for D at B (two hops via S) and at S (one hop);
- a main flow from S to D (95 packets) starting at s.
After D’s move, the direct S–D link is gone and the reachable path to D is S→B→C→D. At the moment of the main flow’s first route request ( s), node B still holds the warm-up entry for D: INVALID, two hops, old next hop S (the requesting neighbor), destination sequence number 0, and 8.56 s of retained lifetime remaining. All routing-table states in this scenario arise from the protocol’s own history. Figure 1 shows both phases; its arrows show observed routes, not the full set of wireless adjacencies.
3.3. Retention-Window Controls
To separate the effect of retained state from ordinary wireless loss, four conditions were run in a common 60 s window-matrix format with a 4-packet main task: retention (request at s, during the retained INVALID window), after deletion (request at s, after the observed purge deletion of the entry), cold start (no warm-up traffic; no destination entry for D at request time), and a second motif (a five-node detour topology that satisfies the same retained-state condition: at request time the entry is INVALID and its old next hop is the requesting neighbor). Each condition was run under three paired random runs (global seed 20261030, run indices 1–3; paired stock and INVALID-only runs share the run index and all inputs) for both implementations: whole simulations. Figure 2 places each request against the measured invalidation and purge events. The paired run is the unit of analysis; its four main-task packets share the same discovery history.
3.4. Real-Handler Fixtures with Controlled Routing State
To test the local obligations of the exemption without wireless effects, 99 controlled routing-table cases were replayed per implementation (198 invocations in total), each invoking the real ns-3.47 AODV request-reception handler with an injected table state and request parameters. The handler is invoked after a 1 ns initialization step, without advancing the resulting wireless events. The main matrix crosses three route states (VALID, INVALID, IN_SEARCH), two next-hop relationships, four request sequence-number conditions, two destination-only flag values, and two TTL values, giving cases per implementation. The stored sequence number is 10; request conditions are unknown (number field 0), older (9), equal (10), and newer (11). Three additional cases, one for each route state, keep an entry present but mark its stored sequence number unknown; they use the same next hop, request sequence 9, destination-only flag 0, and TTL 2. Expected and observed branches are recorded for every case in Supplementary Table S1.
3.5. Staged Temporal Safety Regression
Whether the exemption preserves the guard’s protective effect was tested in four staged conditions, each run once per implementation (12 runs):
- L (natural RERR): the four-node scenario of Section 3.2, in which the entry at B is invalidated by a route error after movement and the request falls inside the retained window;
- E (intended expiry): a variant constructed so that the entry at B should be invalidated by lifetime expiry rather than by a route error. In all three runs, an actual RERR preceded the intended expiry, so the intended precondition failed qualification; the case is retained as failed and is not counted as a pass;
- E2 (natural purge): a variant in which the entry at B expired naturally—no route error for the destination occurred—at s, and the same INVALID entry (old next hop S, sequence number 0) was observed continuously, through 43 consecutive table snapshots, up to the request at s;
- P (artificial perturbation): after warm-up traffic, only the source’s entry is set INVALID by an in-table perturbation (state and lifetime change only), and the destination is moved out of reach. This is the hazard configuration in which the guard’s protection is expected to matter.
Route-table snapshots are recorded at instrumented mutation-event boundaries, coalesced at a simulation timestamp, without an additional route lookup or purge. They describe event-boundary states rather than transient states inside a handler. An active edge requires both a VALID flag and an unexpired lifetime; following these destination-specific next-hop edges detects an active route cycle. Data return is a separate observation: the same IP/application packet identity must revisit an earlier transmitting node, with its TTL recorded. MAC retransmissions are not counted as path returns. P tests the guard’s reverse-dependence rationale with a controlled perturbation; the historical commit [4] supplies its safety motivation.
3.6. Six Pre-Existing Environments and Metrics
The system-level comparison evaluates six established 25-node environments: three fixed-trace environments (original 1–3) and three random-waypoint environments (RWP 1–3), each with five application flows and 5985 planned packets in the active window s. The original-trace family starts from a grid with 70 m spacing and independent coordinate jitter of up to 12 m every 10 s. The RWP family uses a m domain, uniformly sampled speeds of 1–3 m/s, and a 2 s pause. Each trace uses a 210 s segment after a fixed 1000 s burn-in. The five source–destination pairs are 0–24, 4–24, 5–19, 9–15, and 10–12. All six environments were included in the comparison. Each environment was run as a pair—stock and INVALID-only on identical inputs and the same run index. Subsequent random draws need not remain aligned event by event once the executions diverge. Application and PPDU observations are symmetrically recorded for all paired runs; additional intermediate-data traces are asymmetric in the six-environment comparison and matched in the minimal paired scenarios. The per-execution configurations and trace logs are retained with the experimental records.
Three metrics were computed from per-packet ledgers. Delivered-set difference: for each environment, the gained deliveries are (flow, sequence) pairs received by the variant but not by stock, and the lost deliveries are pairs received by stock but not by the variant; the net change is gained minus lost. First-arrival wait: the delay from a flow’s first send attempt to its first delivered packet, measured in diagnostic runs of the four-node scenario and the retention motifs. Control transmit cost: the sum of actual AODV PPDU transmit durations per node within the active window, including HELLO frames. Because these durations are summed across nodes, they do not represent channel busy time. Route-request forwarding is associated with its scheduling event using the origin, request identifier, node, timestamp, and event order. An ambiguous association is left unresolved rather than assigned to the most recent received duplicate.
For the four-node counterexample, we additionally rebuilt both variants from a fresh ns-3.47 source tree and compared their application, control, and routing observations with the original executions. A further stock execution adds read-only queue-drop observation to identify packet eviction and retry-exhaustion losses. These executions validate and instrument the same fixed scenario; they are not additional independent mobility samples. The reproduction records identify the source archive, build commands, and trace comparisons.
4. Results
4.1. Retained INVALID State Suppresses Rediscovery of a Reachable Destination
In the four-node scenario, the warm-up phase is identical for the two implementations: all 40 warm-up packets are delivered along B→S→D, and the control-event prefix up to the first diverging branch is identical. The main flow then diverges completely. Stock delivers 0 of 95 packets. INVALID-only delivers 95 of 95, with the first packet arriving 14.531 ms after the main flow’s first send attempt (Figure 1).
The mechanism is the one described in Section 3.2: S broadcasts a RREQ for D; the request reaches B from S; B’s lookup for D returns the retained INVALID entry, whose old next hop is S, the sending neighbor; the guard returns before B can forward the request. The blocked request does not reach C, despite the available S→B→C→D path. Exempting INVALID entries from the guard lets B forward the request, and discovery completes.
The complete task timeline explains why a finite retention period can affect all 95 packets (Table 2; Supplementary Table S3). Packets are emitted every 0.1 s from 18.5 to 27.9 s. All five stock RREQ transmissions occur before B deletes the retained entry at 27.073 s, and B rejects each at the same guard. Deletion therefore does not retroactively rescue this discovery attempt: the source remains IN_SEARCH until retry exhaustion at 28.58 s, after the last application packet has arrived. No later packet initiates a new search in this task.
The original trace records 95 source-side IPv4 route-error drops. A supplemental reproduction with read-only queue-drop observation resolves their causes: packets 0–30 are evicted as the oldest entries when the 64-packet FIFO fills, at 0.1 s intervals from 24.9 to 27.9 s; the remaining packets 31–94 are dropped together when discovery exhausts its retries at 28.58 s. This explains how the initial discovery suppression propagates through buffering to the entire finite task.
The same interaction appears in a larger scenario in the original 25-node environment 1, which serves as a larger setting with competing traffic. There, the target flow’s delivery changes from 1099 of 1199 packets to 1187 of 1199 with the exemption (+93 gained, lost, net ), and across all five flows delivery changes from 5854 to 5941 of 5985 (+99 gained, lost, net ). In the localization window of 106–116 s, which contains 100 planned packets, stock delivers 7 and INVALID-only delivers 99. The guard hits are directly observable: the fourth source request, at s, is blocked by the guard at node 3, whose destination entry is INVALID with 9.94 s of retention lifetime remaining and whose next hop equals the sending neighbor; similar guard drops occur at node 8 and for requests 5 and 6. Gains and losses occur in different intervals, showing that the effect extends beyond the first recovered discovery.
4.2. The Effect Is Bound to the Retention Window
Figure 2 shows the stock relay’s actual state history: in all three random runs, the entry at B is invalidated at about s (by a route error after movement), the actual purge deletion occurs between and s, and the main-task request at s falls inside this observed window, while the after-deletion request at s falls outside it.
Figure 3 gives the full 24-run matrix. During retention, stock delivers 0 of 4 main-task packets and INVALID-only delivers 4 of 4, in all three runs of the four-node scenario and in all three runs of the five-node second motif. After deletion, the two implementations deliver identically in every run—4/4, 3/4, and 3/4 under runs 1–3, respectively—so those shared losses are not removed by changing the guard. Cold-start runs deliver 4/4 everywhere for both implementations. All 24 runs passed their state qualification at request time (retained INVALID entry with the requesting neighbor as old next hop in the retention conditions; no entry in the cold-start condition), and the paired runs’ control-event prefixes before the main task were identical.
The 60 s endpoint of these runs is not evidence of permanent failure. In diagnostic runs of the two retention motifs in which discovery proceeds, the first main-task packet is delivered within 14.5–43.9 ms of the first send attempt: the successful discovery completes on a millisecond timescale. Stock’s zero delivery within the window reflects a blocked discovery, not an unreachable destination.
4.3. Local Obligations and Temporal Protection
The handler-level fixtures test what the exemption actually changes (Table 3). Across the 99 paired cases, stock takes the next-hop guard return in 51 cases and INVALID-only in 34; the 17 changed pairs are exactly the INVALID cases in which the stored next hop equals the sender. Of these, 9 become scheduled forwardings and 8 become TTL-limited returns, because the replayed requests carry TTL 2 or 1, respectively. The remaining 82 pairs are unchanged, and the intermediate-RREP count is unchanged at 6 in both implementations: INVALID state never generates an intermediate reply. The boundary is also respected in a real-wireless negative control: in a run that ends with a retained VALID entry whose next hop is the requesting neighbor, the INVALID-only implementation still takes the guard return (an initial test of this scenario experienced a half-duplex reception failure; the run reported here is the subsequent trial that verified the valid entry condition).
In the six INVALID-only environment traces, all 3628 scheduled-parent RREQ associations were resolved without a destination-sequence decrease.
The staged temporal regression (Table 4) distinguishes the effect of the targeted exemption from removing the guard. In L (natural route error), stock delivers 0/95 and both alternatives deliver 95/95, with no active cycle observed in any implementation. E failed its intended precondition in all three runs (an actual RERR preceded the intended expiry); its delivery outcomes (0/95, 95/95, 95/95) are reported but not counted as a qualified expiry scenario, and in this condition the no-guard variant formed an active cycle of 4.000 s without any data returning to a prior transmitter. In E2 (natural purge, qualified), stock delivers 0/4 and both alternatives 4/4, with no active cycle in any variant. In P (artificial perturbation), all three implementations deliver 0/4 because the destination is unreachable by construction—this condition distinguishes hazard behavior, not performance. With the guard removed, an active two-node cycle S↔B forms for 3.119 s and four data packets return to their source, arriving with a decremented TTL (64→63); the source does not re-forward, so the cycle is bounded rather than infinite. Stock and INVALID-only show no such cycle. The protection relevant to P rests on B’s VALID entry, which the INVALID-only exemption does not touch—the guard still fires. P demonstrates the protective effect of retaining the check on VALID routes.
4.4. System-Level Effects Across All Six Environments
Table 5 and Figure 4 report the paired comparison in all six environments; the underlying metrics are provided in Supplementary Table S4. Net delivery changes are , , , , 0, and packets (of 5985 offered). Together, these six fixed comparisons contain 347 gained and 215 lost deliveries, a net increase of 132 packets. RWP 2 has identical delivered sets, although its control-transmission totals differ slightly below the precision shown in the table.
The control-cost panel reports the accompanying transmission changes. Table 5 lists the control-transmission totals alongside delivery. In RWP 3 the number of source route-request attempts rises from 75 to 107, and net delivery falls by 56 packets: this environment exhibits the largest control-cost increase and a negative delivery change.
4.5. Anatomy of the Negative Environment
The RWP 3 losses are concentrated on flow 2 (source 5 to destination 19): 79 sequence numbers are delivered by stock but not by INVALID-only. Figure 5 shows the observed chain. For packet sequence 208, both implementations forward along the same prefix—nodes 5, 16, 10, and 7—but stock continues from node 7 to node 19, whereas INVALID-only stops at node 7: the IP packet is received and then dropped at the address-resolution (ARP) layer, with no data PPDU transmitted onward. The same ARP-layer drop is observed at node 7 for 75 of the 79 lost sequences (208–282); the remaining 4 are unattributed. Node 7’s neighbor-state samples toward node 19 differ between the implementations in this interval: stock shows ALIVE at s, while INVALID-only shows WAIT REPLY at s, DEAD at s, and ALIVE again at s—samples, not a continuous state history.
In RWP 3, the extra request activity coincided with a transient neighbor-loss episode at node 7, during which packets queued for node 19 failed address resolution. The shared path prefix ties the specific losses to the same forwarding location in both implementations, and the ARP-drop ledger ties them to a concrete failure point. These observations locate the losses at address resolution. Distinguishing the preceding transmission-timing and contention effects requires a separate causal intervention.
5. Discussion
5.1. Why Retained State Turns a Protection into an Availability Cost
The same-next-hop condition has different meanings for usable and invalid routes. For a usable route, it records a current dependency on the requesting neighbor; allowing that neighbor to adopt the reverse path can create a cycle. For an INVALID route, it records a dependency left by a path that has already failed. The stock guard treats these two situations alike and can therefore suppress discovery along an available alternative path. Exempting INVALID entries separates this historical dependency from the active one that the protection is intended to detect.
The handler tests establish the exact branch boundary: the exemption changes request handling for INVALID entries while preserving the checks on VALID and IN_SEARCH entries and the existing reply rules. The temporal tests then put that distinction into operation. In the qualified natural RERR and expiry cases (L and E2), the exemption recovers discovery, whereas the perturbation case exposes the reverse dependency created by removing the guard entirely. Retaining the check on the usable route prevents that cycle. These complementary tests explain why changing the state qualification and deleting the protection have different effects.
The larger environments show how recovering a discovery changes subsequent network behavior. Delivery improves in four environments, remains unchanged in one, and decreases in another, alongside changes in request activity and control cost (Table 5). In the negative environment, the ARP observations identify the failure point for most losses on the affected flow. The per-packet comparison connects the local repair to a downstream outcome that the positive aggregate would obscure.
For simulation-based routing studies, the practical implication is to record route-state transitions alongside packet outcomes. Retention and deletion controls distinguish implementation-driven blocking from wireless loss; a hazard case tests the protection served by the original check. Paired packet ledgers then reveal which deliveries are gained or lost after the change. This combination makes a delivery difference explainable at both the routing-handler and network levels.
5.2. Scope and Further Evaluation
The experiments establish the retained-state mechanism in ns-3.47 and isolate its handler and temporal properties. While the rapid movement in the minimal scenarios exposes a reachable state and the six 25-node environments demonstrate its systemic consequences, broader mobility distributions and traffic densities offer opportunities to quantify occurrence frequency across diverse operating regimes. Building on these empirical baselines, formal loop-freedom analysis across sequence-number wraparound and concurrent discoveries represents a valuable direction for future verification.
6. Conclusions
This study identifies retained INVALID routing state as a cause of failed rediscovery in ns-3.47 AODV. Ordinary protocol history creates the blocking condition, and an INVALID-only exemption restores delivery in the four-node counterexample and both retained-state motifs. Deletion and cold-start controls isolate the role of retained INVALID state in the tested same-next-hop configuration, while handler and temporal tests show how the exemption differs from deleting the protection. The six larger environments reveal the accompanying delivery gains, unchanged delivery, and losses. Together, these results demonstrate how an implementation guard interacts with retained INVALID routing state to impact network delivery, providing empirical evidence and methodological guidance for state-aware protocol verification.
Supplementary Materials
The following supporting information can be downloaded at the website of this paper posted on Preprints.org, Table S1: Controlled handler cases; Table S2: Expanded simulation parameters; Table S3: Natural 95-packet event timeline; Table S4: Six-environment delivery and control-cost metrics.
Author Contributions
Conceptualization, X.Z. and S.-C.K.; methodology, X.Z. and G.L.; software, X.Z. and D.W.; validation, X.Z., G.L. and D.W.; formal analysis, X.Z. and S.-C.K.; investigation, X.Z.; resources, S.-C.K.; data curation, D.W.; writing—original draft preparation, X.Z.; writing—review and editing, G.L., D.W. and S.-C.K.; visualization, X.Z. and G.L.; supervision, S.-C.K.; project administration, S.-C.K.
Funding
This research received no external funding.
Data Availability Statement
The core protocol patch is maintained in a private pre-release repository at https://github.com/seongchu-afk/ns3-aodv-retained-invalid. DOI 10.5281/zenodo.23827740 has been reserved for the corresponding unpublished Zenodo record. The supplementary tables provide the controlled cases, parameters, event timeline, and six-environment metrics. The supporting experimental records are retained by the authors.
Acknowledgments
AI-assisted tools were used for manuscript drafting, language editing, and consistency checks of the reported results.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| AODV | Ad hoc On-Demand Distance Vector |
| ARP | Address Resolution Protocol |
| MAC | Media Access Control |
| PHY | Physical layer |
| PPDU | PLCP protocol data unit |
| RERR | Route error |
| RREP | Route reply |
| RREQ | Route request |
| TTL | Time to live |
References
- Riley, G.F.; Henderson, T.R. The ns-3 network simulator. In Modeling and Tools for Network Simulation; Wehrle, K., Güneş, M., Gross, J., Eds.; Springer: Berlin/Heidelberg, Germany, 2010; pp. 15–34. [Google Scholar] [CrossRef]
- Takabatake, K.; Matsuzawa, T. FANET routing protocol for prioritizing data transmission to the ground station. Network 2026, 6, 7. [Google Scholar] [CrossRef]
- Perkins, C.E.; Belding-Royer, E.M.; Das, S.R. RFC 3561; Ad hoc On-Demand Distance Vector (AODV) Routing. Internet Engineering Task Force: Fremont, CA, USA, 2003. [CrossRef]
- Yazawa, Y. Route Loop Is Made from RREQ; Commit 5fc05d268896740eab11e56ba11d8e4a3d1314a4; ns-3 development repository, 2010. Available online: https://gitlab.com/nsnam/ns-3-dev/-/commit/5fc05d268896740eab11e56ba11d8e4a3d1314a4 (accessed on 30 October 2026).
- The ns-3 Network Simulator, Release 3.19: AODV Routing Protocol Source File. Available online: https://www.nsnam.org/docs/release/3.19/doxygen/aodv-routing-protocol_8cc_source.html (accessed on 30 October 2026).
- INET Framework, Version 4.5.4: AODV Source File. Available online: https://raw.githubusercontent.com/inet-framework/inet/v4.5.4/src/inet/routing/aodv/Aodv.cc (accessed on 30 October 2026).
- van Glabbeek, R.; Höfner, P.; Portmann, M.; Tan, W.L. Modelling and verifying the AODV routing protocol. Distrib. Comput. 2016, 29, 279–315. [Google Scholar] [CrossRef]
- van Glabbeek, R.; Höfner, P.; Tan, W.L.; Portmann, M. Sequence numbers do not guarantee loop freedom—AODV can yield routing loops. In Proceedings of the 16th ACM International Conference on Modeling, Analysis and Simulation of Wireless and Mobile Systems (MSWiM ’13), Barcelona, Spain, 3–8 November 2013; pp. 91–100. [Google Scholar] [CrossRef]
- Chiyangwa, S.; Kwiatkowska, M. A timing analysis of AODV. In Formal Methods for Open Object-Based Distributed Systems; LNCS 3535; Springer, 2005; pp. 306–321. [Google Scholar] [CrossRef]
- Bres, E.; van Glabbeek, R.; Höfner, P. A timed process algebra for wireless networks with an application in routing (Extended Abstract). In Programming Languages and Systems; Springer, 2016; Volume LNCS 9632, pp. 95–122. [Google Scholar] [CrossRef]
- Hoque, M.E.; Lee, H.; Potharaju, R.; Killian, C.E.; Nita-Rotaru, C. Automated adversarial testing of unmodified wireless routing implementations. IEEE/ACM Trans. Netw. 2016, 24, 3369–3382. [Google Scholar] [CrossRef]
- Chen, T.Y.; Kuo, F.-C.; Liu, H.; Wang, S. Conformance testing of network simulators based on metamorphic testing technique. In Formal Techniques for Distributed Systems; LNCS 5522; Springer, 2009; pp. 243–248. [Google Scholar] [CrossRef]
- González, A.; Cristiá, M.; Luna, C. Verification of quantitative temporal properties in RealTime-DEVS. Simulation 2025, 101, 1057–1076. [Google Scholar] [CrossRef]
Figure 1.
Route formation and rediscovery in the four-node natural-state scenario. (a) Warm-up traffic from B to D is delivered along B→S→D (40/40 packets in both implementations), installing valid entries at B and S. (b) After D moves along the fixed trace to the position beside C, the reachable path to D is S→B→C→D; at the request, B still retains the warm-up entry for D as INVALID with old next hop S. Arrows show observed routes, not all wireless adjacencies. Stock delivers 0/95 main-task packets; INVALID-only delivers 95/95.
Figure 1.
Route formation and rediscovery in the four-node natural-state scenario. (a) Warm-up traffic from B to D is delivered along B→S→D (40/40 packets in both implementations), installing valid entries at B and S. (b) After D moves along the fixed trace to the position beside C, the reachable path to D is S→B→C→D; at the request, B still retains the warm-up entry for D as INVALID with old next hop S. Arrows show observed routes, not all wireless adjacencies. Stock delivers 0/95 main-task packets; INVALID-only delivers 95/95.

Figure 2.
Stock relay B’s observed retained-entry histories in two separate conditions for each run index. Each pair of bars shows the retained-request and post-deletion-request conditions, not the two implementations. Circles mark observed VALID→INVALID transitions, ticks mark actual purge deletion, and diamonds mark main-task start times (18.5 or 35.5 s). The two conditions share mobility and warm-up inputs but differ in main-task timing; each is separately paired across implementations.
Figure 2.
Stock relay B’s observed retained-entry histories in two separate conditions for each run index. Each pair of bars shows the retained-request and post-deletion-request conditions, not the two implementations. Circles mark observed VALID→INVALID transitions, ticks mark actual purge deletion, and diamonds mark main-task start times (18.5 or 35.5 s). The two conditions share mobility and warm-up inputs but differ in main-task timing; each is separately paired across implementations.

Figure 3.
Main-task delivery across all 24 retention-window runs. Each row pairs the two implementations under one condition (retention, after deletion, cold start, or the five-node second motif) and one run index; cells give delivered main-task packets (of 4) for the stock and INVALID-only implementations. The four packets within a run are not independent replications; each row contains two whole-run outcomes.
Figure 3.
Main-task delivery across all 24 retention-window runs. Each row pairs the two implementations under one condition (retention, after deletion, cold start, or the five-node second motif) and one run index; cells give delivered main-task packets (of 4) for the stock and INVALID-only implementations. The four packets within a run are not independent replications; each row contains two whole-run outcomes.

Figure 4.
Paired impact of the INVALID-only exemption across the six pre-existing 25-node environments (5985 offered packets each). (a) Gained and lost deliveries relative to stock, with the net change per environment (, , , , 0, ). (b) Summed AODV PPDU transmit durations per implementation in the active window s, including HELLO frames. The sums add transmit durations across nodes and are not channel busy time.
Figure 4.
Paired impact of the INVALID-only exemption across the six pre-existing 25-node environments (5985 offered packets each). (a) Gained and lost deliveries relative to stock, with the net change per environment (, , , , 0, ). (b) Summed AODV PPDU transmit durations per implementation in the active window s, including HELLO frames. The sums add transmit durations across nodes and are not channel busy time.

Figure 5.
Observations behind the RWP 3 flow-2 losses. (a) Packet sequence 208 traverses the same node prefix 5→16→10→7 in both implementations; stock continues to node 19, while INVALID-only stops at node 7 with an ARP-layer drop (IP receipt without a data PPDU). (b) Sampled neighbor states of node 7 toward node 19 (observed samples, not interpolated state) and the 75 observed ARP drops at node 7 for sequences 208–282. Four of the 79 lost sequences remain unattributed.
Figure 5.
Observations behind the RWP 3 flow-2 losses. (a) Packet sequence 208 traverses the same node prefix 5→16→10→7 in both implementations; stock continues to node 19, while INVALID-only stops at node 7 with an ARP-layer drop (IP receipt without a data PPDU). (b) Sampled neighbor states of node 7 toward node 19 (observed samples, not interpolated state) and the 75 observed ARP drops at node 7 for sequences 208–282. Four of the 79 lost sequences remain unattributed.

Table 1.
Simulation configuration. Scenario-specific timings distinguish the minimal counterexample, retention controls, and system-level comparisons.
Table 1.
Simulation configuration. Scenario-specific timings distinguish the minimal counterexample, retention controls, and system-level comparisons.
| Parameter | Setting |
|---|---|
| Simulator | ns-3.47 |
| MAC/PHY | IEEE 802.11g, ad hoc mode, QoS disabled |
| PHY rate | fixed 6 Mbit/s (ERP-OFDM) for unicast data, control, and non-unicast frames |
| Channel | 2.4 GHz, channel 1, 20 MHz bandwidth |
| Transmit power | 16 dBm |
| Path loss | log-distance model, exponent 3, reference distance 1 m, reference loss 40.0953 dB |
| Propagation delay | constant-speed model |
| Application packet | 512 bytes (12-byte sequence/timestamp header + 500-byte payload); 0.1 s interval |
| AODV state timers | active-route timeout 3 s; invalid-entry deletion period 15 s; HELLO interval 1 s (disabled in conditions E and P) |
| Discovery and buffering | node traversal time 0.04 s; network diameter 35; two full-diameter attempts; FIFO capacity 64 packets; queue timeout 30 s |
| ARP dead-entry lifetime | 3 s in the network experiments |
| Four-node natural scenario | 45 s; 40-packet warm-up flow; 95-packet main flow starting at s |
| Window-matrix scenarios | 60 s; 4-packet main task at s (retention, cold start, second motif) or s (after deletion) |
| Six-environment scenarios | 25 nodes; 5 flows; 5985 planned packets; 100 ms per-flow packet interval; flows start staggered 0.17 s apart; active window s |
| Random replication | global seed 20261030; run indices 1–3; Wi-Fi stream identifiers allocated from 1000; AODV stream identifiers allocated from 2000 |
Table 2.
Stock execution of the 95-packet task. Times are simulation seconds; repeated request times are IP-layer transmission times, including broadcast jitter. Queue evictions and drops are recorded via supplemental buffer tracing.
Table 2.
Stock execution of the 95-packet task. Times are simulation seconds; repeated request times are IP-layer transmission times, including broadcast jitter. Queue evictions and drops are recorded via supplemental buffer tracing.
| Time | Observed event |
|---|---|
| 12.056 | B’s destination entry becomes INVALID after a route error. |
| 18.500–27.900 | S emits 95 application packets at 0.1 s intervals. |
| 18.500, 18.903, 19.469, 20.181, 22.981 | S sends five RREQs with TTL 3, 5, 7, 35, and 35; B rejects all five while its entry is INVALID. |
| 24.900–27.900 | 31 oldest packets evicted from buffer (sequences 0–30). |
| 27.073 | B purges the retained entry; S is still searching. |
| 28.580 | S’s discovery entry is removed at retry exhaustion. No subsequent application send occurs. |
| 28.580 | Remaining 64 packets dropped at retry exhaustion (sequences 31–94). |
Table 3.
Terminal handler branch for 99 controlled routing-table cases per implementation (198 invocations of the real ns-3.47 AODV request handler; no wireless events advanced). Cases vary the stored route state (VALID, IN_SEARCH, INVALID), whether the stored next hop equals the request sender, the sequence-number relation between entry and request, the destination-only flag, and the TTL.
Table 3.
Terminal handler branch for 99 controlled routing-table cases per implementation (198 invocations of the real ns-3.47 AODV request handler; no wireless events advanced). Cases vary the stored route state (VALID, IN_SEARCH, INVALID), whether the stored next hop equals the request sender, the sequence-number relation between entry and request, the destination-only flag, and the TTL.
| Terminal branch outcome | Stock | INVALID-only |
|---|---|---|
| Blocked by same-next-hop guard | 51 | 34 |
| Dropped by TTL limit | 21 | 29 |
| Scheduled for forwarding | 21 | 30 |
| Intermediate RREP generated | 6 | 6 |
Of the 99 paired cases, 17 change branch (9 to scheduled forwarding, 8 to a TTL-limited drop) and 82 are unchanged; no case yields an intermediate RREP from INVALID state.
Table 4.
Staged temporal safety regression: one run per condition and implementation (12 runs). Delivery is main-task packets delivered/planned. P places the destination out of reach, so its 0/4 outcomes distinguish hazard behavior, not performance; E failed its intended expiry precondition in all three runs and is retained as failed.
Table 4.
Staged temporal safety regression: one run per condition and implementation (12 runs). Delivery is main-task packets delivered/planned. P places the destination out of reach, so its 0/4 outcomes distinguish hazard behavior, not performance; E failed its intended expiry precondition in all three runs and is retained as failed.
| Condition | Stock | INVALID-only | No-guard | Qualification and active-cycle observation |
|---|---|---|---|---|
| L: natural RERR | 0/95 | 95/95 | 95/95 | qualified; no active cycle in any implementation |
| E: intended expiry | 0/95 | 95/95 | 95/95 | failed—an actual RERR preceded the intended expiry; no-guard formed a 4.000 s active cycle with no data return |
| E2: natural purge | 0/4 | 4/4 | 4/4 | qualified; no active cycle in any implementation |
| P: artificial perturbation | 0/4 | 0/4 | 0/4 | qualified artificial fixture; no-guard formed a 3.119 s S↔B cycle with four packets returned to source |
Table 5.
Unique-packet delivery in all six paired environments. Each environment offers 5985 packets. Gained and lost counts compare packet identities; control times sum AODV PPDU durations over transmitting nodes.
Table 5.
Unique-packet delivery in all six paired environments. Each environment offers 5985 packets. Gained and lost counts compare packet identities; control times sum AODV PPDU durations over transmitting nodes.
| Environment | Stock | INVALID-only | Gained | Lost | Net | Control time (s) | |
|---|---|---|---|---|---|---|---|
| Stock | INVALID-only | ||||||
| Original 1 | 5854 | 5941 | 99 | 12 | 0.636 | 0.649 | |
| Original 2 | 5896 | 5933 | 47 | 10 | 0.734 | 0.761 | |
| Original 3 | 5870 | 5925 | 85 | 30 | 0.696 | 0.707 | |
| RWP 1 | 5164 | 5173 | 42 | 33 | 0.674 | 0.758 | |
| RWP 2 | 5945 | 5945 | 0 | 0 | 0 | 0.567 | 0.567 |
| RWP 3 | 5830 | 5774 | 74 | 130 | 0.821 | 1.023 | |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.