-
Notifications
You must be signed in to change notification settings - Fork 138
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
fix(mdns): Fix compile error when MDNS_PREDEF_NETIF_ETH is defined, but ETH_ENABLED is not (IDFGH-11868) #479
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for posting the fix!
I think that we shouldn't try to handle Ethernet events if CONFIG_MDNS_PREDEF_NETIF_ETH=n
.
Would this change fix the issue?
diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c
index 1149ff7..2c95bdc 100644
--- a/components/mdns/mdns.c
+++ b/components/mdns/mdns.c
@@ -3925,7 +3925,7 @@ void mdns_preset_if_handle_system_event(void *arg, esp_event_base_t event_base,
break;
}
}
-#if CONFIG_ETH_ENABLED
+#if CONFIG_ETH_ENABLED && CONFIG_MDNS_PREDEF_NETIF_ETH
else if (event_base == ETH_EVENT) {
switch (event_id) {
case ETHERNET_EVENT_CONNECTED:
I didn't do this because I thought the user could add their own
Ethernet netif, even if the predefined one is disabled. Should I add
this?
|
Yes, this is the idea, but if users add their own interfaces, they have to take care of event handling in the application code (as the library couldn't possibly handle status changes of various netifs which are under user control), there's a convenient API provided just for this purpose: esp-protocols/components/mdns/include/mdns.h Lines 812 to 831 in 5ab699d
The role of predefined interfaces is a legacy handling of the default netifs that were present (hardcoded) in older IDF versions.
If you're willing to address this issue, I'd suggest you update your commit accordingly. (but only if you feel like you'd like to contribute, which is much appreciated :-) |
b372551
to
dce4339
Compare
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the effort! One minor nitpick, LGTM otherwise.
dce4339
to
e529bee
Compare
Saw that you had pushed from dce4339 to e529bee, but there's no diff in the code. Also please note that we've got some trouble with our CI, most of the tests are failing (should be fixed soon). |
…ut ETH_ENABLED is not (espressif#459) Signed-off-by: Marek Maškarinec <marek@mrms.cz>
e529bee
to
6d2c475
Compare
Sorry, I seem to have committed incorrectly. It's fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
This is a fix for the issue #459.