From 943df4cb6039072cbc2eb66c02311b6244bd1e95 Mon Sep 17 00:00:00 2001 From: Satoshi Togawa Date: Thu, 30 Jun 2022 11:13:15 +0900 Subject: [PATCH] pppd: Fix PAP Request packet. --- netutils/pppd/pap.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 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); - - /* Write peer length */ - *bptr++ = (uint8_t)t; + + /* Write peer-ID */ + 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 */