-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
mosquitto_connect() fails on systems with no IPv4 addresses configured. #869
Comments
Do we always need the flag AI_ADDRCONFIG for both getaddrinfo cases? |
I'd like to confirm the background. Disabling IPv4 addresses is frequently in these days? Many other network softwares have already corresponded with the situation? |
Certainly on embedded devices having no IPv4 addresses configured is very common (indeed having no interfaces except loopback is common). In our case mosquitto is brokering messages between various modules which are themselves attempting to configure the system's IPv4 addresses as part of system startup (but are having a hard time since mosquitto needs the IPv4 addresses to be configured before it will connect...). Either way I did patch this locally by removing the AI_ADDRCONFIG flag, which seems to work fine on our systems - I don't know if it's compatible with all configurations though. Cheers,
|
Thanks @Alex-Richman . It's great If you can submit your patch as a new PR. I'd like to consult you. Should this issue be treated as a bug by lack of a primitive and nothing special feature, or as a new great and special feature? If the former, I will label as an enhancement and close this issue, you can submit a new PR and link this close issue. If the latter, I will label as a bug and keep this issue, you can submit a new PR and link this open issue. |
Sorry the former and the latter should be replaced. |
Sure, PR above (#901). I'd consider it a bug. As far as I can tell the AI_ADDRCONFIG flag isn't required and seems to cause issues so shrug. Cheers,
|
OK. I labeled. Keep this issue until your PR merged. |
This is for a system with loopback only not just "no ipv4" If you had ipv6 addresses, you'd get a v6 address back, which would still work. Bug's valid, fix looks correct, just the description is a little off. |
My mistake, fixed :) Cheers,
|
I've made the change that removes this, if you test the |
Nice one, I can confirm the fixes branch works. Cheers,
|
mosquitto_connect() will fail on systems with no IPv4 addresses configured. Even when connecting via the loopback interface to localhost.
e.g.:
From a brief look at the source, I believe this is because net__try_connect (lib/net_mosq.c:300) is using AI_ADDRCONFIG to enumerate local IP addresses to bind to. Per the RFC this fails when the system has no IPv4 addresses configured (lo not being considered a configured address):
This may be related to #736
(internal ID CORE4-909)
Cheers,
The text was updated successfully, but these errors were encountered: