Two hosts held one address and nothing said so #1473

Closed
opened 2026-11-12 04:00:01 +00:00 by jaylouisw · 1 comment
Owner

The symptom

Two hosts in one VLAN, both configured 10.0.0.10:

r1> ping 10.0.0.10 4
Type escape sequence to abort.
Sending 4, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds:
!!!!
Success rate is 100 percent (4/4)

r1> show ip arp
Protocol  Address          Age (min)  Hardware Addr     Interface
Internet  10.0.0.10        -          02:00:00:00:03:00 Gi0/0/1

Nothing in that output is a lie. Nothing in it is the whole truth either. Two boxes hold the address; the table shows one of them, with the confidence of a row that has no competitor, and the next ping may go to the other one.

Why it happens

The ARP table is keyed by address alone, so Device.learnArp() overwrote the first answer with the second and the fact went nowhere. The binding is therefore the last reply that arrived — which is why this presents as "the lab is flaky" rather than "the lab has a duplicate address", and why it survives a save, a reload and a fresh run. No view, no log and no event mentioned it.

The router is the only place both answers exist, so that is where the fact has to be written down.

The fix

  • Device.noteArpConflict(ip, mac, port) records an address answered by a second hardware address: both MACs, the port they were heard on. It records nothing when the answer comes from the same MAC (a neighbour refreshing its entry is the ordinary case) and nothing when the second answer arrives on a different port — two subnets may legitimately reuse an address, and manufacturing a conflict out of that would be its own defect.

  • The binding itself is unchanged. The table still holds the most recent answer, because that is what the engine acts on. The note is added beside it, never instead of it.

  • show ip arp says it in a sentence, under the table it qualifies:

    10.0.0.10 is claimed by 2 hardware addresses on Gi0/0/1: 02:00:00:00:02:00, 02:00:00:00:03:00
      this row shows the one that answered last; traffic to 10.0.0.10 goes to whichever answers next
    

    The second line is the part an operator cannot infer from the first — a contested address is not a curiosity, it is traffic that moves.

  • The clash travels with the row: Device.arpRows() carries conflict, so a panel reading the same data cannot present the address as settled, and an arp-conflict event goes on the wire ({type:'arp-conflict', dev, iface, ip, macs, vlan}) for the packet view.

Deliberately not done

The two hosts themselves stay quiet. A real stack detects a duplicate address from the other box's ARP claim and logs %IP-4-DUPADDR; modelling that is a new protocol behaviour rather than a view telling the truth about data it already had, so it is left as a decision instead of being smuggled in with this fix.

Evidence

$ node test/arp-conflict.test.js              # with the fix
26 passed, 0 failed

$ git stash push engine/ && node test/arp-conflict.test.js
16 passed, 10 failed                         # the assertions test the behaviour, not themselves

Neighbours green: show-arp 28, arp-ageing 31, runtime-agreement 10, show-argument-refusal 77, show-ip-spellings 70, dhcp-bindings 51, lldp 27, vrrp 94, ping-ipv6 43. Syntax 303 files OK. Full suite: 235 suites, 8809 assertions, 0 failed.

## The symptom Two hosts in one VLAN, both configured `10.0.0.10`: ``` r1> ping 10.0.0.10 4 Type escape sequence to abort. Sending 4, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds: !!!! Success rate is 100 percent (4/4) r1> show ip arp Protocol Address Age (min) Hardware Addr Interface Internet 10.0.0.10 - 02:00:00:00:03:00 Gi0/0/1 ``` Nothing in that output is a lie. Nothing in it is the whole truth either. Two boxes hold the address; the table shows one of them, with the confidence of a row that has no competitor, and the next ping may go to the other one. ## Why it happens The ARP table is keyed by address alone, so `Device.learnArp()` overwrote the first answer with the second and the fact went nowhere. The binding is therefore *the last reply that arrived* — which is why this presents as "the lab is flaky" rather than "the lab has a duplicate address", and why it survives a save, a reload and a fresh run. No view, no log and no event mentioned it. The router is the only place both answers exist, so that is where the fact has to be written down. ## The fix - **`Device.noteArpConflict(ip, mac, port)`** records an address answered by a second hardware address: both MACs, the port they were heard on. It records nothing when the answer comes from the **same** MAC (a neighbour refreshing its entry is the ordinary case) and nothing when the second answer arrives on a **different port** — two subnets may legitimately reuse an address, and manufacturing a conflict out of that would be its own defect. - **The binding itself is unchanged.** The table still holds the most recent answer, because that is what the engine acts on. The note is added beside it, never instead of it. - **`show ip arp` says it in a sentence**, under the table it qualifies: ``` 10.0.0.10 is claimed by 2 hardware addresses on Gi0/0/1: 02:00:00:00:02:00, 02:00:00:00:03:00 this row shows the one that answered last; traffic to 10.0.0.10 goes to whichever answers next ``` The second line is the part an operator cannot infer from the first — a contested address is not a curiosity, it is traffic that moves. - **The clash travels with the row**: `Device.arpRows()` carries `conflict`, so a panel reading the same data cannot present the address as settled, and an `arp-conflict` event goes on the wire (`{type:'arp-conflict', dev, iface, ip, macs, vlan}`) for the packet view. ## Deliberately not done The two hosts themselves stay quiet. A real stack detects a duplicate address from the other box's ARP claim and logs `%IP-4-DUPADDR`; modelling that is a new protocol behaviour rather than a view telling the truth about data it already had, so it is left as a decision instead of being smuggled in with this fix. ## Evidence ``` $ node test/arp-conflict.test.js # with the fix 26 passed, 0 failed $ git stash push engine/ && node test/arp-conflict.test.js 16 passed, 10 failed # the assertions test the behaviour, not themselves ``` Neighbours green: `show-arp` 28, `arp-ageing` 31, `runtime-agreement` 10, `show-argument-refusal` 77, `show-ip-spellings` 70, `dhcp-bindings` 51, `lldp` 27, `vrrp` 94, `ping-ipv6` 43. Syntax 303 files OK. Full suite: 235 suites, 8809 assertions, 0 failed.
Author
Owner

Landed as #1474 (5aca4f5a). Post-merge on main: arp-conflict 26, show-arp 28, arp-ageing 31, tree clean.

show ip arp now ends a contested entry with the sentence and the consequence:

10.0.0.10 is claimed by 2 hardware addresses on Gi0/0/1: 02:00:00:00:02:00, 02:00:00:00:03:00
  this row shows the one that answered last; traffic to 10.0.0.10 goes to whichever answers next

and arpRows() carries the conflict, so the UI cannot render that address as settled either. The detection sits in the single funnel every ARP learn passes through, so no code path can update the table privately and miss a clash.

Landed as #1474 (`5aca4f5a`). Post-merge on `main`: `arp-conflict` 26, `show-arp` 28, `arp-ageing` 31, tree clean. `show ip arp` now ends a contested entry with the sentence and the consequence: ``` 10.0.0.10 is claimed by 2 hardware addresses on Gi0/0/1: 02:00:00:00:02:00, 02:00:00:00:03:00 this row shows the one that answered last; traffic to 10.0.0.10 goes to whichever answers next ``` and `arpRows()` carries the conflict, so the UI cannot render that address as settled either. The detection sits in the single funnel every ARP learn passes through, so no code path can update the table privately and miss a clash.
Sign in to join this conversation.
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#1473
No description provided.