The address two boxes answered for #1474
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1474
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/arp-conflict"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was wrong
Two hosts in one VLAN, both configured
10.0.0.10: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.
What changed
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 arpsays it in a sentence, under the table it qualifies: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()carriesconflict, so a panel reading the same data cannot present the address as settled, and anarp-conflictevent 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
Neighbours green:
show-arp28,arp-ageing31,runtime-agreement10,show-argument-refusal77,show-ip-spellings70,dhcp-bindings51,lldp27,vrrp94,ping-ipv643. Syntax 303 files OK. Full suite: 235 suites, 8809 assertions, 0 failed (/tmp/t261.log).One thing worth a reviewer's eye: the conflict is recorded in
_learnArp()in the simulator, which is the single funnel every ARP learn passes through (request branch, reply branch, gratuitous ARP), so a clash cannot be missed by one code path updating the table privately.two hosts in one VLAN, both configured 10.0.0.10 r1> ping 10.0.0.10 4 r1> show ip arp !!!! Internet 10.0.0.10 - 02:00:00:00:03:00 Gi0/0/1 Success rate is 100 percent Nothing in that is a lie and nothing in it is the whole truth. The ARP table is keyed by address alone, so learnArp() overwrote the first answer with the second and the fact went nowhere: the binding is whatever reply arrived last, which is why this presents as "the lab is flaky" rather than "there are two claimants", and why it survives a save, a reload and a fresh run. No view, log or event mentioned it. * device.js: noteArpConflict() records an address answered by a second hardware address, keeping both MACs and the port they were heard on. Silent when the same MAC re-answers (a neighbour refreshing its entry is the ordinary case) and silent when the second answer arrives on a different port, because two subnets may legitimately reuse an address - inventing a conflict out of that would be its own defect. arpRows() carries it, so any panel reading the same data cannot present the address as settled; * simulator.js: _learnArp() is the single funnel every ARP learn passes through (request, reply, gratuitous), and it notes the clash there and emits an arp-conflict event for the packet view; * cli.js: `show ip arp` says it in a sentence under the table it qualifies - both MACs, the port, and the consequence, which is the part an operator cannot infer: "traffic to 10.0.0.10 goes to whichever answers next". The binding itself is unchanged; the note is added beside it, not instead of it. Deliberately not done: the two hosts stay quiet. A real stack detects a duplicate address from the other box's ARP claim and logs %IP-4-DUPADDR, and modelling that is a new protocol behaviour rather than a view telling the truth about data it already had - a decision, not a side effect of this fix. Evidence: test/arp-conflict.test.js 26 checks, reverting engine/ gives 16 passed and 10 failed. 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. Suite 235 suites, 8809 assertions, 0 failed.