ESP32 NetBIOS Name Service (NBNS) support?

A6ESPF
Posts: 28
Joined: Tue Dec 10, 2019 12:16 pm

ESP32 NetBIOS Name Service (NBNS) support?

Postby A6ESPF » Fri Feb 10, 2023 12:24 pm

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?

A6ESPF
Posts: 28
Joined: Tue Dec 10, 2019 12:16 pm

Re: ESP32 NetBIOS Name Service (NBNS) support?

Postby A6ESPF » Fri Feb 10, 2023 2:39 pm

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);

A6ESPF
Posts: 28
Joined: Tue Dec 10, 2019 12:16 pm

Re: ESP32 NetBIOS Name Service (NBNS) support?

Postby A6ESPF » Fri Feb 10, 2023 4:06 pm

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?

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 NetBIOS Name Service (NBNS) support?

Postby ESP_Sprite » Sat Feb 11, 2023 3:07 am

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.

Who is online

Users browsing this forum: No registered users and 106 guests