Commit Graph

97 Commits

Author SHA1 Message Date
zhangyanjiao
eaef3a2683 fix(lwip): fixed the dhcp pool error on dhcp server 2024-05-27 14:51:00 +08:00
David Čermák
31253679d9 Merge branch 'bugfix/bind_dhcps_netif' into 'master'
fix(lwip/dhcp_server): Bind dhcps netif to avoid handling the dhcp packet from other netif

See merge request espressif/esp-idf!30537
2024-05-09 19:44:19 +08:00
jkingsman
3035ce294d feat(esp_netif): add support for DHCP Option 114 captive portal URI
DHCP Option 114 provides a modern method of indicating a captive
portal redirect to DHCP client. This introduces Option 114 to
the DHCPS component as well as provides examples for usage.
2024-05-02 22:50:09 +08:00
Xu Chun Guang
294b418686 docs: Correct spell error in comment 2024-04-28 17:48:04 +08:00
Xu Chun Guang
226c7772b8 fix(lwip/dhcp_server): Bind dhcps netif to avoid handling the dhcp packet from other netifs 2024-04-28 16:28:48 +08:00
David Cermak
c30f2825d5 fix(netif): Add missing SNTP get-reachablitiy API 2024-02-29 23:37:45 +08:00
zhangyanjiao
04ea824740 fix(lwip): Modify the DHCP offer and DHCP ack from broadcast to unicast 2023-10-09 17:52:01 +08:00
xueyunfei
fff7c6a399 fix(dhcp server):fix set dhcp server poll fail issue 2023-09-13 10:20:02 +08:00
David Cermak
c510560890 lwip: Fix print format -Wformat issues 2023-08-15 11:01:01 +02:00
xueyunfei
15be9a0c3a fix(dhcp server): Fix dhcp server address pool issue 2023-07-25 20:48:19 +08:00
Ondrej Kosta
3288f83401 feat(network/examples): extended LwIP bridge example
Extended LwIP bridge example to support WiFi AP interface and DHCP Server

https://github.com/espressif/esp-idf/issues/5697
2023-06-30 14:38:24 +02:00
wuyuanyi135
97c44ee95d
Fix incorrect invocation of the hook LWIP_HOOK_DHCPS_POST_APPEND_OPTS
Fix https://github.com/espressif/esp-idf/issues/11373
2023-05-10 19:52:40 +08:00
Jiang Jiang Jian
df6b33712f Merge branch 'Bugfix/softap_support_CIDR' into 'master'
Bugfix for softap support CIDR

Closes IDFGH-8574

See merge request espressif/esp-idf!22471
2023-03-02 14:03:00 +08:00
David Čermák
956e62c461 Merge branch 'feature/lwip_ipv6_only' into 'master'
lwip: Support IPv6 only mode

Closes IDF-6023

See merge request espressif/esp-idf!20468
2023-03-01 21:38:10 +08:00
David Cermak
5f6cb31105 lwip: Support IPv6 only mode 2023-02-27 08:53:34 +01:00
xueyunfei
4f0732cf05 Fixed bug for dhcp server support CIDR
Closes https://github.com/espressif/esp-idf/issues/10024

Closes https://github.com/espressif/esp-idf/issues/10559
2023-02-24 14:24:49 +08:00
David Cermak
708641204e lwip: Add missing esp_sntp_enabled() 2023-02-24 07:23:55 +01:00
David Cermak
e8ee09d817 lwip/sntp: Fix esp_sntp_ API races
Some of the esp_sntp_...() APIs that wrap lwip's SNTP
module use tcpip_callback() to execute the lwip functionality
in the correct state (either with locked TCP/IP core,
or within the TCP/IP thread).
tcpip_callback() however doesn't wait for completion of the callback,
which doesn't prevent from using the stack variables after destroy
if used as a parameter.
Introduced in a71fa82.
Fixed by using of tcpip_api_call() instead of the tcpip_callback().

