Skip to content

Harden LAN scanner discovery and device classification - #163

Merged
openshwprojects merged 11 commits into
openshwprojects:mainfrom
divadiow:lanscanner
Aug 2, 2026
Merged

Harden LAN scanner discovery and device classification#163
openshwprojects merged 11 commits into
openshwprojects:mainfrom
divadiow:lanscanner

Conversation

@divadiow

Copy link
Copy Markdown
Contributor

Summary

  • validate ordered IPv4 scan ranges and reject IPv6 input
  • cap scans at 65,536 addresses, 20 loops, and 128 workers
  • safely handle ranges ending at 255.255.255.255 without integer wraparound
  • drain outstanding HTTP workers before reporting a normal scan as complete
  • make worker completion and stop flags visible across threads
  • make right-click actions target the row under the pointer and ignore empty list space
  • remove the unconditional shared lastHTTPJSONtext.txt write from discovery parsing
  • correctly classify SDK=obk devices as OBK while retaining Tasmota discovery

Why

The scanner could report completion before its final HTTP requests were consumed, so responsive devices at the end of a scan could be omitted. Input values were effectively unbounded, right-click actions could use a stale focused row, and concurrent discovery depended on writing every JSON response to one shared debug filename.

OBK and Tasmota discovery both begin with the Tasmota-compatible STATUS 0 endpoint. The OBK branch was nevertheless setting the Tasmota flag to true, which routed OBK devices through the Tasmota mass-backup path.

Impact

Scans now finish with complete results, reject unsafe ranges and concurrency settings, and apply context-menu actions to the intended device. OBK devices follow the OBK backup path, while genuine Tasmota devices remain classified as Tasmota.

Validation

  • Release build completed with 0 errors
  • range and worker-cap boundary tests passed
  • one-address live OBK scan completed with exactly one callback and no stranded workers
  • discovery succeeded while lastHTTPJSONtext.txt was held exclusively open
  • live /24 scan found 8 compatible devices: 7 OBK and 1 genuine Tasmota, all classified correctly
  • mock Tasmota response remained classified as Tasmota
  • hardware checks used only read-only STATUS 0 and /api/info requests; no reboot or control commands were sent
  • CRLF-aware diff check passed, with normal and EOL-ignoring numstats matching

@divadiow
divadiow marked this pull request as ready for review July 25, 2026 04:33
@divadiow
divadiow marked this pull request as draft July 26, 2026 20:09
@divadiow
divadiow marked this pull request as ready for review July 26, 2026 21:18
@divadiow

Copy link
Copy Markdown
Contributor Author
image

@openshwprojects

Copy link
Copy Markdown
Owner

Nice, pls forum topic about scanner for GuideS?

@openshwprojects
openshwprojects merged commit dc01762 into openshwprojects:main Aug 2, 2026
2 checks passed
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.

2 participants