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