8000 wiznet: Reset mDNS when interface is brought up. by greezybacon · Pull Request #16011 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

wiznet: Reset mDNS when interface is brought up. #16011

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
8000
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions extmod/network_wiznet5k.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "shared/netutils/netutils.h"
#include "lib/wiznet5k/Ethernet/wizchip_conf.h"
#include "lib/wiznet5k/Ethernet/socket.h"
#include "lwip/apps/mdns.h"
#include "lwip/err.h"
#include "lwip/dns.h"
#include "lwip/dhcp.h"
Expand Down Expand Up @@ -201,6 +202,9 @@ static void wiznet5k_config_interrupt(bool enabled) {
void wiznet5k_deinit(void) {
for (struct netif *netif = netif_list; netif != NULL; netif = netif->next) {
if (netif == &wiznet5k_obj.netif) {
#if LWIP_MDNS_RESPONDER
mdns_resp_remove_netif(&wiznet5k_obj.netif);
#endif
netif_remove(netif);
netif->flags = 0;
break;
Expand Down Expand Up @@ -334,6 +338,12 @@ static void wiznet5k_lwip_init(wiznet5k_obj_t *self) {
self->netif.flags |= NETIF_FLAG_UP;
dhcp_start(&self->netif);
self->netif.flags &= ~NETIF_FLAG_UP;

#if LWIP_MDNS_RESPONDER
// NOTE: interface is removed in ::wiznet5k_deinit(), which is called as
// part of the init sequence.
mdns_resp_add_netif(&self->netif, mod_network_hostname_data);
#endif
}

void wiznet5k_poll(void) {
Expand Down
Loading
0