A router answers for every address it holds, on the port the request arrived on (#1223) #1368

Merged
jaylouisw merged 1 commit from fix/address-answers-any-port into main 2026-11-10 18:39:44 +00:00
Owner

Ported from GitHub PR #1280, which was authored before the 2026-11-09 migration, never rebased, and has sat
open since. Closes #1223.

The defect

An ICMP echo addressed to an address the router holds on another port was answered out of the port that owns
the address, not the port the request arrived on. When that port has no cable — the normal case when the request
comes from the far side of the box — the reply went nowhere and the host saw silence. From the host it looked as
if the router did not hold the address at all:

pc1> ping 10.0.2.1          # held on Gi0/1, asked for on Gi0/0
....                        # 0/4, no reply

ownsIpOn() answers will I serve this address on this interface. Delivery needs do I hold it at all, asked
first — the function conflated the two.

The fix

  • Device.holdsIp(ip) — the stack-ownership question, distinct from ownsIpOn()'s service question.
  • _handleLocalIp() replies out of the ingress interface, which is the way back to the sender. A tagged
    subinterface keeps its exception: the request arrived tagged on the parent port, so the subinterface replies.

Ported onto today's main rather than merged as-is: the branch carries two days of drift, and the rebase needed
one hand resolution where main had since added macForIp() for VRRP virtual MACs — both methods now exist.

Evidence

test/address-ownership.test.js — 24 checks: a router holds its own addresses on every port, the far-side
address answers, the reply leaves the port the request arrived on, a tagged child keeps its encapsulation, and the
negative cases (an address the box does not hold is still forwarded, not answered).

  • reverting the engine/simulator.js hunk → 2 of 24 fail (out of the port the request arrived on (expected "Gi0/0", got "Gi0/1"))
  • VRRP unaffected: vrrp 94/94, vrrp-in-path 49/49, show-vrrp-election 27/27, routes-agreement 19/19,
    flow 91/91

Suite: 187 suites, 7,235 assertions, 0 failed. Syntax: 255 files, OK.

Ported from GitHub PR #1280, which was authored before the 2026-11-09 migration, never rebased, and has sat open since. Closes #1223. ## The defect An ICMP echo addressed to an address the router holds on **another** port was answered out of the port that owns the address, not the port the request arrived on. When that port has no cable — the normal case when the request comes from the far side of the box — the reply went nowhere and the host saw silence. From the host it looked as if the router did not hold the address at all: ``` pc1> ping 10.0.2.1 # held on Gi0/1, asked for on Gi0/0 .... # 0/4, no reply ``` `ownsIpOn()` answers *will I serve this address on this interface*. Delivery needs *do I hold it at all*, asked first — the function conflated the two. ## The fix * `Device.holdsIp(ip)` — the stack-ownership question, distinct from `ownsIpOn()`'s service question. * `_handleLocalIp()` replies out of the **ingress** interface, which is the way back to the sender. A tagged subinterface keeps its exception: the request arrived tagged on the parent port, so the subinterface replies. Ported onto today's `main` rather than merged as-is: the branch carries two days of drift, and the rebase needed one hand resolution where `main` had since added `macForIp()` for VRRP virtual MACs — both methods now exist. ## Evidence `test/address-ownership.test.js` — **24 checks**: a router holds its own addresses on every port, the far-side address answers, the reply leaves the port the request arrived on, a tagged child keeps its encapsulation, and the negative cases (an address the box does not hold is still forwarded, not answered). * reverting the `engine/simulator.js` hunk → **2 of 24 fail** (`out of the port the request arrived on (expected "Gi0/0", got "Gi0/1")`) * VRRP unaffected: `vrrp` 94/94, `vrrp-in-path` 49/49, `show-vrrp-election` 27/27, `routes-agreement` 19/19, `flow` 91/91 Suite: **187 suites, 7,235 assertions, 0 failed**. Syntax: 255 files, OK.
A router answers for every address it holds, on the port the request arrived on (#1223)
All checks were successful
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 17s
CI / Test (Node 20) (pull_request) Successful in 2m55s
CI / Test (Node 18) (pull_request) Successful in 3m4s
CI / Server smoke test (pull_request) Successful in 33s
CI / Docker build (pull_request) Successful in 52s
CI / Test (Node 22) (pull_request) Successful in 2m30s
baa2b2e420
Ported from the long-open GitHub PR #1280, which was authored before the migration and never rebased.

The defect: an ICMP echo addressed to an address the router holds on *another* port was answered
out of the port that owns the address, not the port the request arrived on. When that port has no
cable — the normal case when the request comes from the far side of the box — the reply went nowhere
and the host saw silence. From the host it looked as if the router did not hold the address at all.

Two changes:

* Device.holdsIp(ip) asks the stack-ownership question - does this device hold the address, on any
  interface - as distinct from ownsIpOn()'s "will I serve it on this interface". Forwarding has to
  ask the first question first.
* _handleLocalIp() replies out of the ingress interface, which is the way back to the sender. A
  tagged subinterface keeps its exception: the request arrived tagged on the parent port, so the
  subinterface replies.

Evidence: test/address-ownership.test.js, 24 checks. With the simulator hunk reverted, 2 fail -
out of the port the request arrived on (expected Gi0/0, got Gi0/1).

Suite: 187 suites, 7,235 assertions, 0 failed. Syntax: 255 files, OK.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-10 18:39:39 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1368
No description provided.