Repository navigation
Conversation
Prefer HAP-Java HomekitAdvertisers.nativeDnssd() instead of a dedicated JmDNS instance when useOHmDNS finds no matching client (or when creating a private advertiser). Avoids UDP 5353 bind failures on macOS where mDNSResponder owns the port. Bump hap to 2.0.10-SNAPSHOT and embed JNA for DNSServiceRegister. Signed-off-by: Karel Goderis <karel.goderis@me.com>
Clarify useOHmDNS behaviour when UDP 5353 is owned by a system responder, note the HAP-Java#213 dependency in the pom, and attribute JNA in NOTICE. Signed-off-by: Karel Goderis <karel.goderis@me.com>
3 tasks done
Contributor
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.
Description
Bugfix / improvement for HomeKit bridge advertising on hosts where a system mDNS daemon already owns UDP 5353.
When
useOHmDNSdoes not yield a matching shared JmDNS client (or when creating a dedicated advertiser), the add-on previously fell back to HAP-Java's JmDNS path, which binds UDP 5353. On macOS,mDNSResponderowns that port exclusively; the bind fails (Address already in use/ "no suitable mDNS") and Apple Home never discovers_hap._tcpeven though the HAP TCP listener is up. The same class of conflict appears with Avahi and other system responders.This change prefers HAP-Java's native DNS-SD / Bonjour advertiser (
HomekitAdvertisers.nativeDnssd()viaDNSServiceRegister/ JNA) when that path is supported, so_hap._tcpis published without binding 5353. ExistinguseOHmDNS=truesharing of openHAB's JmDNS is unchanged when a suitable client is found.Depends on the upstream HAP-Java PR (not yet merged/released):
Until that lands on Maven Central as a release (currently
hap2.0.10-SNAPSHOT+ embedded JNA5.14.0), this PR is a draft. After the HAP-Java release, the pom will be bumped to the released version and the draft can leave WIP.Resolves #22012
Related reports (mDNSResponder / UDP 5353 /
_hap._tcpadvertising)GitHub
SocketException#21970 — HomeKit advertising loss / canceled JmDNS instances (announced=false)_hap._tcpannouncement missing for HomeKit bridgeCommunity
_hap._tcp/ 5353 discovery)User impact
useOHmDNS=false): native DNS-SD is selected automatically when supported.useOHmDNS=truecontinues to prefer openHAB's shared JmDNS when a matching interface client exists.Compliance
Signed-off-by: Karel Goderis <karel.goderis@me.com>on all commits (DCO)org.openhab.io.homekituseOHmDNSdocuments the native DNS-SD fallbackTesting
Verified on openHAB 5.3.0.M3 (native macOS Apple Silicon):
useOHmDNS=false, logs show native DNS-SD registration (no UDP 5353 bind by the JVM)dns-sd -B _hap._tcplists the openHAB bridge instance(s)CI of this draft will not resolve
hap2.0.10-SNAPSHOTuntil HAP-Java #213 is released; please treat merge readiness as blocked on that upstream release.