Skip to content

Commit c989c6a

Browse files
committed
fix(modem): Fix PPP mode detection to accept LCP/conf
1 parent 18f196f commit c989c6a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

components/esp_modem/src/esp_modem_dce.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,19 @@ modem_mode DCE_Mode::guess_unsafe(DTE *dte, bool with_cmux)
328328
if (reply_pos >= sizeof(probe::ppp::lcp_echo_reply_head)) {
329329
// check for initial 2 bytes
330330
auto *ptr = static_cast<uint8_t *>(memmem(reply, reply_pos, probe::ppp::lcp_echo_reply_head.data(), 2));
331-
// and check the other two bytes for protocol ID: LCP
331+
// and check the other two bytes for protocol ID:
332+
// * either LCP reply
332333
if (ptr && ptr[3] == probe::ppp::lcp_echo_reply_head[3] && ptr[4] == probe::ppp::lcp_echo_reply_head[4]) {
333334
if (auto signal = weak_signal.lock()) {
334335
signal->set(probe::ppp::mode);
335336
}
336337
}
338+
// * or LCP conf request
339+
if (ptr && ptr[3] == probe::ppp::lcp_echo_request[3] && ptr[4] == probe::ppp::lcp_echo_request[4]) {
340+
if (auto signal = weak_signal.lock()) {
341+
signal->set(probe::ppp::mode);
342+
}
343+
}
337344
}
338345
if (reply_pos >= 4 && memmem(reply, reply_pos, probe::cmd::reply, sizeof(probe::cmd::reply))) {
339346
if (reply[0] != 0xf9) { // double check that the reply is not wrapped in CMUX headers

0 commit comments

Comments
 (0)