-
Notifications
You must be signed in to change notification settings - Fork 7.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
mDNS: Do not add ".local" behind the scenes (IDFGH-4787) #6590
Comments
In the other issue it was mentioned that it probably works on esp8266 because of LWIP_DNS_SUPPORT_MDNS_QUERIES espressif/arduino-esp32#3822 (comment). Using lwip as a general dns resolver including for mdns (lwip also only supports .local) is the most practical and fastest solution. The esp-idf mdns component is based around a single instance tied to a single domain and hardcoded to .local. This is definitely a limitation but I don't think it was ever designed to be part of a general resolver. There should be changes to this component and the easiest one would be don't append .local if the hostname already ends in .local which probably won't do any harm. We'll have to see what espressif thinks about other breaking changes to this component. |
Hi @markg85 Thanks for the report. I agree that the internal mDNS has some limitations, hardcoded Also agree the the easiest option is to use the lwip resolver enabling So I would suggest using lwIP's mdns module for resolving hostnames, and internal IDF's mdns for advertising/resolving services and correct conflict resolutions per mDNS/bonjour spec (where the lwip's implementation might fail). |
I am curious to know why you folks changed this compared to ESP8266. Anyhow, what's the proper way to get |
Any help please? I'm still stuck in this very same problem.
Right now i can only make a connection via IP to a host that is reachable through mDNS but does not have a "regular dns". During compilation i do see Edit: |
@markg85 I suppose this won't work, since this macro needs to be defined at the time when LwIP is compiled. In Arduino, all ESP-IDF libraries are already pre-compiled using https://github.com/espressif/esp32-arduino-lib-builder/. It looks like in the latest version, CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES is already set: https://github.com/espressif/esp32-arduino-lib-builder/blob/d491d3a565f016d86aa474098a5abf2e88dd0df8/sdkconfig.esp32#L954. It is also enabled in the master branch of arduino-esp32: https://github.com/espressif/arduino-esp32/blob/7856de7a57420e494176c16c5138174fe2c1dad0/tools/sdk/esp32/sdkconfig#L954. I suppose that if you use the latest version of arduino-esp32 repository, you don't need to enable this separately. I'm sorry I can't help with platformio usage, though. |
Thank you for that!
That's how to get the master branch in platformio.ini. Now i'm using WiFiManager which thankfully has a branch to work with the master of arduino-esp32 but even so, the compile fails with:
That doesn't help :( |
This doesn't look right indeed, as the toolchain being used is based on GCC 5.2. For the recent versions of IDF it should be based on GCC 8.4. I do see the build script at https://github.com/espressif/arduino-esp32/blob/master/tools/platformio-build-esp32.py, but I don't know where the dependency on the toolchain is declared, or how the newer toolchain can be installed. Do you mind opening an issue about the failing build with platformio at https://github.com/espressif/arduino-esp32/issues? |
I was about to before i realized that i need to specify that toolchain too :)
It does compile! Just doesn't link now :)
Is that an issue for the arduino-esp32 repo or for this current one? |
This looks like toolchain version mismatch... Unfortunately I don't know which toolchain version does platformio package |
Fixed, finally :)
I was close to that in one attempt. I just had Now i have the latest framework + toolchain. And to confirm my initial issue, it's fixed in this. I can just set a .local and it resolves! Thanx to Max from https://community.platformio.org/t/how-to-recompile-framework-or-update-it |
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
…ntains domain name during the query Closes espressif/esp-idf#6590 * Original commit: espressif/esp-idf@9f8d2b9
Hi,
This whole comment comes from me from #2507.
I was asked by @igrr to open a new bug report for this.
I'm in a linux setup where Avahi is handling mDNS for my pc's.
The pc's themselves can ping each other just fine using
<their name>.local
.The ESP8266 could reach those same machines just fine too with mDNS.
I took a little excursion into the code along with wireshark and found one interesting clue that confuses everyone.
When i, in code, do a mdns lookup for
foo.local
(so the .local included!) then wireshark tells me that the lookup was actually forfoo.local.local
! Note the double ".local"!The "fix" might seem to not include the ".local" in my host.
If i then do a mdns lookup using some espressif sample code for a dns lookup, it magically works.
However, if i now pass in these hostnames without ".local", other parts of the code apparently think i want to do a DNS lookup as opposed to an mDNS lookup. And as i don't have those hostnames in my network without the .local suffix those lookups fail in WiFiGeneric.cpp line 654:
[E][WiFiGeneric.cpp:654] hostByName(): DNS Failed for foo
That ".local" is added internally is confirmed in ESPmDNS.h itself in it's comment block:
Other libraries (i'm in particular having troubles with the PubSubClient library) connect to the hostname via a passed in Client object. That is often a WiFiClient where eventually this code is called:
As you can see in the snippet, the name is resolved by
WiFiGenericClass::hostByName
which looks like this:At this point mDNS is nowhere to be found. The Lookup is done in regular DNS and therefore fails in my case. Remember, if i omit the
.local
i get a name that isn't known in my network. It must be ending with .local here.I think there's at least 1 bug here, possible 2.
The text was updated successfully, but these errors were encountered: