From c989c6adaedc1a53462f22ca8e1951c972b61622 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 6 Dec 2024 10:12:25 +0100 Subject: [PATCH] fix(modem): Fix PPP mode detection to accept LCP/conf --- components/esp_modem/src/esp_modem_dce.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/esp_modem/src/esp_modem_dce.cpp b/components/esp_modem/src/esp_modem_dce.cpp index 0a0ca14acd..f105516325 100644 --- a/components/esp_modem/src/esp_modem_dce.cpp +++ b/components/esp_modem/src/esp_modem_dce.cpp @@ -328,12 +328,19 @@ modem_mode DCE_Mode::guess_unsafe(DTE *dte, bool with_cmux) if (reply_pos >= sizeof(probe::ppp::lcp_echo_reply_head)) { // check for initial 2 bytes auto *ptr = static_cast(memmem(reply, reply_pos, probe::ppp::lcp_echo_reply_head.data(), 2)); - // and check the other two bytes for protocol ID: LCP + // and check the other two bytes for protocol ID: + // * either LCP reply if (ptr && ptr[3] == probe::ppp::lcp_echo_reply_head[3] && ptr[4] == probe::ppp::lcp_echo_reply_head[4]) { if (auto signal = weak_signal.lock()) { signal->set(probe::ppp::mode); } } + // * or LCP conf request + if (ptr && ptr[3] == probe::ppp::lcp_echo_request[3] && ptr[4] == probe::ppp::lcp_echo_request[4]) { + if (auto signal = weak_signal.lock()) { + signal->set(probe::ppp::mode); + } + } } if (reply_pos >= 4 && memmem(reply, reply_pos, probe::cmd::reply, sizeof(probe::cmd::reply))) { if (reply[0] != 0xf9) { // double check that the reply is not wrapped in CMUX headers