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 (2 + 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 * PPP_FCS_TABLE: Keep a 256*2 byte table to speed up FCS calculation for PPPoS 189 */ 190 #ifndef PPP_FCS_TABLE 191 #define PPP_FCS_TABLE 1 192 #endif 193 194 /** 195 * PAP_SUPPORT==1: Support PAP. 196 */ 197 #ifndef PAP_SUPPORT 198 #define PAP_SUPPORT 0 199 #endif 200 201 /** 202 * CHAP_SUPPORT==1: Support CHAP. 203 */ 204 #ifndef CHAP_SUPPORT 205 #define CHAP_SUPPORT 0 206 #endif 207 208 /** 209 * MSCHAP_SUPPORT==1: Support MSCHAP. 210 */ 211 #ifndef MSCHAP_SUPPORT 212 #define MSCHAP_SUPPORT 0 213 #endif 214 #if MSCHAP_SUPPORT 215 /* MSCHAP requires CHAP support */ 216 #undef CHAP_SUPPORT 217 #define CHAP_SUPPORT 1 218 #endif /* MSCHAP_SUPPORT */ 219 220 /** 221 * EAP_SUPPORT==1: Support EAP. 222 */ 223 #ifndef EAP_SUPPORT 224 #define EAP_SUPPORT 0 225 #endif 226 227 /** 228 * CCP_SUPPORT==1: Support CCP. 229 */ 230 #ifndef CCP_SUPPORT 231 #define CCP_SUPPORT 0 232 #endif 233 234 /** 235 * MPPE_SUPPORT==1: Support MPPE. 236 */ 237 #ifndef MPPE_SUPPORT 238 #define MPPE_SUPPORT 0 239 #endif 240 #if MPPE_SUPPORT 241 /* MPPE requires CCP support */ 242 #undef CCP_SUPPORT 243 #define CCP_SUPPORT 1 244 /* MPPE requires MSCHAP support */ 245 #undef MSCHAP_SUPPORT 246 #define MSCHAP_SUPPORT 1 247 /* MSCHAP requires CHAP support */ 248 #undef CHAP_SUPPORT 249 #define CHAP_SUPPORT 1 250 #endif /* MPPE_SUPPORT */ 251 252 /** 253 * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET! 254 */ 255 #ifndef CBCP_SUPPORT 256 #define CBCP_SUPPORT 0 257 #endif 258 259 /** 260 * ECP_SUPPORT==1: Support ECP. CURRENTLY NOT SUPPORTED! DO NOT SET! 261 */ 262 #ifndef ECP_SUPPORT 263 #define ECP_SUPPORT 0 264 #endif 265 266 /** 267 * DEMAND_SUPPORT==1: Support dial on demand. CURRENTLY NOT SUPPORTED! DO NOT SET! 268 */ 269 #ifndef DEMAND_SUPPORT 270 #define DEMAND_SUPPORT 0 271 #endif 272 273 /** 274 * LQR_SUPPORT==1: Support Link Quality Report. Do nothing except exchanging some LCP packets. 275 */ 276 #ifndef LQR_SUPPORT 277 #define LQR_SUPPORT 0 278 #endif 279 280 /** 281 * PPP_SERVER==1: Enable PPP server support (waiting for incoming PPP session). 282 * 283 * Currently only supported for PPPoS. 284 */ 285 #ifndef PPP_SERVER 286 #define PPP_SERVER 0 287 #endif 288 289 #if PPP_SERVER 290 /* 291 * PPP_OUR_NAME: Our name for authentication purposes 292 */ 293 #ifndef PPP_OUR_NAME 294 #define PPP_OUR_NAME "lwIP" 295 #endif 296 #endif /* PPP_SERVER */ 297 298 /** 299 * VJ_SUPPORT==1: Support VJ header compression. 300 * 301 * BEWARE: It is known to be broken when built with some compiler optimizations enabled. 302 */ 303 #ifndef VJ_SUPPORT 304 #define VJ_SUPPORT 0 305 #endif 306 /* VJ compression is only supported for TCP over IPv4 over PPPoS. */ 307 #if !PPPOS_SUPPORT || !PPP_IPV4_SUPPORT || !LWIP_TCP 308 #undef VJ_SUPPORT 309 #define VJ_SUPPORT 0 310 #endif /* !PPPOS_SUPPORT */ 311 312 /** 313 * PPP_MD5_RANDM==1: Use MD5 for better randomness. 314 * Enabled by default if CHAP, EAP, or L2TP AUTH support is enabled. 315 */ 316 #ifndef PPP_MD5_RANDM 317 #define PPP_MD5_RANDM (CHAP_SUPPORT || EAP_SUPPORT || PPPOL2TP_AUTH_SUPPORT) 318 #endif 319 320 /** 321 * PolarSSL embedded library 322 * 323 * 324 * lwIP contains some files fetched from the latest BSD release of 325 * the PolarSSL project (PolarSSL 0.10.1-bsd) for ciphers and encryption 326 * methods we need for lwIP PPP support. 327 * 328 * The PolarSSL files were cleaned to contain only the necessary struct 329 * fields and functions needed for lwIP. 330 * 331 * The PolarSSL API was not changed at all, so if you are already using 332 * PolarSSL you can choose to skip the compilation of the included PolarSSL 333 * library into lwIP. 334 * 335 * If you are not using the embedded copy you must include external 336 * libraries into your arch/cc.h port file. 337 * 338 * Beware of the stack requirements which can be a lot larger if you are not 339 * using our cleaned PolarSSL library. 340 */ 341 342 /** 343 * LWIP_USE_EXTERNAL_POLARSSL: Use external PolarSSL library 344 */ 345 #ifndef LWIP_USE_EXTERNAL_POLARSSL 346 #define LWIP_USE_EXTERNAL_POLARSSL 0 347 #endif 348 349 /** 350 * LWIP_USE_EXTERNAL_MBEDTLS: Use external mbed TLS library 351 */ 352 #ifndef LWIP_USE_EXTERNAL_MBEDTLS 353 #define LWIP_USE_EXTERNAL_MBEDTLS 0 354 #endif 355 356 /* 357 * PPP Timeouts 358 */ 359 360 /** 361 * FSM_DEFTIMEOUT: Timeout time in seconds 362 */ 363 #ifndef FSM_DEFTIMEOUT 364 #define FSM_DEFTIMEOUT 6 365 #endif 366 367 /** 368 * FSM_DEFMAXTERMREQS: Maximum Terminate-Request transmissions 369 */ 370 #ifndef FSM_DEFMAXTERMREQS 371 #define FSM_DEFMAXTERMREQS 2 372 #endif 373 374 /** 375 * FSM_DEFMAXCONFREQS: Maximum Configure-Request transmissions 376 */ 377 #ifndef FSM_DEFMAXCONFREQS 378 #define FSM_DEFMAXCONFREQS 10 379 #endif 380 381 /** 382 * FSM_DEFMAXNAKLOOPS: Maximum number of nak loops 383 */ 384 #ifndef FSM_DEFMAXNAKLOOPS 385 #define FSM_DEFMAXNAKLOOPS 5 386 #endif 387 388 /** 389 * UPAP_DEFTIMEOUT: Timeout (seconds) for retransmitting req 390 */ 391 #ifndef UPAP_DEFTIMEOUT 392 #define UPAP_DEFTIMEOUT 6 393 #endif 394 395 /** 396 * UPAP_DEFTRANSMITS: Maximum number of auth-reqs to send 397 */ 398 #ifndef UPAP_DEFTRANSMITS 399 #define UPAP_DEFTRANSMITS 10 400 #endif 401 402 #if PPP_SERVER 403 /** 404 * UPAP_DEFREQTIME: Time to wait for auth-req from peer 405 */ 406 #ifndef UPAP_DEFREQTIME 407 #define UPAP_DEFREQTIME 30 408 #endif 409 #endif /* PPP_SERVER */ 410 411 /** 412 * CHAP_DEFTIMEOUT: Timeout (seconds) for retransmitting req 413 */ 414 #ifndef CHAP_DEFTIMEOUT 415 #define CHAP_DEFTIMEOUT 6 416 #endif 417 418 /** 419 * CHAP_DEFTRANSMITS: max # times to send challenge 420 */ 421 #ifndef CHAP_DEFTRANSMITS 422 #define CHAP_DEFTRANSMITS 10 423 #endif 424 425 #if PPP_SERVER 426 /** 427 * CHAP_DEFRECHALLENGETIME: If this option is > 0, rechallenge the peer every n seconds 428 */ 429 #ifndef CHAP_DEFRECHALLENGETIME 430 #define CHAP_DEFRECHALLENGETIME 0 431 #endif 432 #endif /* PPP_SERVER */ 433 434 /** 435 * EAP_DEFREQTIME: Time to wait for peer request 436 */ 437 #ifndef EAP_DEFREQTIME 438 #define EAP_DEFREQTIME 6 439 #endif 440 441 /** 442 * EAP_DEFALLOWREQ: max # times to accept requests 443 */ 444 #ifndef EAP_DEFALLOWREQ 445 #define EAP_DEFALLOWREQ 10 446 #endif 447 448 #if PPP_SERVER 449 /** 450 * EAP_DEFTIMEOUT: Timeout (seconds) for rexmit 451 */ 452 #ifndef EAP_DEFTIMEOUT 453 #define EAP_DEFTIMEOUT 6 454 #endif 455 456 /** 457 * EAP_DEFTRANSMITS: max # times to transmit 458 */ 459 #ifndef EAP_DEFTRANSMITS 460 #define EAP_DEFTRANSMITS 10 461 #endif 462 #endif /* PPP_SERVER */ 463 464 /** 465 * LCP_DEFLOOPBACKFAIL: Default number of times we receive our magic number from the peer 466 * before deciding the link is looped-back. 467 */ 468 #ifndef LCP_DEFLOOPBACKFAIL 469 #define LCP_DEFLOOPBACKFAIL 10 470 #endif 471 472 /** 473 * LCP_ECHOINTERVAL: Interval in seconds between keepalive echo requests, 0 to disable. 474 */ 475 #ifndef LCP_ECHOINTERVAL 476 #define LCP_ECHOINTERVAL 0 477 #endif 478 479 /** 480 * LCP_MAXECHOFAILS: Number of unanswered echo requests before failure. 481 */ 482 #ifndef LCP_MAXECHOFAILS 483 #define LCP_MAXECHOFAILS 3 484 #endif 485 486 /** 487 * PPP_MAXIDLEFLAG: Max Xmit idle time (in ms) before resend flag char. 488 */ 489 #ifndef PPP_MAXIDLEFLAG 490 #define PPP_MAXIDLEFLAG 100 491 #endif 492 493 /** 494 * PPP Packet sizes 495 */ 496 497 /** 498 * PPP_MRU: MRU value we want to negotiate (peer MTU) 499 * 500 * It only affects PPPoS because PPPoE value is derived from the 501 * Ethernet interface MTU and PPPoL2TP have a separate setting. 502 */ 503 #ifndef PPP_MRU 504 #define PPP_MRU 1500 505 #endif 506 507 /** 508 * PPP_MAXMRU: Normally limit peer MRU to this 509 * 510 * This is the upper limit value to which we set our interface MTU. 511 * If the peer sends a larger number, we will just ignore it as we 512 * are not required to maximize the use of the peer capacity. 513 * 514 * It only affects PPPoS because PPPoE value is derived from the 515 * Ethernet interface MTU and PPPoL2TP have a separate setting. 516 */ 517 #ifndef PPP_MAXMRU 518 #define PPP_MAXMRU 1500 519 #endif 520 521 /** 522 * PPP_MINMRU: No peer MRUs below this 523 * 524 * Peer must be able to receive at least our minimum MTU. 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