Skip to content

Commit eb8dad2

Browse files
committed
fix: Add warning to enable LWIP_NETIF_LOOPBACK to use control socket API
Closes espressif#13659
1 parent 856a299 commit eb8dad2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

components/esp_http_server/src/util/ctrl_sock.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -11,7 +11,7 @@
1111
#include <netinet/in.h>
1212
#include <arpa/inet.h>
1313
#include "sdkconfig.h"
14-
14+
#include "esp_log.h"
1515
#include "ctrl_sock.h"
1616

1717
#if CONFIG_IDF_TARGET_LINUX
@@ -22,11 +22,20 @@
2222
#define IPV6_ENABLED CONFIG_LWIP_IPV6
2323
#endif // !CONFIG_IDF_TARGET_LINUX
2424

25+
#if !CONFIG_LWIP_NETIF_LOOPBACK
26+
static const char *TAG = "esp_http_server";
27+
#endif
28+
2529
/* Control socket, because in some network stacks select can't be woken up any
2630
* other way
2731
*/
2832
int cs_create_ctrl_sock(int port)
2933
{
34+
#if !CONFIG_LWIP_NETIF_LOOPBACK
35+
ESP_LOGE(TAG, "Please enable LWIP_NETIF_LOOPBACK for %s API", __func__);
36+
return -1;
37+
#endif
38+
3039
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
3140
if (fd < 0) {
3241
return -1;

0 commit comments

Comments
 (0)