@@ -49,6 +49,7 @@ try changing the first byte of tud_network_mac_address[] below from 0x02 to 0x00
4949#include "lwip/init.h"
5050#include "lwip/timeouts.h"
5151#include "lwip/apps/httpd.h"
52+ #include "lwip/apps/mdns.h"
5253
5354#define INIT_IP4 (a ,b ,c ,d ) { PP_HTONL(LWIP_MAKEU32(a,b,c,d)) }
5455
@@ -117,7 +118,7 @@ static err_t netif_init_cb(struct netif *netif)
117118{
118119 LWIP_ASSERT ("netif != NULL" , (netif != NULL ));
119120 netif -> mtu = CFG_TUD_NET_MTU ;
120- netif -> flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP ;
121+ netif -> flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP | NETIF_FLAG_IGMP ;
121122 netif -> state = NULL ;
122123 netif -> name [0 ] = 'E' ;
123124 netif -> name [1 ] = 'X' ;
@@ -154,7 +155,7 @@ bool dns_query_proc(const char *name, ip4_addr_t *addr)
154155
155156bool tud_network_recv_cb (const uint8_t * src , uint16_t size )
156157{
157- /* this shouldn't happen, but if we get another packet before
158+ /* this shouldn't happen, but if we get another packet before
158159 parsing the previous, we must signal our inability to accept it */
159160 if (received_frame )
160161 return false;
@@ -209,9 +210,12 @@ void tud_network_init_cb(void)
209210 pbuf_free (received_frame );
210211 received_frame = NULL ;
211212 }
213+
214+ /* re-announce mDNS, so hostname resolves after reconnect, getting issues on windows on hard-refresh without this */
215+ mdns_resp_announce (& netif_data );
212216}
213217
214- int rndis_init (void )
218+ int rndis_init (const char * hostname )
215219{
216220 // Removed as rndis defect 07-08-2025 as we need to setup TinyUSB to non-default values
217221 ///* initialize TinyUSB */
@@ -225,6 +229,8 @@ int rndis_init(void)
225229 ;
226230 while (dnserv_init (& ipaddr , 53 , dns_query_proc ) != ERR_OK )
227231 ;
232+ mdns_resp_init ();
233+ mdns_resp_add_netif (& netif_data , hostname );
228234 httpd_init ();
229235
230236 return 0 ;
0 commit comments