Closes https://github.com/espressif/esp-idf/issues/10611
2023-01-31 18:25:35 +01:00
David Cermak
fa97004faf lwip: Support for linux target
Implement linux port layer and reuse the original FreeRTOS layer
that's compiled and used on linux target as well, by means of FreeRTOS
simulator.
2023-01-31 08:43:45 +01:00
David Cermak
a71fa82177 esp_netif/lwip: Fix core-locking config
* Fix thread safety issues in non-core locking
* Add option to verify thread safety issues in lwip (core-lock assertion)
* Make esp_sntp.h thread safe API
* Fix sntp examples
* Fix openthread libs

Closes https://github.com/espressif/esp-idf/issues/9908
Closes https://github.com/espressif/esp-idf/issues/10502
Closes https://github.com/espressif/esp-idf/issues/10466
2023-01-17 16:15:58 +01:00
xueyunfei
1ae1723d23 dhcp server:bugfix softap excedes the range of subnet 2022-12-16 14:25:04 +08:00
David Cermak
9e31c5077d lwip: Document 32 bit NTP timestamp converstion to 64b time_t 2022-09-21 17:38:37 +02:00
David Cermak
b5d13b9837 lwip/dhcpserver: Support for adding extra opts
This enables users appending an extra, user defined options in dhcp
server messages. Example of adding captive_portal option (160) to dhcp
offer message is provided:
* Add idf-lwip hook file (project makefile):
  idf_component_get_property(lwip lwip COMPONENT_LIB)
  target_compile_options(${lwip} PRIVATE "-I${PROJECT_DIR}/main")
  target_compile_definitions(${lwip} PRIVATE "-DESP_IDF_LWIP_HOOK_FILENAME=\"add_captive_portal.h\"")
* Implement appending (add_captive_portal.h):
  #pragma once
  #define LWIP_HOOK_DHCPS_POST_APPEND_OPTS(netif, dhcp, state, pp_opts) \
  if ((state)==DHCPOFFER) { *(pp_opts) = append_captive_portal_uri(*(pp_opts)); }
  static inline uint8_t *append_captive_portal_uri(uint8_t *optptr)
  {
    const static uint8_t DHCP_OPTION_CAPTIVE_PORTAL=160;
    const static char CAPTIVE_PORTAL_URI[]="my_uri";
    int size = sizeof(CAPTIVE_PORTAL_URI) - 1;
    *optptr++ = DHCP_OPTION_CAPTIVE_PORTAL;
    *optptr++ = size;
    for(int i = 0; i < size; ++i) {
        *optptr++ = CAPTIVE_PORTAL_URI[i];
    }
    return optptr;
  }

Merges https://github.com/espressif/esp-idf/pull/3308
2022-07-26 07:09:22 +00:00
xueyunfei
45ad770c37 Icmp: get tos parameter in icmp reply 2022-07-05 11:37:41 +08:00
xueyunfei
b569f4069a bugfix for add ttl for ping socket 2022-07-05 11:37:41 +08:00
David Cermak
5aa3be11fd dhcpserver: Minor #idfef fix 2022-05-18 17:11:35 +02:00
David Cermak
27375c7917 esp_netif: Cleanup dhcp-server allocations 2022-03-13 19:40:00 +01:00
David Cermak
1b49cf373f lwip/dhcps: Fix fuzzer compilation 2022-03-13 19:40:00 +01:00
David Cermak
3d1c05aefb lwip/dhcps: Add dhcps callback argument for associated netif 2022-03-13 19:40:00 +01:00
David Cermak
5f135741a1 lwip/dhcpserver: Add return value to API that could fail 2022-03-13 19:40:00 +01:00
David Cermak
afe6bc0c88 lwip/dhcp_server: Fix mem-leaks caught by UT's 2022-03-13 19:40:00 +01:00
David Cermak
c005b04d1c lwip/dhcps: Support for dynamic dhcp server instances 2022-03-13 19:39:21 +01:00
David Cermak
bab051f450 lwip/dhcps: Cleanup internal lwip and esp-netif dependency 2022-03-13 19:38:15 +01:00
David Cermak
05911fd4a1 lwip: Add dhcp servers post processing hook
In order to access DHCP messages from clients in different states
and possibly to implement custom handlers that alter the current state,
e.g. reject a client with specific hostname using NAK.
2022-01-26 07:18:48 +01:00
David Cermak
e3d71c984a lwip: Add client's MAC addr to dhcp server cb
* Extended storage for staipassigned events to pass client's MAC address.
* Added client's MAC to dhcp server callback
* Posting the staipassigned events with clients IP and MAC address
2022-01-25 13:08:43 +01:00
AndriiFilippov
f42d1f48c6 unified replace PING_CHECK by ESP_GOTO_ON_FALSE
unified replace PING_CHECK by ESP_GOTO_ON_FALSE

