Page 1 of 1

ESP32 NetBIOS Name Service (NBNS) support?

Posted: Fri Feb 10, 2023 12:24 pm
by A6ESPF
Does ESP32 support NetBIOS Name Service discovery? When I use Angry IP Scanner to scan the IP address of my ESP32 (sending 3 ICMP requests and then 4 NBNS requests), I get the following warnings in the terminal:

Code: Select all

W (1434746) httpd: httpd_accept_conn: error in accept (128)
W (1434746) httpd: httpd_server: error accepting new connection
When scanning the packets sent and received with Wireshark, I can see that the ESP responds with Destination unreachable (Port unreachable) to NBNS requests. Port that was used for NBNS requests is 137. How do I make that port accessible on ESP32?

Re: ESP32 NetBIOS Name Service (NBNS) support?

Posted: Fri Feb 10, 2023 2:39 pm
by A6ESPF
I forgot to add that I have included "lwip/apps/netbiosns.h" in my application and added these lines before initializing Wi-Fi:

Code: Select all

netbiosns_init();
char netbios_hostname[16] = "netbios_test";
netbiosns_set_name(netbios_hostname);

Re: ESP32 NetBIOS Name Service (NBNS) support?

Posted: Fri Feb 10, 2023 4:06 pm
by A6ESPF
I've found that modifying the define LWIP_NETBIOS_RESPOND_NAME_QUERY to 1 in esp-idf-v4.4/components/lwip/lwip/src/include/lwip/apps/netbiosns_opts.h solves the issue, but I'm not very fond of modifying esp-idf source code. Is it possible to enable this option some other way? I've tried defining LWIP_NETBIOS_RESPOND_NAME_QUERY before including netbiosns.h in my application, but it doesn't work. Any ideas?

Re: ESP32 NetBIOS Name Service (NBNS) support?

Posted: Sat Feb 11, 2023 3:07 am
by ESP_Sprite
You can copy the entire LWIP component over to your project and modify it there, which is marginally cleaner (project components override ESP-IDF components with the same name). Alternatively you can file an issue (or better: a pull request) to have this configurable in Menuconfig; that's probably the most elegant option.