fix(scan): probe every NIC's subnet broadcast for VXI-11 discovery#60
Merged
Conversation
`visa scan` returned nothing on multi-homed hosts even when an instrument sat on a directly-connected subnet: the scanner bound to IPAddress.Any and sent only to the limited broadcast 255.255.255.255, which egresses a single interface (the default route's) on Windows. An instrument on a secondary lab NIC never received the probe. ScanAsync now enumerates every operational, non-loopback IPv4 interface and sends a GETPORT to each NIC's subnet-directed broadcast (e.g. 192.168.3.255), bound to that NIC's local address, then aggregates responders across interfaces. Verified against a real Kikusui PWR801L on a secondary subnet: discovery went from 0 to the device. Also unmask the discovered resource in `visa scan` output: it now prints the real host (FormatResource) in human and --json output instead of the ToLogString-masked form. ToLogString masking is scoped to logging (ADR 0017), not user-requested discovery output; this matches what `--add` already writes to config. mDNS multi-interface tuning is left as-is (Makaretu binds all interfaces by default); the verified fix is the VXI-11 broadcast path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
visa scanreturned 0 results on multi-homed hosts even when an instrument was on a directly-connected subnet. The scanner bound toIPAddress.Anyand sent only to the limited broadcast255.255.255.255, which egresses a single interface on Windows (the default route's). An instrument on a secondary lab NIC never received the probe.Confirmed against a real Kikusui PWR801L (
192.168.3.100) reached via a host's secondary192.168.3.10NIC — its255.255.255.255probes were going out an unrelated APIPA interface.Change
Vxi11BroadcastScanner.ScanAsyncnow:ip | ~mask, e.g.192.168.3.255), binds aUdpClientto that NIC's local address, and sends the GETPORT there.Also unmasks the discovered resource in
visa scanoutput: it now prints the real host (FormatResource) in human +--jsonoutput instead of theToLogString-masked***.ToLogStringmasking is scoped to logging (ADR 0017), not user-requested discovery output, and matches what--addalready writes to config.mDNS multi-interface tuning is left as-is (Makaretu binds all interfaces by default); the VXI-11 broadcast path is the verified fix.
Verification
DirectedBroadcast(per-subnet host-bit computation, 4 cases) andShouldProbe(interface filter: up/loopback/IPv4/mask). Socket round-trip verified on hardware per ADR 0008 §Verification.ivicli visa scan --jsonwent from(no resources discovered)to:{"discovered":[{"index":1,"resource":"TCPIP0::192.168.3.100::inst0::INSTR","idn":null}]}Full suite green (
Category!=Integration), csharpier + analyzers clean.Docs
ADR 0008 §3 updated in-place: per-NIC directed broadcast, shared
Vxi11Portmappercodec, and the inherent cross-subnet / broadcast-only limits. §4 notes the unmasked scan output.