1 /* 2 * Redistribution and use in source and binary forms, with or without modification, 3 * are permitted provided that the following conditions are met: 4 * 5 * 1. Redistributions of source code must retain the above copyright notice, 6 * this list of conditions and the following disclaimer. 7 * 2. Redistributions in binary form must reproduce the above copyright notice, 8 * this list of conditions and the following disclaimer in the documentation 9 * and/or other materials provided with the distribution. 10 * 3. The name of the author may not be used to endorse or promote products 11 * derived from this software without specific prior written permission. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 * OF SUCH DAMAGE. 23 * 24 * This file is part of the lwIP TCP/IP stack. 25 * 26 */ 27 28 #ifndef LWIP_PPP_OPTS_H 29 #define LWIP_PPP_OPTS_H 30 31 #include "lwip/opt.h" 32 33 /** 34 * PPP_SUPPORT==1: Enable PPP. 35 */ 36 #ifndef PPP_SUPPORT 37 #define PPP_SUPPORT 0 38 #endif 39 40 /** 41 * PPPOE_SUPPORT==1: Enable PPP Over Ethernet 42 */ 43 #ifndef PPPOE_SUPPORT 44 #define PPPOE_SUPPORT 0 45 #endif 46 47 /** 48 * PPPOL2TP_SUPPORT==1: Enable PPP Over L2TP 49 */ 50 #ifndef PPPOL2TP_SUPPORT 51 #define PPPOL2TP_SUPPORT 0 52 #endif 53 54 /** 55 * PPPOL2TP_AUTH_SUPPORT==1: Enable PPP Over L2TP Auth (enable MD5 support) 56 */ 57 #ifndef PPPOL2TP_AUTH_SUPPORT 58 #define PPPOL2TP_AUTH_SUPPORT PPPOL2TP_SUPPORT 59 #endif 60 61 /** 62 * PPPOS_SUPPORT==1: Enable PPP Over Serial 63 */ 64 #ifndef PPPOS_SUPPORT 65 #define PPPOS_SUPPORT PPP_SUPPORT 66 #endif 67 68 /** 69 * LWIP_PPP_API==1: Enable PPP API (in pppapi.c) 70 */ 71 #ifndef LWIP_PPP_API 72 #define LWIP_PPP_API (PPP_SUPPORT && (NO_SYS == 0)) 73 #endif 74 75 #if PPP_SUPPORT 76 77 /** 78 * MEMP_NUM_PPP_PCB: the number of simultaneously active PPP 79 * connections (requires the PPP_SUPPORT option) 80 */ 81 #ifndef MEMP_NUM_PPP_PCB 82 #define MEMP_NUM_PPP_PCB 1 83 #endif 84 85 /** 86 * PPP_NUM_TIMEOUTS_PER_PCB: the number of sys_timeouts running in parallel per 87 * ppp_pcb. See the detailed explanation at the end of ppp_impl.h about simultaneous 88 * timers analysis. 89 */ 90 #ifndef PPP_NUM_TIMEOUTS_PER_PCB 91 #define PPP_NUM_TIMEOUTS_PER_PCB (1 + PPP_IPV4_SUPPORT + PPP_IPV6_SUPPORT + CCP_SUPPORT) 92 #endif 93 94 /* The number of sys_timeouts required for the PPP module */ 95 #define PPP_NUM_TIMEOUTS (PPP_SUPPORT * PPP_NUM_TIMEOUTS_PER_PCB * MEMP_NUM_PPP_PCB) 96 97 /** 98 * MEMP_NUM_PPPOS_INTERFACES: the number of concurrently active PPPoS 99 * interfaces (only used with PPPOS_SUPPORT==1) 100 */ 101 #ifndef MEMP_NUM_PPPOS_INTERFACES 102 #define MEMP_NUM_PPPOS_INTERFACES MEMP_NUM_PPP_PCB 103 #endif 104 105 /** 106 * MEMP_NUM_PPPOE_INTERFACES: the number of concurrently active PPPoE 107 * interfaces (only used with PPPOE_SUPPORT==1) 108 */ 109 #ifndef MEMP_NUM_PPPOE_INTERFACES 110 #define MEMP_NUM_PPPOE_INTERFACES 1 111 #endif 112 113 /** 114 * MEMP_NUM_PPPOL2TP_INTERFACES: the number of concurrently active PPPoL2TP 115 * interfaces (only used with PPPOL2TP_SUPPORT==1) 116 */ 117 #ifndef MEMP_NUM_PPPOL2TP_INTERFACES 118 #define MEMP_NUM_PPPOL2TP_INTERFACES 1 119 #endif 120 121 /** 122 * MEMP_NUM_PPP_API_MSG: Number of concurrent PPP API messages (in pppapi.c) 123 */ 124 #ifndef MEMP_NUM_PPP_API_MSG 125 #define MEMP_NUM_PPP_API_MSG 5 126 #endif 127 128 /** 129 * PPP_DEBUG: Enable debugging for PPP. 130 */ 131 #ifndef PPP_DEBUG 132 #define PPP_DEBUG LWIP_DBG_OFF 133 #endif 134 135 /** 136 * PPP_INPROC_IRQ_SAFE==1 call pppos_input() using tcpip_callback(). 137 * 138 * Please read the "PPPoS input path" chapter in the PPP documentation about this option. 139 */ 140 #ifndef PPP_INPROC_IRQ_SAFE 141 #define PPP_INPROC_IRQ_SAFE 0 142 #endif 143 144 /** 145 * PRINTPKT_SUPPORT==1: Enable PPP print packet support 146 * 147 * Mandatory for debugging, it displays exchanged packet content in debug trace. 148 */ 149 #ifndef PRINTPKT_SUPPORT 150 #define PRINTPKT_SUPPORT 0 151 #endif 152 153 /** 154 * PPP_IPV4_SUPPORT==1: Enable PPP IPv4 support 155 */ 156 #ifndef PPP_IPV4_SUPPORT 157 #define PPP_IPV4_SUPPORT (LWIP_IPV4) 158 #endif 159 160 /** 161 * PPP_IPV6_SUPPORT==1: Enable PPP IPv6 support 162 */ 163 #ifndef PPP_IPV6_SUPPORT 164 #define PPP_IPV6_SUPPORT (LWIP_IPV6) 165 #endif 166 167 /** 168 * PPP_NOTIFY_PHASE==1: Support PPP notify phase support 169 * 170 * PPP notify phase support allows you to set a callback which is 171 * called on change of the internal PPP state machine. 172 * 173 * This can be used for example to set a LED pattern depending on the 174 * current phase of the PPP session. 175 */ 176 #ifndef PPP_NOTIFY_PHASE 177 #define PPP_NOTIFY_PHASE 0 178 #endif 179 180 /** 181 * pbuf_type PPP is using for LCP, PAP, CHAP, EAP, CCP, IPCP and IP6CP packets. 182 * 183 * Memory allocated must be single buffered for PPP to works, it requires pbuf 184 * that are not going to be chained when allocated. This requires setting 185 * PBUF_POOL_BUFSIZE to at least 512 bytes, which is quite huge for small systems. 186 * 187 * Setting PPP_USE_PBUF_RAM to 1 makes PPP use memory from heap where continuous 188 * buffers are required, allowing you to use a smaller PBUF_POOL_BUFSIZE. 189 */ 190 #ifndef PPP_USE_PBUF_RAM 191 #define PPP_USE_PBUF_RAM 0 192 #endif 193 194 /** 195 * PPP_FCS_TABLE: Keep a 256*2 byte table to speed up FCS calculation for PPPoS 196 */ 197 #ifndef PPP_FCS_TABLE 198 #define PPP_FCS_TABLE 1 199 #endif 200 201 /** 202 * PAP_SUPPORT==1: Support PAP. 203 */ 204 #ifndef PAP_SUPPORT 205 #define PAP_SUPPORT 0 206 #endif 207 208 /** 209 * CHAP_SUPPORT==1: Support CHAP. 210 */ 211 #ifndef CHAP_SUPPORT 212 #define CHAP_SUPPORT 0 213 #endif 214 215 /** 216 * MSCHAP_SUPPORT==1: Support MSCHAP. 217 */ 218 #ifndef MSCHAP_SUPPORT 219 #define MSCHAP_SUPPORT 0 220 #endif 221 #if MSCHAP_SUPPORT 222 /* MSCHAP requires CHAP support */ 223 #undef CHAP_SUPPORT 224 #define CHAP_SUPPORT 1 225 #endif /* MSCHAP_SUPPORT */ 226 227 /** 228 * EAP_SUPPORT==1: Support EAP. 229 */ 230 #ifndef EAP_SUPPORT 231 #define EAP_SUPPORT 0 232 #endif 233 234 /** 235 * CCP_SUPPORT==1: Support CCP. 236 */ 237 #ifndef CCP_SUPPORT 238 #define CCP_SUPPORT 0 239 #endif 240 241 /** 242 * MPPE_SUPPORT==1: Support MPPE. 243 */ 244 #ifndef MPPE_SUPPORT 245 #define MPPE_SUPPORT 0 246 #endif 247 #if MPPE_SUPPORT 248 /* MPPE requires CCP support */ 249 #undef CCP_SUPPORT 250 #define CCP_SUPPORT 1 251 /* MPPE requires MSCHAP support */ 252 #undef MSCHAP_SUPPORT 253 #define MSCHAP_SUPPORT 1 254 /* MSCHAP requires CHAP support */ 255 #undef CHAP_SUPPORT 256 #define CHAP_SUPPORT 1 257 #endif /* MPPE_SUPPORT */ 258 259 /** 260 * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET! 261 */ 262 #ifndef CBCP_SUPPORT 263 #define CBCP_SUPPORT 0 264 #endif 265 266 /** 267 * ECP_SUPPORT==1: Support ECP. CURRENTLY NOT SUPPORTED! DO NOT SET! 268 */ 269 #ifndef ECP_SUPPORT 270 #define ECP_SUPPORT 0 271 #endif 272 273 /** 274 * DEMAND_SUPPORT==1: Support dial on demand. CURRENTLY NOT SUPPORTED! DO NOT SET! 275 */ 276 #ifndef DEMAND_SUPPORT 277 #define DEMAND_SUPPORT 0 278 #endif 279 280 /** 281 * LQR_SUPPORT==1: Support Link Quality Report. Do nothing except exchanging some LCP packets. 282 */ 283 #ifndef LQR_SUPPORT 284 #define LQR_SUPPORT 0 285 #endif 286 287 /** 288 * PPP_SERVER==1: Enable PPP server support (waiting for incoming PPP session). 289 * 290 * Currently only supported for PPPoS. 291 */ 292 #ifndef PPP_SERVER 293 #define PPP_SERVER 0 294 #endif 295 296 #if PPP_SERVER 297 /* 298 * PPP_OUR_NAME: Our name for authentication purposes 299 */ 300 #ifndef PPP_OUR_NAME 301 #define PPP_OUR_NAME "lwIP" 302 #endif 303 #endif /* PPP_SERVER */ 304 305 /** 306 * VJ_SUPPORT==1: Support VJ header compression. 307 */ 308 #ifndef VJ_SUPPORT 309 #define VJ_SUPPORT 1 310 #endif 311 /* VJ compression is only supported for TCP over IPv4 over PPPoS. */ 312 #if !PPPOS_SUPPORT || !PPP_IPV4_SUPPORT || !LWIP_TCP 313 #undef VJ_SUPPORT 314 #define VJ_SUPPORT 0 315 #endif /* !PPPOS_SUPPORT */ 316 317 /** 318 * PPP_MD5_RANDM==1: Use MD5 for better randomness. 319 * Enabled by default if CHAP, EAP, or L2TP AUTH support is enabled. 320 */ 321 #ifndef PPP_MD5_RANDM 322 #define PPP_MD5_RANDM (CHAP_SUPPORT || EAP_SUPPORT || PPPOL2TP_AUTH_SUPPORT) 323 #endif 324 325 /** 326 * PolarSSL embedded library 327 * 328 * 329 * lwIP contains some files fetched from the latest BSD release of 330 * the PolarSSL project (PolarSSL 0.10.1-bsd) for ciphers and encryption 331 * methods we need for lwIP PPP support. 332 * 333 * The PolarSSL files were cleaned to contain only the necessary struct 334 * fields and functions needed for lwIP. 335 * 336 * The PolarSSL API was not changed at all, so if you are already using 337 * PolarSSL you can choose to skip the compilation of the included PolarSSL 338 * library into lwIP. 339 * 340 * If you are not using the embedded copy you must include external 341 * libraries into your arch/cc.h port file. 342 * 343 * Beware of the stack requirements which can be a lot larger if you are not 344 * using our cleaned PolarSSL library. 345 */ 346 347 /** 348 * LWIP_USE_EXTERNAL_POLARSSL: Use external PolarSSL library 349 */ 350 #ifndef LWIP_USE_EXTERNAL_POLARSSL 351 #define LWIP_USE_EXTERNAL_POLARSSL 0 352 #endif 353 354 /** 355 * LWIP_USE_EXTERNAL_MBEDTLS: Use external mbed TLS library 356 */ 357 #ifndef LWIP_USE_EXTERNAL_MBEDTLS 358 #define LWIP_USE_EXTERNAL_MBEDTLS 0 359 #endif 360 361 /* 362 * PPP Timeouts 363 */ 364 365 /** 366 * FSM_DEFTIMEOUT: Timeout time in seconds 367 */ 368 #ifndef FSM_DEFTIMEOUT 369 #define FSM_DEFTIMEOUT 6 370 #endif 371 372 /** 373 * FSM_DEFMAXTERMREQS: Maximum Terminate-Request transmissions 374 */ 375 #ifndef FSM_DEFMAXTERMREQS 376 #define FSM_DEFMAXTERMREQS 2 377 #endif 378 379 /** 380 * FSM_DEFMAXCONFREQS: Maximum Configure-Request transmissions 381 */ 382 #ifndef FSM_DEFMAXCONFREQS 383 #define FSM_DEFMAXCONFREQS 10 384 #endif 385 386 /** 387 * FSM_DEFMAXNAKLOOPS: Maximum number of nak loops 388 */ 389 #ifndef FSM_DEFMAXNAKLOOPS 390 #define FSM_DEFMAXNAKLOOPS 5 391 #endif 392 393 /** 394 * UPAP_DEFTIMEOUT: Timeout (seconds) for retransmitting req 395 */ 396 #ifndef UPAP_DEFTIMEOUT 397 #define UPAP_DEFTIMEOUT 6 398 #endif 399 400 /** 401 * UPAP_DEFTRANSMITS: Maximum number of auth-reqs to send 402 */ 403 #ifndef UPAP_DEFTRANSMITS 404 #define UPAP_DEFTRANSMITS 10 405 #endif 406 407 #if PPP_SERVER 408 /** 409 * UPAP_DEFREQTIME: Time to wait for auth-req from peer 410 */ 411 #ifndef UPAP_DEFREQTIME 412 #define UPAP_DEFREQTIME 30 413 #endif 414 #endif /* PPP_SERVER */ 415 416 /** 417 * CHAP_DEFTIMEOUT: Timeout (seconds) for retransmitting req 418 */ 419 #ifndef CHAP_DEFTIMEOUT 420 #define CHAP_DEFTIMEOUT 6 421 #endif 422 423 /** 424 * CHAP_DEFTRANSMITS: max # times to send challenge 425 */ 426 #ifndef CHAP_DEFTRANSMITS 427 #define CHAP_DEFTRANSMITS 10 428 #endif 429 430 #if PPP_SERVER 431 /** 432 * CHAP_DEFRECHALLENGETIME: If this option is > 0, rechallenge the peer every n seconds 433 */ 434 #ifndef CHAP_DEFRECHALLENGETIME 435 #define CHAP_DEFRECHALLENGETIME 0 436 #endif 437 #endif /* PPP_SERVER */ 438 439 /** 440 * EAP_DEFREQTIME: Time to wait for peer request 441 */ 442 #ifndef EAP_DEFREQTIME 443 #define EAP_DEFREQTIME 6 444 #endif 445 446 /** 447 * EAP_DEFALLOWREQ: max # times to accept requests 448 */ 449 #ifndef EAP_DEFALLOWREQ 450 #define EAP_DEFALLOWREQ 10 451 #endif 452 453 #if PPP_SERVER 454 /** 455 * EAP_DEFTIMEOUT: Timeout (seconds) for rexmit 456 */ 457 #ifndef EAP_DEFTIMEOUT 458 #define EAP_DEFTIMEOUT 6 459 #endif 460 461 /** 462 * EAP_DEFTRANSMITS: max # times to transmit 463 */ 464 #ifndef EAP_DEFTRANSMITS 465 #define EAP_DEFTRANSMITS 10 466 #endif 467 #endif /* PPP_SERVER */ 468 469 /** 470 * LCP_DEFLOOPBACKFAIL: Default number of times we receive our magic number from the peer 471 * before deciding the link is looped-back. 472 */ 473 #ifndef LCP_DEFLOOPBACKFAIL 474 #define LCP_DEFLOOPBACKFAIL 10 475 #endif 476 477 /** 478 * LCP_ECHOINTERVAL: Interval in seconds between keepalive echo requests, 0 to disable. 479 */ 480 #ifndef LCP_ECHOINTERVAL 481 #define LCP_ECHOINTERVAL 0 482 #endif 483 484 /** 485 * LCP_MAXECHOFAILS: Number of unanswered echo requests before failure. 486 */ 487 #ifndef LCP_MAXECHOFAILS 488 #define LCP_MAXECHOFAILS 3 489 #endif 490 491 /** 492 * PPP_MAXIDLEFLAG: Max Xmit idle time (in ms) before resend flag char. 493 */ 494 #ifndef PPP_MAXIDLEFLAG 495 #define PPP_MAXIDLEFLAG 100 496 #endif 497 498 /** 499 * PPP Packet sizes 500 */ 501 502 /** 503 * PPP_MRU: Default MRU 504 */ 505 #ifndef PPP_MRU 506 #define PPP_MRU 1500 507 #endif 508 509 /** 510 * PPP_DEFMRU: Default MRU to try 511 */ 512 #ifndef PPP_DEFMRU 513 #define PPP_DEFMRU 1500 514 #endif 515 516 /** 517 * PPP_MAXMRU: Normally limit MRU to this (pppd default = 16384) 518 */ 519 #ifndef PPP_MAXMRU 520 #define PPP_MAXMRU 1500 521 #endif 522 523 /** 524 * PPP_MINMRU: No MRUs below this 525 */ 526 #ifndef PPP_MINMRU 527 #define PPP_MINMRU 128 528 #endif 529 530 /** 531 * PPPOL2TP_DEFMRU: Default MTU and MRU for L2TP 532 * Default = 1500 - PPPoE(6) - PPP Protocol(2) - IPv4 header(20) - UDP Header(8) 533 * - L2TP Header(6) - HDLC Header(2) - PPP Protocol(2) - MPPE Header(2) - PPP Protocol(2) 534 */ 535 #if PPPOL2TP_SUPPORT 536 #ifndef PPPOL2TP_DEFMRU 537 #define PPPOL2TP_DEFMRU 1450 538 #endif 539 #endif /* PPPOL2TP_SUPPORT */ 540 541 /** 542 * MAXNAMELEN: max length of hostname or name for auth 543 */ 544 #ifndef MAXNAMELEN 545 #define MAXNAMELEN 256 546 #endif 547 548 /** 549 * MAXSECRETLEN: max length of password or secret 550 */ 551 #ifndef MAXSECRETLEN 552 #define MAXSECRETLEN 256 553 #endif 554 555 /* ------------------------------------------------------------------------- */ 556 557 /* 558 * Build triggers for embedded PolarSSL 559 */ 560 #if !LWIP_USE_EXTERNAL_POLARSSL && !LWIP_USE_EXTERNAL_MBEDTLS 561 562 /* CHAP, EAP, L2TP AUTH and MD5 Random require MD5 support */ 563 #if CHAP_SUPPORT || EAP_SUPPORT || PPPOL2TP_AUTH_SUPPORT || PPP_MD5_RANDM 564 #define LWIP_INCLUDED_POLARSSL_MD5 1 565 #endif /* CHAP_SUPPORT || EAP_SUPPORT || PPPOL2TP_AUTH_SUPPORT || PPP_MD5_RANDM */ 566 567 #if MSCHAP_SUPPORT 568 569 /* MSCHAP require MD4 support */ 570 #define LWIP_INCLUDED_POLARSSL_MD4 1 571 /* MSCHAP require SHA1 support */ 572 #define LWIP_INCLUDED_POLARSSL_SHA1 1 573 /* MSCHAP require DES support */ 574 #define LWIP_INCLUDED_POLARSSL_DES 1 575 576 /* MS-CHAP support is required for MPPE */ 577 #if MPPE_SUPPORT 578 /* MPPE require ARC4 support */ 579 #define LWIP_INCLUDED_POLARSSL_ARC4 1 580 #endif /* MPPE_SUPPORT */ 581 582 #endif /* MSCHAP_SUPPORT */ 583 584 #endif /* !LWIP_USE_EXTERNAL_POLARSSL && !LWIP_USE_EXTERNAL_MBEDTLS */ 585 586 /* Default value if unset */ 587 #ifndef LWIP_INCLUDED_POLARSSL_MD4 588 #define LWIP_INCLUDED_POLARSSL_MD4 0 589 #endif /* LWIP_INCLUDED_POLARSSL_MD4 */ 590 #ifndef LWIP_INCLUDED_POLARSSL_MD5 591 #define LWIP_INCLUDED_POLARSSL_MD5 0 592 #endif /* LWIP_INCLUDED_POLARSSL_MD5 */ 593 #ifndef LWIP_INCLUDED_POLARSSL_SHA1 594 #define LWIP_INCLUDED_POLARSSL_SHA1 0 595 #endif /* LWIP_INCLUDED_POLARSSL_SHA1 */ 596 #ifndef LWIP_INCLUDED_POLARSSL_DES 597 #define LWIP_INCLUDED_POLARSSL_DES 0 598 #endif /* LWIP_INCLUDED_POLARSSL_DES */ 599 #ifndef LWIP_INCLUDED_POLARSSL_ARC4 600 #define LWIP_INCLUDED_POLARSSL_ARC4 0 601 #endif /* LWIP_INCLUDED_POLARSSL_ARC4 */ 602 603 #endif /* PPP_SUPPORT */ 604 605 /* Default value if unset */ 606 #ifndef PPP_NUM_TIMEOUTS 607 #define PPP_NUM_TIMEOUTS 0 608 #endif /* PPP_NUM_TIMEOUTS */ 609 610 #endif /* LWIP_PPP_OPTS_H */ 611