Closed tannewt closed 5 months ago
https://github.com/espressif/esp-idf/issues/8307 Probably not backported yet.
Hi @tannewt
Any particular reason why you've called add_delegated_host()
before mdns_hostname_set()
? Are you trying to advertise or delegate services with no internal hostname? Or is it just the init part of your code?
It wasn’t deliberate. I’m using the delegate to advertise a second name for the same ip. (One name is unique and one is a catch all.)
On Thu, Mar 31, 2022, at 10:58 PM, david-cermak wrote:
Hi @tannewt https://github.com/tannewt
Any particular reason why you've called
add_delegated_host()
beforemdns_hostname_set()
? Are you trying to advertise or delegate services with no internal hostname? Or is it just the init part of your code?— Reply to this email directly, view it on GitHub https://github.com/espressif/esp-idf/issues/8601#issuecomment-1085456208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAM3KOFBRH7FQDCGBC5HG3VC2GBXANCNFSM5RAER3CQ. You are receiving this because you were mentioned.Message ID: @.***>
ok, thanks. I'll update the docs to make it clear that the own hostname is a prerequisite to advertizing services or delegating other names. it's just mentioned in the example:
Also, as @chegewara (Thank you!) pointed out, some fixes from master haven't been backported to v4.4
yet. If you see any other issue with delagating services, please try to backport:
will be added to v4.4
soon.
I think there is also a race condition in this code between the task setting _mdns_server->hostname
and adding a service. It is possible to add a service with a NULL hostname if the mdns task hasn't processed the set hostname action yet. It then later crashes in a couple places that don't check that hostname for a service is not NULL.
closing as done via https://github.com/espressif/esp-protocols/pull/534
I think @david-cermak has been working in mdns code most recently.
Environment
git describe --tags
to find it): ESP-IDF v4.4-351-g121ddb87e5-dirtyxtensa-esp32-elf-gcc --version
to find it): xtensa-esp32s3-elf-gcc (crosstool-NG esp-2021r2-patch3) 8.4.0Problem Description
The IDF crashes with a LoadProhibited if mdns_delegate_hostname_add is called before mdns_hostname_set. This is caused by
_hostname_is_ours
not checking to see if_mdns_server->hostname
is NULL. The top check should be:Expected Behavior
It shouldn't crash.
Actual Behavior
It crashes with a LoadProhibited.
Steps to reproduce
Call
mdns_delegate_hostname_add
beforemdns_hostname_set
.Debug Logs
(Garbled prints are from printing from both cores at once. It isn't the issue.)