-
Notifications
You must be signed in to change notification settings - Fork 775
fix(mdns): macos: handle address reuse and fallback for no interfaces #1283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
How can I replicate this error on my mac? I have go2rtc running with no errors. Without sudo. |
15b54ae to
efb1ae1
Compare
| if err != nil { | ||
| return errors.New("no interfaces for listen and fallback failed: " + err.Error()) | ||
| } | ||
| b.Sends = append(b.Sends, conn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work. We need networks. They are used further in the logic.
| conn, err := lc1.ListenPacket(ctx, "udp4", ipn.IP.String()+":5353") // same port important | ||
| if err != nil { | ||
| if strings.Contains(err.Error(), "address already in use") { | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useless
| return | ||
| } | ||
|
|
||
| func InterfacesIP4() ([]net.IP, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useless
Overview
This PR addresses the error
ERR internal/homekit/homekit.go:128 > error="no interfaces for listen"on macOS when running the application without root privileges.Problem
The mDNS client was failing to bind to network interfaces, resulting in the error mentioned above. This typically occurred when specific network interfaces were not available or the address was already in use.
Solution
Address Reuse Handling:
Fallback for No Interfaces:
Impact
These changes ensure that the mDNS client can gracefully handle common networking issues on macOS, improving reliability when the application is run without root privileges.
Fixes #1225