Skip to content
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 does not send goodbye messages when removing services (IDFGH-1379) #3660

Closed
KidVizious opened this issue Jun 19, 2019 · 7 comments
Closed

Comments

@KidVizious
Copy link

Environment

  • Development Kit: none
  • Module or chip used: ESP32-WROOM-32D
  • IDF version v4.0-dev-512-g6fd535c98
  • Build System: CMake
  • Compiler version xtensa-esp32-elf-gcc (crosstool-NG esp32-2018r1) 8.2.0
  • Operating System: Linux
  • Power Supply: external 3.3V

Problem Description

When calling mdns_free() or mdns_remove_all_services() an mDNS goodbye message is not sent. Using an iOS device, I can see it generate announcements when it wakes up and goodbyes when it goes to sleep in WireShark. Upon mDNS init, the ESP32 sends the announcesments for all configured services as can be observed in WireShark. mDNS discovery tools such as avahi-discover or dns-sd also show the presence of the ESP.

However, when mDNS services are removed or the mDNS service is stopped using mdns_free(), goodbye messages are not seen on the network and ESP devices still show up in avahi-discover and dns-sd

Expected Behavior

Goodbye messages are sent when shutting down mDNS and devices disappear from avahi-discover.

Actual Behavior

No goodbye messages are seen, and avahi-discover still shows devices in list.

Steps to repropduce

  1. Init mDNS stack and add services (services will be discovered on network and mDNS advertisedments seen in WireShark
  2. call mdns_free (services still advertiesed, no goodbye messages seen)
@github-actions github-actions bot changed the title mDNS does not send goodbye messages when removing services mDNS does not send goodbye messages when removing services (IDFGH-1379) Jun 19, 2019
@lucascoxBAF
Copy link

@liuzfesp @Alvin1Zhang , Any idea if there are plans to fix this soon? I have also noticed that there is no way to send "Announcements to Flush Outdated Cache Entries" per rfc 67662 section 10.2

@me-no-dev
Copy link
Member

I would guess that there is not enough time for the messages to be sent. Code is there though. If you remove the services before freeing the service, bye should be sent. It is implemented.

@me-no-dev
Copy link
Member

Here is the method that actually does it. You can trace it in the code and see how it's organised. https://github.com/espressif/esp-idf/blob/master/components/mdns/mdns.c#L1432

@david-cermak
Copy link
Collaborator

Let me just note a workaround to have the bye packet sent on mdns_remove_all_services(). It is possible to create a service with null instance, in that case a default instance name is used as service instance name:

    //set default mDNS instance name
    ESP_ERROR_CHECK( mdns_instance_name_set("ESP32-WebServer") );
    //initialize service
    ESP_ERROR_CHECK( mdns_service_add(NULL, "_http", "_tcp", 80, serviceTxtData, 3) );

The issue seems to be that the library tends to skip the function @me-no-dev referenced if the service has instance name configured. This should be fixed shortly.

@pete-maley
Copy link

Has there been any progress on this issue?

@david-cermak
Copy link
Collaborator

The fix is currently under review in the internal repository, sorry for the delay

@pete-maley
Copy link

Hello, just following up on this issue. Last update was that it was under internal review 25 days ago. Appreciate any updates you can provide.

@igrr igrr closed this as completed in a001998 Aug 21, 2019
david-cermak added a commit to david-cermak/esp-protocols that referenced this issue Mar 24, 2022
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue Mar 25, 2022
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue Apr 8, 2022
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 17, 2022
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 27, 2022
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 27, 2022
gabsuren pushed a commit to gabsuren/esp-protocols-1 that referenced this issue May 27, 2022
0xFEEDC0DE64 pushed a commit to 0xFEEDC0DE64/esp-protocols that referenced this issue Jun 30, 2022
euripedesrocha pushed a commit to euripedesrocha/esp-protocols that referenced this issue Oct 17, 2022
kyvaith pushed a commit to kyvaith/mdns that referenced this issue Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants