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

How to disable mDNS integration? (IDFGH-14828) #104

Open
3 tasks done
esp-dev opened this issue Mar 11, 2025 · 5 comments
Open
3 tasks done

How to disable mDNS integration? (IDFGH-14828) #104

esp-dev opened this issue Mar 11, 2025 · 5 comments

Comments

@esp-dev
Copy link

esp-dev commented Mar 11, 2025

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate.
  • Provided a clear description of your suggestion.
  • Included any relevant context or examples.

Issue or Suggestion Description

Hi,

I have a question regarding mDNS integration, how to disable it (in esp-modbus) if I already configure DNS in my part of the code?

@github-actions github-actions bot changed the title How to disable mDNS integration? How to disable mDNS integration? (IDFGH-14828) Mar 11, 2025
@alisitsyn
Copy link
Collaborator

alisitsyn commented Mar 11, 2025

Hi,

(the below is related to esp-modbus v2.x.x)
You do not need to disable the mDNS in the esp-modbus stack specifically. The stack is able to recognize if this optional dependency enabled for your project and will use the related functionality only if you added the mDNS dependency into your project. In this case if the mDNS dependency is not enable but you try to configure stack using the mdns host names in the configuration of your object the stack will report error and will not be able to resolve the host names. The dependency is resolved on CMAKE layer.

@alisitsyn alisitsyn self-assigned this Mar 11, 2025
@esp-dev
Copy link
Author

esp-dev commented Mar 11, 2025

Hi,

thx for reply.

I already use esp-mdns in the project for something else, I would like the modbus stack not to perform independent mdns configuration because I want to customize it accordingly. In addition, the modbus stack in the mdns context needs a pointer to the interface, which is not convenient and providing a NULL value causes a crash. The only solution I have found at the moment is to move from managed_components to components of the esp-modbus directory and comment out target_compile_definitions(${COMPONENT_LIB} PUBLIC -DMB_MDNS_IS_INCLUDED) which is not very elegant.

@alisitsyn
Copy link
Collaborator

alisitsyn commented Mar 12, 2025

Hi,

I already use esp-mdns in the project for something else, I would like the modbus stack not to perform independent mdns configuration because I want to customize it accordingly.

The mdns functionality designed to be transparent for esp-modbus. So, you need to disable the mdns for esp-modbus but want to use in your project? I can consider some update for this but need to understand the issue in your project better.

In addition, the modbus stack in the mdns context needs a pointer to the interface, which is not convenient and providing a NULL value causes a crash.

Could you describe the issue in more details with the logs? We can talk about possible solution then.

Thanks.

@esp-dev
Copy link
Author

esp-dev commented Mar 14, 2025

Hi @alisitsyn,

so I wanted to disable everything related to mDNS in the library, because in our project espressif-mdns is already integrated and used for example to advertise the http service. So it is not a problem for us to add modbus advertising there too. Moreover, our project requires that the modbus service can be stopped and its port changed using configuration without restarting the system, so the service must be dynamically added and deleted from mDNS, therefore it is better to support mDNS externally (in our project). BTW (we use the modbus library in slave tcp mode) the tcp socket accepting connections is not closed by deinit/delete duncrionI don’t remember name, which prevents it from being restarted becouse port is in use.

@alisitsyn
Copy link
Collaborator

Hi @esp-dev,

Thank you for update. This explains your project better and some investigation and refactoring is planned to provide better way for mDNS integration in the esp-modbus. I am going to do this once possible. For now my proposal is the simple change in the esp-modbus library as a kconfig option which would allow to explicitly disable/enable esp-modbus - mDNS integration. Will this solve the issue in your project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants