Improvements in connection logic#90
Open
ttherbrink wants to merge 4 commits into
Open
Conversation
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.
What & why
KNX devices could get stuck reporting "Selected IP Interface Not available."
after a host reboot — most visibly on Homey Self-Hosted Server (KNX running in a
container on a NAS with several network interfaces). The gateway was rediscovered
fine, but the tunnel bound to the wrong local interface, so the handshake never
completed and every device flapped into an endless disconnect loop.
This branch fixes that and hardens interface discovery/connection overall.
Changes
Multiple local interfaces
(ethernet + wifi + VLANs), merging results by MAC so a gateway reachable over
more than one interface still shows as one entry.
setMulticastInterface, so searches can run concurrently without port clashes.Correct tunnel binding (the SHS fix)
lib's
options.interface, re-resolved on every (re)connect so a reboot thatreorders interfaces self-corrects. Falls back to the lib default when no subnet
matches.
Probe no longer exhausts gateway tunnel slots
checkKNXInterfacenow sends a DISCONNECT_REQUEST to release the tunnel channelit opens while probing, and defers the socket close until that datagram is
flushed. Released on all exit paths (success/timeout/error).
Reconnect-storm resilience
request; the probe lock is decoupled from the multicast-search lock.
Robustness
parseKNXResponseguards against truncated/malformed frames instead of throwinginside socket handlers.
destroy().Notes
directly, while the knx
options.interfacename uses the lib's own"last IPv4 per name" resolution to avoid a subnet mismatch.
Testing
homey app validate -l publishpasses.os.networkInterfaces().Binding tunnel to local interface <name>log line appears followed byKNX Connected.