-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
rp2 - mDNS not working #15297
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
Comments
Tested also with MP 1.23.0 : not resolved |
On rp2 MDNS is enabled to be provided by lwip: https://github.com/micropython/micropython/blob/master/ports/rp2/lwip_inc/lwipopts.h#L35. Maybe you want to compile your own firmware with that flag disabled? |
I am looking for a fix for this as well. I would prefer not to build my own custom firmware and use something like slimdns. I will have more of a look at the code to see why LWIP is not working once I get a working local build. |
But I think the point being made is that LWIP is not providing a working mDNS implementation on rp2 and yet is holding onto the port. Could that perhaps be a result of a build order of operations with the LWIP library and the rp2 lwipopts.h? Or some missing glue code? It is fair if mDNS support is not yet implemented for the rp2 port. But it seems very much like a bug for rp2 lwipopts.h to define the following if mDNS support is not properly included/implemented in the fw:
I also notice that the following lines are not included in the rp2 mpconfigport.h file:
The ESP port has code in network_wlan.c that specifically calls mDNS initialization and provides some handling code. The rp2 port does not seem to have similar code. |
@felixdoerre Looking over the codebase some more I think I might see the issue. In ports/rp2/main.c:125 there is this code: #if MICROPY_PY_LWIP
// lwIP doesn't allow to reinitialise itself by subsequent calls to this function
// because the system timeout list (next_timeout) is only ever reset by BSS clearing.
// So for now we only init the lwIP stack once on power-up.
lwip_init();
#if LWIP_MDNS_RESPONDER
mdns_resp_init();
#endif
#endif Per the LWIP docs, the If someone can point me to where the netif is initialized in the RP2 port I am happy to build up a PR. |
@dpgeorge any comment on the default behavior? Seems like mDNS should either be fully functional or disabled by default. Happy to contribute a PR if appropriate. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
The rp2 port has an incomplete mDNS implementation. The code in `main.c` calls `mdns_resp_init()` which opens the UDP socket for mDNS. However, no code in the cyw43 driver makes the proper calls to `mdns_resp_add_netif()` and `mdns_resp_remove_netif()` to send the announce packets. The wiznet5k driver does make these calls and was used as a model for these changes. This commit attempts to address this by very small changes to the `ports/rp2/cyw43_configport.h` file. The change uses new cyw43 driver hooks to map the driver macros `CYW43_CB_TCPIP_INIT_EXTRA` and `CYW43_CB_TCPIP_DEINIT_EXTRA` to the appropriate lwIP mDNS calls. Fixes issue micropython#15297. Signed-off-by: Mark Seminatore <nebula_peeps4t@icloud.com>
Should be fixed by f96417d (although looking up mDNS on the Pico W in AP mode might not work yet). |
The rp2 port has an incomplete mDNS implementation. The code in `main.c` calls `mdns_resp_init()` which opens the UDP socket for mDNS. However, no code in the cyw43 driver makes the proper calls to `mdns_resp_add_netif()` and `mdns_resp_remove_netif()` to send the announce packets. The wiznet5k driver does make these calls and was used as a model for these changes. This commit attempts to address this by very small changes to the `ports/rp2/cyw43_configport.h` file. The change uses new cyw43 driver hooks to map the driver macros `CYW43_CB_TCPIP_INIT_EXTRA` and `CYW43_CB_TCPIP_DEINIT_EXTRA` to the appropriate lwIP mDNS calls. Fixes issue micropython#15297. Signed-off-by: Mark Seminatore <nebula_peeps4t@icloud.com>
Port, board and/or hardware
rp2040
MicroPython version
mp 1.22.2
Reproduction
There isn't a code sample, the feature is built-in in the firmware.
Expected behaviour
The micro working on WiFi (STA_IF or AP_IF) should respond to mDNS queries.
Observed behaviour
Not working.
Additional Information
I code in Python a mDNS and LLMNR responder.
It works like a charm on the esp8266: the micro, with its hostname xxxxxx.local is recognized by any browser (browsers use mDNS) and by ping (on microsoft pc, ping use also LLMNR).
Running my module on the rp2:
So the firmware has already taken the mDNS port ... is trying to do something... but mDNS isn't working.
Code of Conduct
Yes, I agree
The text was updated successfully, but these errors were encountered: