This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push: new 943df4cb6 pppd: Fix PAP Request packet. 943df4cb6 is described below commit 943df4cb6039072cbc2eb66c02311b6244bd1e95 Author: Satoshi Togawa <taiko...@users.noreply.github.com> AuthorDate: Thu Jun 30 11:13:15 2022 +0900 pppd: Fix PAP Request packet. --- netutils/pppd/pap.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/netutils/pppd/pap.c b/netutils/pppd/pap.c index 081c1afa2..4ee7dd5c7 100644 --- a/netutils/pppd/pap.c +++ b/netutils/pppd/pap.c @@ -137,7 +137,8 @@ void pap_task(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer) if (!(ctx->pap_state & PAP_TX_UP) && !(ctx->pap_state & PAP_TX_TIMEOUT)) { /* Do we need to send a PAP auth packet? Check if we have a request - * pending */ + * pending. + */ if ((ppp_arch_clock_seconds() - ctx->pap_prev_seconds) > PAP_TIMEOUT) { @@ -159,16 +160,25 @@ void pap_task(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer) /* Write options */ + /* Write peer-ID length */ + t = strlen((char *)ctx->settings->pap_username); + *bptr++ = (uint8_t)t; - /* Write peer length */ + /* Write peer-ID */ - *bptr++ = (uint8_t)t; bptr = memcpy(bptr, ctx->settings->pap_username, t); + bptr += t; + + /* Write passwd length */ t = strlen((char *)ctx->settings->pap_password); *bptr++ = (uint8_t)t; + + /* Write passwd */ + bptr = memcpy(bptr, ctx->settings->pap_password, t); + bptr += t; /* Write length */