pap.c
Go to the documentation of this file.
1 /**
2  * @file pap.c
3  * @brief PAP (Password Authentication Protocol)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL PPP_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "ppp/ppp_debug.h"
37 #include "ppp/lcp.h"
38 #include "ppp/ipcp.h"
39 #include "ppp/ipv6cp.h"
40 #include "ppp/pap.h"
41 #include "debug.h"
42 
43 //Check TCP/IP stack configuration
44 #if (PPP_SUPPORT == ENABLED && PAP_SUPPORT == ENABLED)
45 
46 
47 /**
48  * @brief Start PAP authentication
49  * @param[in] context PPP context
50  * @return Error code
51  **/
52 
54 {
55  //Debug message
56  TRACE_INFO("\r\nStarting PAP authentication...\r\n");
57 
58  //Check whether the other end of the PPP link is being authenticated
59  if(context->localConfig.authProtocol == PPP_PROTOCOL_PAP)
60  {
61  //Switch to the Started state
62  context->papFsm.localState = PAP_STATE_1_STARTED;
63  }
64 
65  //Check whether the other end of the PPP link is the authenticator
66  if(context->peerConfig.authProtocol == PPP_PROTOCOL_PAP)
67  {
68  //Initialize restart counter
69  context->papFsm.restartCounter = PAP_MAX_REQUESTS;
70  //Send Authenticate-Request packet
71  papSendAuthReq(context);
72  //Switch to the Req-Sent state
73  context->papFsm.peerState = PAP_STATE_2_REQ_SENT;
74  }
75 
76  //Successful processing
77  return NO_ERROR;
78 }
79 
80 
81 /**
82  * @brief Abort PAP authentication
83  * @param[in] context PPP context
84  * @return Error code
85  **/
86 
88 {
89  //Debug message
90  TRACE_INFO("\r\nAborting PAP authentication...\r\n");
91 
92  //Abort PAP authentication process
93  context->papFsm.localState = PAP_STATE_0_INITIAL;
94  context->papFsm.peerState = PAP_STATE_0_INITIAL;
95 
96  //Successful processing
97  return NO_ERROR;
98 }
99 
100 
101 /**
102  * @brief PAP timer handler
103  *
104  * This routine must be periodically called by the TCP/IP stack to
105  * manage retransmissions
106  *
107  * @param[in] context PPP context
108  **/
109 
110 void papTick(PppContext *context)
111 {
112  //Check whether the restart timer is running
113  if(context->papFsm.peerState == PAP_STATE_2_REQ_SENT)
114  {
115  //Get current time
117 
118  //Check restart timer
119  if((time - context->papFsm.timestamp) >= PAP_RESTART_TIMER)
120  {
121  //Debug message
122  TRACE_INFO("\r\nPAP Timeout event\r\n");
123 
124  //Check whether the restart counter is greater than zero
125  if(context->papFsm.restartCounter > 0)
126  {
127  //Retransmit the Authenticate-Request packet
128  papSendAuthReq(context);
129  }
130  else
131  {
132  //Abort PAP authentication
133  context->papFsm.peerState = PAP_STATE_0_INITIAL;
134  //Authentication failed
135  lcpClose(context);
136  }
137  }
138  }
139 }
140 
141 
142 /**
143  * @brief Process an incoming PAP packet
144  * @param[in] context PPP context
145  * @param[in] packet PAP packet received from the peer
146  * @param[in] length Length of the packet, in bytes
147  **/
148 
150  const PppPacket *packet, size_t length)
151 {
152  //Ensure the length of the incoming PAP packet is valid
153  if(length < sizeof(PppPacket))
154  return;
155 
156  //Check the length field
157  if(ntohs(packet->length) > length)
158  return;
159  if(ntohs(packet->length) < sizeof(PppPacket))
160  return;
161 
162  //Save the length of the PAP packet
163  length = ntohs(packet->length);
164 
165  //Debug message
166  TRACE_INFO("PAP packet received (%" PRIuSIZE " bytes)...\r\n", length);
167  //Dump PAP packet contents for debugging purpose
169 
170  //Because the Authenticate-Ack might be lost, the authenticator must
171  //allow repeated Authenticate-Request packets after completing the
172  //Authentication phase
173  if(context->pppPhase != PPP_PHASE_AUTHENTICATE &&
174  context->pppPhase != PPP_PHASE_NETWORK)
175  {
176  //Any packets received during any other phase must be silently discarded
177  return;
178  }
179 
180  //Check PAP code field
181  switch(packet->code)
182  {
183  //Authenticate-Request packet?
184  case PAP_CODE_AUTH_REQ:
185  //Process Authenticate-Request packet
186  papProcessAuthReq(context, (PapAuthReqPacket *) packet, length);
187  break;
188  //Authenticate-Ack packet?
189  case PAP_CODE_AUTH_ACK:
190  //Process Authenticate-Ack packet
191  papProcessAuthAck(context, (PapAuthAckPacket *) packet, length);
192  break;
193  //Authenticate-Nak packet?
194  case PAP_CODE_AUTH_NAK:
195  //Process Authenticate-Nak packet
196  papProcessAuthNak(context, (PapAuthNakPacket *) packet, length);
197  break;
198  //Unknown code field
199  default:
200  //Silently drop the incoming packet
201  break;
202  }
203 }
204 
205 
206 /**
207  * @brief Process Authenticate-Request packet
208  * @param[in] context PPP context
209  * @param[in] authReqPacket Packet received from the peer
210  * @param[in] length Length of the packet, in bytes
211  * @return Error code
212  **/
213 
215  const PapAuthReqPacket *authReqPacket, size_t length)
216 {
217  bool_t status;
218  size_t usernameLen;
219  const uint8_t *p;
220 
221  //Debug message
222  TRACE_INFO("\r\nPAP Authenticate-Request packet received\r\n");
223 
224  //Make sure the Authenticate-Request packet is acceptable
225  if(context->localConfig.authProtocol != PPP_PROTOCOL_PAP)
226  return ERROR_FAILURE;
227 
228  //Check the length of the packet
229  if(length < sizeof(PapAuthReqPacket))
230  return ERROR_INVALID_LENGTH;
231 
232  //Retrieve the length of the Peer-ID field
233  usernameLen = authReqPacket->peerIdLength;
234 
235  //Malformed Authenticate-Request packet?
236  if(length < (sizeof(PapAuthReqPacket) + 1 + usernameLen))
237  return ERROR_INVALID_LENGTH;
238 
239  //Limit the length of the string
240  usernameLen = MIN(usernameLen, PPP_MAX_USERNAME_LEN);
241  //Copy the name of the peer to be identified
242  osMemcpy(context->peerName, authReqPacket->peerId, usernameLen);
243  //Properly terminate the string with a NULL character
244  context->peerName[usernameLen] = '\0';
245 
246  //Point to the Passwd-Length field
247  p = authReqPacket->peerId + usernameLen;
248 
249  //Save the length of Password field
250  context->papFsm.passwordLen = p[0];
251  //Point to the Password field
252  context->papFsm.password = p + 1;
253 
254  //Malformed Authenticate-Request packet?
255  if(length < (sizeof(PapAuthReqPacket) + 1 + usernameLen + context->papFsm.passwordLen))
256  return ERROR_INVALID_LENGTH;
257 
258  //Invoke user-defined callback, if any
259  if(context->settings.authCallback != NULL)
260  {
261  //Perfom username and password verification
262  status = context->settings.authCallback(context->interface,
263  context->peerName);
264  }
265  else
266  {
267  //Unable to perform authentication...
268  status = FALSE;
269  }
270 
271  //Successful authentication?
272  if(status)
273  {
274  //If the Peer-ID/Password pair received in the Authenticate-Request
275  //is both recognizable and acceptable, then the authenticator must
276  //transmit an Authenticate-Ack packet
277  papSendAuthAck(context, authReqPacket->identifier);
278 
279  //Switch to the Ack-Sent state
280  context->papFsm.localState = PAP_STATE_4_ACK_SENT;
281  //The user has been successfully authenticated
282  context->localAuthDone = TRUE;
283 
284  //Check whether PPP authentication is complete
285  if(context->localAuthDone && context->peerAuthDone)
286  {
287  //Check current PPP phase
288  if(context->pppPhase == PPP_PHASE_AUTHENTICATE)
289  {
290  //Advance to the Network phase
291  context->pppPhase = PPP_PHASE_NETWORK;
292 
293 #if (IPV4_SUPPORT == ENABLED)
294  //IPCP Open event
295  ipcpOpen(context);
296 #endif
297 #if (IPV6_SUPPORT == ENABLED)
298  //IPV6CP Open event
299  ipv6cpOpen(context);
300 #endif
301  }
302  }
303  }
304  else
305  {
306  //If the Peer-ID/Password pair received in the Authenticate-Request
307  //is not recognizable or acceptable, then the authenticator must
308  //transmit an Authenticate-Nak packet
309  papSendAuthNak(context, authReqPacket->identifier);
310 
311  //Switch to the Nak-Sent state
312  context->papFsm.localState = PAP_STATE_6_NAK_SENT;
313  //The authenticator should take action to terminate the link
314  lcpClose(context);
315  }
316 
317  //Successful processing
318  return NO_ERROR;
319 }
320 
321 
322 /**
323  * @brief Process Authenticate-Ack packet
324  * @param[in] context PPP context
325  * @param[in] authAckPacket Packet received from the peer
326  * @param[in] length Length of the packet, in bytes
327  * @return Error code
328  **/
329 
331  const PapAuthAckPacket *authAckPacket, size_t length)
332 {
333  //Debug message
334  TRACE_INFO("\r\nPAP Authenticate-Ack packet received\r\n");
335 
336  //Make sure the Authenticate-Ack packet is acceptable
337  if(context->peerConfig.authProtocol != PPP_PROTOCOL_PAP)
338  return ERROR_FAILURE;
339 
340  //Check the length of the packet
341  if(length < sizeof(PapAuthAckPacket))
342  return ERROR_INVALID_LENGTH;
343 
344  //When a packet is received with an invalid Identifier field, the
345  //packet is silently discarded without affecting the automaton
346  if(authAckPacket->identifier != context->papFsm.identifier)
347  return ERROR_WRONG_IDENTIFIER;
348 
349  //Switch to the Ack-Rcvd state
350  context->papFsm.peerState = PAP_STATE_5_ACK_RCVD;
351  //The user name has been accepted by the authenticator
352  context->peerAuthDone = TRUE;
353 
354  //Check whether PPP authentication is complete
355  if(context->localAuthDone && context->peerAuthDone)
356  {
357  //Check current PPP phase
358  if(context->pppPhase == PPP_PHASE_AUTHENTICATE)
359  {
360  //Advance to the Network phase
361  context->pppPhase = PPP_PHASE_NETWORK;
362 
363 #if (IPV4_SUPPORT == ENABLED)
364  //IPCP Open event
365  ipcpOpen(context);
366 #endif
367 #if (IPV6_SUPPORT == ENABLED)
368  //IPV6CP Open event
369  ipv6cpOpen(context);
370 #endif
371  }
372  }
373 
374  //Successful processing
375  return NO_ERROR;
376 }
377 
378 
379 /**
380  * @brief Process Authenticate-Nak packet
381  * @param[in] context PPP context
382  * @param[in] authNakPacket Packet received from the peer
383  * @param[in] length Length of the packet, in bytes
384  * @return Error code
385  **/
386 
388  const PapAuthNakPacket *authNakPacket, size_t length)
389 {
390  //Debug message
391  TRACE_INFO("\r\nPAP Authenticate-Nak packet received\r\n");
392 
393  //Make sure the Authenticate-Nak packet is acceptable
394  if(context->peerConfig.authProtocol != PPP_PROTOCOL_PAP)
395  return ERROR_FAILURE;
396 
397  //Check the length of the packet
398  if(length < sizeof(PapAuthNakPacket))
399  return ERROR_INVALID_LENGTH;
400 
401  //When a packet is received with an invalid Identifier field, the
402  //packet is silently discarded without affecting the automaton
403  if(authNakPacket->identifier != context->papFsm.identifier)
404  return ERROR_WRONG_IDENTIFIER;
405 
406  //Switch to the Nak-Rcvd state
407  context->papFsm.peerState = PAP_STATE_7_NAK_RCVD;
408  //Authentication failed
409  lcpClose(context);
410 
411  //Successful processing
412  return NO_ERROR;
413 }
414 
415 
416 /**
417  * @brief Send Authenticate-Request packet
418  * @param[in] context PPP context
419  * @return Error code
420  **/
421 
423 {
424  error_t error;
425  size_t usernameLen;
426  size_t passwordLen;
427  size_t length;
428  size_t offset;
429  uint8_t *p;
430  NetBuffer *buffer;
431  PapAuthReqPacket *authReqPacket;
432 
433  //Get the length of the user name
434  usernameLen = osStrlen(context->username);
435  //Get the length of the password
436  passwordLen = osStrlen(context->password);
437 
438  //Calculate the length of the Authenticate-Request packet
439  length = sizeof(PapAuthReqPacket) + 1 + usernameLen + passwordLen;
440 
441  //Allocate a buffer memory to hold the packet
442  buffer = pppAllocBuffer(length, &offset);
443  //Failed to allocate memory?
444  if(buffer == NULL)
445  return ERROR_OUT_OF_MEMORY;
446 
447  //Point to the Authenticate-Request packet
448  authReqPacket = netBufferAt(buffer, offset, 0);
449 
450  //Format packet header
451  authReqPacket->code = PAP_CODE_AUTH_REQ;
452  authReqPacket->identifier = ++context->papFsm.identifier;
453  authReqPacket->length = htons(length);
454 
455  //The Peer-ID-Length field indicates the length of Peer-ID field
456  authReqPacket->peerIdLength = usernameLen;
457  //Append Peer-ID
458  osMemcpy(authReqPacket->peerId, context->username, usernameLen);
459 
460  //Point to the Passwd-Length field
461  p = authReqPacket->peerId + usernameLen;
462  //The Passwd-Length field indicates the length of Password field
463  p[0] = passwordLen;
464 
465  //Append Password
466  osMemcpy(p + 1, context->password, passwordLen);
467 
468  //Adjust the length of the multi-part buffer
469  netBufferSetLength(buffer, offset + length);
470 
471  //Debug message
472  TRACE_INFO("Sending PAP Authenticate-Request packet (%" PRIuSIZE " bytes)...\r\n", length);
473  //Dump packet contents for debugging purpose
474  pppDumpPacket((PppPacket *) authReqPacket, length, PPP_PROTOCOL_PAP);
475 
476  //Send PPP frame
477  error = pppSendFrame(context->interface, buffer, offset, PPP_PROTOCOL_PAP);
478 
479  //The restart counter is decremented each time a Authenticate-Request is sent
480  if(context->papFsm.restartCounter > 0)
481  context->papFsm.restartCounter--;
482 
483  //Save the time at which the packet was sent
484  context->papFsm.timestamp = osGetSystemTime();
485 
486  //Free previously allocated memory block
487  netBufferFree(buffer);
488 
489  //Return status code
490  return error;
491 }
492 
493 
494 /**
495  * @brief Send Authenticate-Ack packet
496  * @param[in] context PPP context
497  * @param[in] identifier Identifier field
498  * @return Error code
499  **/
500 
502 {
503  error_t error;
504  size_t length;
505  size_t offset;
506  NetBuffer *buffer;
507  PapAuthAckPacket *authAckPacket;
508 
509  //Retrieve the length of the Authenticate-Ack packet
510  length = sizeof(PapAuthAckPacket);
511 
512  //Allocate a buffer memory to hold the Authenticate-Ack packet
513  buffer = pppAllocBuffer(length, &offset);
514  //Failed to allocate memory?
515  if(buffer == NULL)
516  return ERROR_OUT_OF_MEMORY;
517 
518  //Point to the Authenticate-Ack packet
519  authAckPacket = netBufferAt(buffer, offset, 0);
520 
521  //Format packet header
522  authAckPacket->code = PAP_CODE_AUTH_ACK;
523  authAckPacket->identifier = identifier;
524  authAckPacket->length = htons(length);
525 
526  //The Message field is zero or more octets, and its contents are
527  //implementation dependent
528  authAckPacket->msgLength = 0;
529 
530  //Debug message
531  TRACE_INFO("Sending PAP Authenticate-Ack packet (%" PRIuSIZE " bytes)...\r\n", length);
532  //Dump packet contents for debugging purpose
533  pppDumpPacket((PppPacket *) authAckPacket, length, PPP_PROTOCOL_PAP);
534 
535  //Send PPP frame
536  error = pppSendFrame(context->interface, buffer, offset, PPP_PROTOCOL_PAP);
537 
538  //Free previously allocated memory block
539  netBufferFree(buffer);
540 
541  //Return status code
542  return error;
543 }
544 
545 
546 /**
547  * @brief Send Authenticate-Nak packet
548  * @param[in] context PPP context
549  * @param[in] identifier Identifier field
550  * @return Error code
551  **/
552 
554 {
555  error_t error;
556  size_t length;
557  size_t offset;
558  NetBuffer *buffer;
559  PapAuthNakPacket *authNakPacket;
560 
561  //Retrieve the length of the Authenticate-Nak packet
562  length = sizeof(PapAuthNakPacket);
563 
564  //Allocate a buffer memory to hold the Authenticate-Nak packet
565  buffer = pppAllocBuffer(length, &offset);
566  //Failed to allocate memory?
567  if(buffer == NULL)
568  return ERROR_OUT_OF_MEMORY;
569 
570  //Point to the Authenticate-Nak packet
571  authNakPacket = netBufferAt(buffer, offset, 0);
572 
573  //Format packet header
574  authNakPacket->code = PAP_CODE_AUTH_NAK;
575  authNakPacket->identifier = identifier;
576  authNakPacket->length = htons(length);
577 
578  //The Message field is zero or more octets, and its contents are
579  //implementation dependent
580  authNakPacket->msgLength = 0;
581 
582  //Debug message
583  TRACE_INFO("Sending PAP Authenticate-Nak packet (%" PRIuSIZE " bytes)...\r\n", length);
584  //Dump packet contents for debugging purpose
585  pppDumpPacket((PppPacket *) authNakPacket, length, PPP_PROTOCOL_PAP);
586 
587  //Send PPP frame
588  error = pppSendFrame(context->interface, buffer, offset, PPP_PROTOCOL_PAP);
589 
590  //Free previously allocated memory block
591  netBufferFree(buffer);
592 
593  //Return status code
594  return error;
595 }
596 
597 
598 /**
599  * @brief Password verification
600  * @param[in] context PPP context
601  * @param[in] password NULL-terminated string containing the password to be checked
602  * @return TRUE if the password is valid, else FALSE
603  **/
604 
605 bool_t papCheckPassword(PppContext *context, const char_t *password)
606 {
607  size_t n;
608  bool_t status;
609 
610  //This flag tells whether the password is valid
611  status = FALSE;
612 
613  //Retrieve the length of the password
614  n = osStrlen(password);
615 
616  //Compare the length of the password against the expected value
617  if(n == context->papFsm.passwordLen)
618  {
619  //Check whether the password is valid
620  if(!osMemcmp(password, context->papFsm.password, n))
621  status = TRUE;
622  }
623 
624  //Return TRUE is the password is valid, else FALSE
625  return status;
626 }
627 
628 #endif
@ PAP_STATE_1_STARTED
Definition: pap.h:72
#define htons(value)
Definition: cpu_endian.h:413
Data logging functions for debugging purpose (PPP)
int bool_t
Definition: compiler_port.h:53
#define PppPacket
Definition: ppp.h:37
PapAuthNakPacket
Definition: pap.h:141
@ PAP_STATE_0_INITIAL
Definition: pap.h:71
uint8_t p
Definition: ndp.h:300
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
void papProcessPacket(PppContext *context, const PppPacket *packet, size_t length)
Process an incoming PAP packet.
Definition: pap.c:149
@ PAP_STATE_6_NAK_SENT
Definition: pap.h:77
#define TRUE
Definition: os_port.h:50
IPV6CP (PPP IPv6 Control Protocol)
#define osMemcmp(p1, p2, length)
Definition: os_port.h:153
@ ERROR_OUT_OF_MEMORY
Definition: error.h:63
error_t papSendAuthReq(PppContext *context)
Send Authenticate-Request packet.
Definition: pap.c:422
@ PPP_PHASE_NETWORK
Network-layer protocol phase.
Definition: ppp.h:169
NetBuffer * pppAllocBuffer(size_t length, size_t *offset)
Allocate a buffer to hold a PPP frame.
Definition: ppp.c:1305
#define osStrlen(s)
Definition: os_port.h:165
#define PppContext
Definition: ppp.h:38
IPCP (PPP Internet Protocol Control Protocol)
LCP (PPP Link Control Protocol)
error_t papAbortAuth(PppContext *context)
Abort PAP authentication.
Definition: pap.c:87
#define FALSE
Definition: os_port.h:46
#define osMemcpy(dest, src, length)
Definition: os_port.h:141
@ PAP_CODE_AUTH_REQ
Authenticate-Request.
Definition: pap.h:88
error_t
Error codes.
Definition: error.h:43
error_t papProcessAuthReq(PppContext *context, const PapAuthReqPacket *authReqPacket, size_t length)
Process Authenticate-Request packet.
Definition: pap.c:214
@ PAP_STATE_7_NAK_RCVD
Definition: pap.h:78
bool_t papCheckPassword(PppContext *context, const char_t *password)
Password verification.
Definition: pap.c:605
@ PPP_PHASE_AUTHENTICATE
Authentication phase.
Definition: ppp.h:168
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define PAP_RESTART_TIMER
Definition: pap.h:47
void netBufferFree(NetBuffer *buffer)
Dispose a multi-part buffer.
Definition: net_mem.c:282
@ ERROR_INVALID_LENGTH
Definition: error.h:111
error_t papSendAuthAck(PppContext *context, uint8_t identifier)
Send Authenticate-Ack packet.
Definition: pap.c:501
@ PAP_STATE_5_ACK_RCVD
Definition: pap.h:76
@ PAP_STATE_4_ACK_SENT
Definition: pap.h:75
PapAuthAckPacket
Definition: pap.h:127
#define TRACE_INFO(...)
Definition: debug.h:95
@ PAP_CODE_AUTH_ACK
Authenticate-Ack.
Definition: pap.h:89
uint8_t length
Definition: tcp.h:368
#define MIN(a, b)
Definition: os_port.h:63
error_t ipcpOpen(PppContext *context)
IPCP Open event.
Definition: ipcp.c:76
uint32_t systime_t
System time.
#define ntohs(value)
Definition: cpu_endian.h:421
char char_t
Definition: compiler_port.h:48
uint32_t time
error_t pppSendFrame(NetInterface *interface, NetBuffer *buffer, size_t offset, uint16_t protocol)
Send a PPP frame.
Definition: ppp.c:1035
error_t papSendAuthNak(PppContext *context, uint8_t identifier)
Send Authenticate-Nak packet.
Definition: pap.c:553
uint8_t n
error_t pppDumpPacket(const PppPacket *packet, size_t length, PppProtocol protocol)
Dump LCP/NCP packet for debugging purpose.
Definition: ppp_debug.c:143
PapAuthReqPacket
Definition: pap.h:113
error_t netBufferSetLength(NetBuffer *buffer, size_t length)
Adjust the length of a multi-part buffer.
Definition: net_mem.c:322
error_t papStartAuth(PppContext *context)
Start PAP authentication.
Definition: pap.c:53
@ ERROR_WRONG_IDENTIFIER
Definition: error.h:89
uint8_t identifier[]
error_t ipv6cpOpen(PppContext *context)
IPV6CP Open event.
Definition: ipv6cp.c:77
void * netBufferAt(const NetBuffer *buffer, size_t offset, size_t length)
Returns a pointer to a data segment.
Definition: net_mem.c:418
#define PAP_MAX_REQUESTS
Definition: pap.h:54
error_t lcpClose(PppContext *context)
LCP Close event.
Definition: lcp.c:103
#define PRIuSIZE
TCP/IP stack core.
error_t papProcessAuthNak(PppContext *context, const PapAuthNakPacket *authNakPacket, size_t length)
Process Authenticate-Nak packet.
Definition: pap.c:387
void papTick(PppContext *context)
PAP timer handler.
Definition: pap.c:110
error_t papProcessAuthAck(PppContext *context, const PapAuthAckPacket *authAckPacket, size_t length)
Process Authenticate-Ack packet.
Definition: pap.c:330
PAP (Password Authentication Protocol)
@ PAP_STATE_2_REQ_SENT
Definition: pap.h:73
@ NO_ERROR
Success.
Definition: error.h:44
@ PAP_CODE_AUTH_NAK
Authenticate-Nak.
Definition: pap.h:90
Debugging facilities.
@ PPP_PROTOCOL_PAP
Password Authentication Protocol.
Definition: ppp.h:204
systime_t osGetSystemTime(void)
Retrieve system time.
#define PPP_MAX_USERNAME_LEN
Definition: ppp.h:68