Repository navigation
Conversation
Contributor
Author
|
@skrashevich What is your opinion about that? |
Collaborator
|
Contributor
Author
|
Collaborator
Synology, for example? |
Contributor
Author
|
Synology, Truenas, green nas |
Contributor
Author
|
Did you think about this? |
When another mDNS responder on the host already holds the IPv4 :5353 wildcard bind, go2rtc's HomeKit module exits with 'no interfaces for listen' because the IPv4 path was the only one wired. This change adds an IPv6 transport that runs alongside IPv4 best-effort, so HomeKit keeps working in those setups. Changes - pkg/mdns: parallel IPv6 path. Per-interface udp6 senders, single [::]:5353 receiver with IPV6_JOIN_GROUP for ff02::fb. ListenMulticastUDP runs both families and returns errors.Join'd diagnostic only when neither came up; orphan sender FDs are closed when the matching receiver bind fails. - pkg/mdns: AppendEntry kept with its original (msg, entry, service, ip) signature for external callers; new AppendEntryDual covers both A and AAAA so a query that arrived over IPv6 still gets a usable IPv4 record for clients that prefer v4 (this is what makes iOS HomeKit's HAP TCP connect succeed when only the v6 mDNS path is up). - pkg/mdns: per-OS IPV6_MULTICAST_LOOP / IPV6_JOIN_GROUP constants (Linux 19/20, BSD/Windows 11/12). Loopback and link-local IPs are rejected when resolving an IP literal back to its interface; a small prefix list skips obvious docker/vpn interfaces in the v6 picker. - pkg/homekit/consumer.go: SetupEndpoints response now sets the correct Address.IPVersion (HAP R15 §10.4.2) and uses the proper textual form for the v6 case; the legacy code's addr.IP.To4().String() returned '<nil>' on a v6 socket. When the controller signals an IPv6 link-local RTP endpoint, the local SRTP zone is copied so kernel writes succeed. - pkg/srtp/session.go: Session.SetZone helper for the case above. Compatibility - IPv4 success path is unchanged. - AppendEntry signature is unchanged (delegates to the new dual helper). - New exported names: MulticastAddrV6, AppendEntryDual, Session.SetZone, three Browser fields (SendsV6/NetsV6/RecvV6) parallel to existing Sends/Nets/Recv. Tested - go build ./... and go test ./pkg/mdns/... - linux/amd64 build deployed in a Frigate container running alongside another mDNS responder that holds the v4 wildcard bind: HomeKit pairing, snapshots and live stream all work over the LAN.
Contributor
Author
|
@AlexxIT merge conflicts resolved |
Owner
|
Thanks! There are a lot of changes. It's not a bug, but a very specific feature. Unfortunately, this review comes last. |
This branch has not been deployed
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.
Summary
Adds IPv6 mDNS serving alongside IPv4 for HomeKit accessories. If IPv4 mDNS cannot bind, the server can still advertise over IPv6. When neither family can start, the error includes both causes. Rebased onto current
master, preserving its IPv4 interface selection and per-address bind diagnostics from #2304.ff02::fbon each usable interface, set the multicast interface and hop limit, and use received packet information to select the response interface.AppendEntrysignature. IPv6 socket options use the existinggolang.org/x/net/ipv6dependency; no dependency changes.IPv6 browsing/client discovery is outside this change. On Windows,
x/net/ipv6does not expose incoming packet information, so the responder falls back to the source zone for link-local requests; global-source requests without a zone are not handled there.Validation
go test -race ./pkg/mdns ./pkg/homekit ./pkg/srtppasses.go vet ./pkg/mdns ./pkg/homekit ./pkg/srtppasses.go build ./...passes on macOS/arm64 and cross-compiles for Linux/amd64, Windows/amd64 and FreeBSD/amd64.go vet ./...reports the same existing findings on clean upstreammasterinpkg/bits,pkg/mqttandpkg/webrtc.Related work