kopia lustrzana https://github.com/espressif/esp-idf
b5d13b9837
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 |
||
---|---|---|
.. | ||
dhcpserver | ||
ping | ||
sntp |