kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/lwip_add_option_to_enable_lwip_netif_api' into 'master'
lw-IP: added config option to enable LWIP_NETIF_API Closes IDF-1687 See merge request espressif/esp-idf!12237pull/6828/head
commit
3323e2e0a8
|
@ -7,6 +7,15 @@ menu "LWIP"
|
|||
The default name this device will report to other devices on the network.
|
||||
Could be updated at runtime with esp_netif_set_hostname()
|
||||
|
||||
config LWIP_NETIF_API
|
||||
bool "Enable usage of standard POSIX APIs in LWIP"
|
||||
default n
|
||||
help
|
||||
If this feature is enabled, standard POSIX APIs: if_indextoname(), if_nametoindex()
|
||||
could be used to convert network interface index to name
|
||||
instead of IDF specific esp-netif APIs (such as esp_netif_get_netif_impl_name())
|
||||
|
||||
|
||||
config LWIP_DNS_SUPPORT_MDNS_QUERIES
|
||||
bool "Enable mDNS queries in resolving host name"
|
||||
default y
|
||||
|
|
|
@ -448,6 +448,11 @@
|
|||
*/
|
||||
#define LWIP_NETIF_TX_SINGLE_PBUF 1
|
||||
|
||||
/**
|
||||
* LWIP_NETIF_API==1: Enable usage of standard POSIX APIs in LWIP.
|
||||
*/
|
||||
#define LWIP_NETIF_API CONFIG_LWIP_NETIF_API
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- LOOPIF options ----------
|
||||
|
@ -949,6 +954,7 @@
|
|||
#define ESP_IP4_ATON 1
|
||||
#define ESP_LIGHT_SLEEP 1
|
||||
#define ESP_L2_TO_L3_COPY CONFIG_LWIP_L2_TO_L3_COPY
|
||||
#define LWIP_NETIF_API CONFIG_LWIP_NETIF_API
|
||||
#define ESP_STATS_MEM CONFIG_LWIP_STATS
|
||||
#define ESP_STATS_DROP CONFIG_LWIP_STATS
|
||||
#define ESP_STATS_TCP 0
|
||||
|
|
|
@ -47,7 +47,11 @@ static void app_multiple_handle(esp_ip4_addr_t *ip4_addr, esp_netif_t *esp_netif
|
|||
*/
|
||||
#if CONFIG_EXAMPLE_BIND_SOCKET_TO_NETIF_NAME
|
||||
struct ifreq ifr;
|
||||
#if !CONFIG_LWIP_NETIF_API
|
||||
esp_netif_get_netif_impl_name(esp_netif, ifr.ifr_name);
|
||||
#else
|
||||
if_indextoname(esp_netif_get_netif_impl_index(esp_netif), ifr.ifr_name);
|
||||
#endif
|
||||
int ret = setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, (void*)&ifr, sizeof(struct ifreq));
|
||||
if (ret < 0) {
|
||||
ESP_LOGE(TAG, "\"%s\" Unable to bind socket to specified interface: errno %d", netif_name, errno);
|
||||
|
|
Ładowanie…
Reference in New Issue