-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix address advertisement bugs #974
Conversation
When we can't find the default route, advertise all addresses so we have something.
eeb90af
to
3d57d61
Compare
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 seems correct to me, I just left a few comments/questions mostly about logging errors in user configurations.
p2p/host/basic/basic_host.go
Outdated
// If we failed to lookup interface addrs. | ||
if len(h.allInterfaceAddrs) == 0 { |
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.
Why does this generally occur? If it's a user configuration or router error is it worth logging it?
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 can happen due to OS restrictions, or if the there are no network devices. We could probably just detect this case at the top and bail entirely.
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.
I've changed this logic to only use fallback addresses if InterfaceMultiaddrs
fails. If it just returns no addresses, we now accept that we have no addresses.
Co-authored-by: Adin Schmahmann <[email protected]>
* If we fail to lookup interface addresses, do our best and bail. * Only fallback on guessing addresses if we fail to lookup any interface addresses. If the interface address lookup function returns nothing, accept that we have no IP addresses and move on. * Log when the NAT returns a bad address.
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.
LGTM. Left a tiny comment typo correction
Co-authored-by: Adin Schmahmann <[email protected]>
This patch fixes several address advertisements bugs that slipped through into go-ipfs 0.6.0.
We really need tests for this code, but that will likely require some mocking.