Skip to content

fix(scan): probe every NIC's subnet broadcast for VXI-11 discovery#60

Merged
ShortArrow merged 1 commit into
mainfrom
fix/scan-multi-nic
Jun 29, 2026
Merged

fix(scan): probe every NIC's subnet broadcast for VXI-11 discovery#60
ShortArrow merged 1 commit into
mainfrom
fix/scan-multi-nic

Conversation

@ShortArrow

Copy link
Copy Markdown
Owner

Problem

visa scan returned 0 results on multi-homed hosts even when an instrument was 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 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 secondary 192.168.3.10 NIC — its 255.255.255.255 probes were going out an unrelated APIPA interface.

Change

Vxi11BroadcastScanner.ScanAsync now:

  • Enumerates every operational, non-loopback IPv4 interface.
  • For each, computes the subnet-directed broadcast (ip | ~mask, e.g. 192.168.3.255), binds a UdpClient to that NIC's local address, and sends the GETPORT there.
  • Probes all interfaces concurrently and de-duplicates responders by sender IP.
  • Skips interfaces that fail to bind/send (APIPA, tunnels) without aborting the scan.

Also unmasks the discovered resource in visa scan output: it now prints the real host (FormatResource) in human + --json output instead of the ToLogString-masked ***. ToLogString masking is scoped to logging (ADR 0017), not user-requested discovery output, and matches what --add already 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

  • Unit tests (TDD): DirectedBroadcast (per-subnet host-bit computation, 4 cases) and ShouldProbe (interface filter: up/loopback/IPv4/mask). Socket round-trip verified on hardware per ADR 0008 §Verification.
  • Real device: on the secondary-NIC host, ivicli visa scan --json went 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 Vxi11Portmapper codec, and the inherent cross-subnet / broadcast-only limits. §4 notes the unmasked scan output.

`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.
@ShortArrow ShortArrow merged commit f74ae69 into main Jun 29, 2026
4 checks passed
@ShortArrow ShortArrow deleted the fix/scan-multi-nic branch June 29, 2026 06:58
@ShortArrow ShortArrow mentioned this pull request Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant