From d15cbb20f035bca6ffa49b9dae7fe298e20eb569 Mon Sep 17 00:00:00 2001 From: pablo Date: Thu, 17 Jun 2021 20:26:33 -0300 Subject: [PATCH 1/3] fix 8139 netbios in AP mode --- libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp index 1219cfb32a..72c4189d40 100644 --- a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp +++ b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp @@ -212,7 +212,10 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint1 nbnsa.NBNSA_TIMETOLIVE = LWIP_PLATFORM_HTONL(300000UL);// Time to live (30000 sekund) nbnsa.NBNSA_LENGTH = LWIP_PLATFORM_HTONS(6); nbnsa.NBNSA_NODEFLAGS = LWIP_PLATFORM_HTONS(0); - nbnsa.NBNSA_NODEADDRESS = WiFi.localIP(); // ulozime nasi IP adresu + if (WiFi.getMode()==WIFI_STA) + nbnsa.NBNSA_NODEADDRESS = WiFi.localIP(); // ulozime nasi IP adresu + else + nbnsa.NBNSA_NODEADDRESS = WiFi.softAPIP(); // ulozime nasi IP adresu pbuf* pbt = pbuf_alloc(PBUF_TRANSPORT, sizeof(nbnsa), PBUF_RAM); if(pbt != NULL) { From a77f3e4fe49009e996f7ae1c63765b1289326148 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Tue, 28 Jun 2022 01:51:07 +0300 Subject: [PATCH 2/3] take the current if addr --- libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp index 72c4189d40..b0e900d920 100644 --- a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp +++ b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp @@ -212,11 +212,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint1 nbnsa.NBNSA_TIMETOLIVE = LWIP_PLATFORM_HTONL(300000UL);// Time to live (30000 sekund) nbnsa.NBNSA_LENGTH = LWIP_PLATFORM_HTONS(6); nbnsa.NBNSA_NODEFLAGS = LWIP_PLATFORM_HTONS(0); - if (WiFi.getMode()==WIFI_STA) - nbnsa.NBNSA_NODEADDRESS = WiFi.localIP(); // ulozime nasi IP adresu - else - nbnsa.NBNSA_NODEADDRESS = WiFi.softAPIP(); // ulozime nasi IP adresu - + nbnsa.NBNSA_NODEADDRESS = ip_current_netif()->ip_addr.addr; pbuf* pbt = pbuf_alloc(PBUF_TRANSPORT, sizeof(nbnsa), PBUF_RAM); if(pbt != NULL) { uint8_t* dst = reinterpret_cast(pbt->payload); From cfb88b731b9f8540a65c6e015a6e17f4af0e8058 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Tue, 28 Jun 2022 15:27:00 +0300 Subject: [PATCH 3/3] handle enabled ipv6 --- libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp index b0e900d920..3b4b8c6afc 100644 --- a/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp +++ b/libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp @@ -212,7 +212,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint1 nbnsa.NBNSA_TIMETOLIVE = LWIP_PLATFORM_HTONL(300000UL);// Time to live (30000 sekund) nbnsa.NBNSA_LENGTH = LWIP_PLATFORM_HTONS(6); nbnsa.NBNSA_NODEFLAGS = LWIP_PLATFORM_HTONS(0); - nbnsa.NBNSA_NODEADDRESS = ip_current_netif()->ip_addr.addr; + nbnsa.NBNSA_NODEADDRESS = ip_addr_get_ip4_u32(&ip_current_netif()->ip_addr); pbuf* pbt = pbuf_alloc(PBUF_TRANSPORT, sizeof(nbnsa), PBUF_RAM); if(pbt != NULL) { uint8_t* dst = reinterpret_cast(pbt->payload);