replace PING_CHECK macro by ESP_GOTO_ON_FALSE

Include header

grammar fix
2021-11-30 10:12:09 +01:00
David Cermak
7b91343ca7 lwip: Fix ping socket create to allow for fd=0
0 is a valid socket description, so should be accepted after we create a
socket. In IDF, though, it's just a theoretical issue, as customers have
to configure:
* FD_SETSIZE = CONFIG_LWIP_MAX_SOCKETS (from makefiles)
* CONFIG_VFS_SUPPORT_IO = n (from menuconfig)

(this configuration is currently broken, but if we adjust the IDF here
and there we could reproduce the issue)
2021-10-26 08:19:26 +02:00
David Čermák
756cc4f8dc Merge branch 'bugfix/esp_sntp_declare' into 'master'
lw-ip: Fix sntp custom options if sntp_get_system_time used

Closes FCS-710

See merge request espressif/esp-idf!14556
2021-08-23 15:11:26 +00:00
David Cermak
457d837b40 lwip: Fix sntp custom options if sntp_get_system_time used 2021-08-23 11:47:44 +02:00
ivmarkov
ee531c748a lwip: Fix ICMP Ping on specific iface
Fix broken parentheses in setsockopt call

Merges https://github.com/espressif/esp-idf/pull/7397
2021-08-19 09:55:26 +02:00
yuanjm
e9dab3203e ping_sock: Fix esp_ping_new_session may return ESP_OK when the error occured
Closes https://github.com/espressif/esp-idf/issues/7363
2021-08-05 10:38:38 +08:00
David Cermak
96911fb7ea lwip: Fix DHCP Server to remove clients record if request not acked
When client's request refused by sending NAK, its record still resided
in the linked list of pooled addresses. It is okay from the spec
perspective (RFC2131.p16: Server MAY mark the offered address
unavailable), but would consume some memory if the client didn't retry.

Closes https://github.com/espressif/esp-idf/issues/6410
2021-06-24 15:10:24 +08:00
yuanjm
d80db218da lwip: Add LWIP_IPV6 macro to strip IPv6 function in LWIP component 2021-02-23 18:26:03 +08:00
Chen Wu
8207f6ac32 lwip: Fixed ping assert reset when ping interval is 0 2021-01-26 10:48:56 +00:00
morris
753a929525 global: fix sign-compare warnings 2021-01-12 14:05:08 +08:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
xueyunfei
79fc027830 lwip:add feature for ipv6 ping 2020-10-22 15:01:59 +08:00
ronghulin
9230e0d26d bugfix: fix ICMP specify length issue 2020-06-28 10:46:43 +08:00
David Cermak
fa57bdbdbe dhcpserver: make subnet mask configurable
Closes https://github.com/espressif/esp-idf/issues/4988
2020-04-30 14:04:22 +00:00
David Cermak
72d54b68a6 lwip: dhcp-server fix static analysis warnings
1) kill_oldest_dhcps_pool() is only called when list has at least two members (assured with kconfig value limit), added assertion to ensure this function is used only when prerequisities are met
2) use after free reported in two places, since the analyzer checks also the scenario when the linked list has loops, added ignore tags
2020-03-27 18:46:39 +01:00