Lines Matching defs:lcp
120 #define SPPP_LCPOPT_NAMELEN 5 /* buf size of lcp option name */
132 * -link1 will cause the administrative open of the LCP layer.
144 * being one of "lcp", "ipcp", "cisco", "chap", "pap", etc.
267 #define CP_LCP 0x01 /* this is the LCP */
499 static const struct cp lcp = {
500 PPP_LCP, IDX_LCP, CP_LCP, "lcp",
557 &lcp, /* IDX_LCP */
713 sppp_cp_input(&lcp, sp, m);
844 * to start LCP for it.
1133 sppp_cp_fini(&lcp, sp);
1257 sp->lcp.reestablish = false;
1287 lcp_mru = sp->lcp.mru;
1289 sp->lcp.mru = ifp->if_mtu;
1291 sp->lcp.mru = PP_MTU;
1293 if (lcp_mru != sp->lcp.mru)
1294 SET(sp->lcp.opts, SPPP_LCP_OPT_MRU);
1297 ifp->if_mtu > sp->lcp.their_mru) {
1299 ifp->if_mtu = sp->lcp.their_mru;
1710 SPPP_DLOG(sp, "lcp echo req but lcp closed\n");
1715 SPPP_DLOG(sp, "invalid lcp echo request "
1720 if (ntohl(u32) == sp->lcp.magic) {
1737 u32 = htonl(sp->lcp.magic);
1739 SPPP_DLOG(sp, "got lcp echo req, sending echo rep\n");
1746 if (h->ident != sp->lcp.echoid) {
1751 SPPP_DLOG(sp, "lcp invalid echo reply "
1755 SPPP_DLOG(sp, "lcp got echo rep\n");
1757 if (ntohl(u32) != sp->lcp.magic)
1799 sp->scp[cp->protoidx].rst_counter = sp->lcp.max_configure;
1846 * of state just in LCP case.
1880 sp->scp[cp->protoidx].rst_counter = sp->lcp.max_configure;
1881 sp->lcp.protos |= (1 << cp->protoidx);
1934 sp->scp[cp->protoidx].rst_counter = sp->lcp.max_terminate;
1986 callout_schedule(&sp->scp[cp->protoidx].ch, sp->lcp.timeout);
1996 callout_schedule(&sp->scp[cp->protoidx].ch, sp->lcp.timeout);
2172 sp->scp[cp->protoidx].rst_counter = sp->lcp.max_configure;
2184 sp->scp[cp->protoidx].rst_counter = sp->lcp.max_configure;
2241 scp->rst_counter = sp->lcp.max_configure;
2392 callout_schedule(&sp->scp[cp->protoidx].ch, sp->lcp.timeout);
2400 * The LCP implementation. *
2410 sppp_cp_init(&lcp, sp);
2412 SET(sp->lcp.opts, SPPP_LCP_OPT_MAGIC);
2413 sp->lcp.magic = 0;
2414 sp->lcp.protos = 0;
2415 sp->lcp.max_terminate = 2;
2416 sp->lcp.max_configure = 10;
2417 sp->lcp.max_failure = 10;
2418 sp->lcp.tlf_sent = false;
2425 * relevant for all control protocols, not just LCP only.
2427 sp->lcp.timeout = 1 * hz;
2482 sp->lcp.tlf_sent) {
2484 sp->lcp.tlf_sent = false;
2490 if (sp->lcp.reestablish)
2508 sp->lcp.reestablish = false;
2516 sp->lcp.mru = sp->pp_if.if_mtu;
2517 SET(sp->lcp.opts, SPPP_LCP_OPT_MRU);
2519 sp->lcp.mru = PP_MTU;
2521 sp->lcp.their_mru = PP_MTU;
2527 SET(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO);
2529 CLR(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO);
2574 SPPP_LOG(sp, LOG_DEBUG, "lcp parse opts:");
2595 "received malicious LCP option 0x%02x, "
2674 * so we stay in SPPP_PHASE_AUTHENTICATE after LCP got
2709 SPPP_LOG(sp, LOG_DEBUG, "lcp parse opt values:");
2726 if (nmagic != sp->lcp.magic) {
2758 nmagic = ~sp->lcp.magic;
2774 * Option with the LCP Configure-Ack. However,
2788 sp->lcp.their_mru = p[2] * 256 + p[3];
2790 addlog(" %ld", sp->lcp.their_mru);
2858 sp->lcp.their_mrru = p[2] * 256 + p[3];
2860 addlog(" %ld", sp->lcp.their_mrru);
2875 if (++sp->scp[IDX_LCP].fail_counter >= sp->lcp.max_failure) {
2878 sp->lcp.max_failure);
2908 * Analyze the LCP Configure-Reject option list, and adjust our
2927 SPPP_LOG(sp, LOG_DEBUG, "lcp rej opts:");
2941 "received malicious LCP option, dropping.\n");
2951 CLR(sp->lcp.opts, SPPP_LCP_OPT_MAGIC);
2952 sp->lcp.magic = 0;
2965 sp->lcp.mru, PP_MTU);
2967 CLR(sp->lcp.opts, SPPP_LCP_OPT_MRU);
2968 sp->lcp.mru = PP_MTU;
2982 CLR(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO);
2998 * Analyze the LCP Configure-NAK option list, and adjust our
3017 SPPP_LOG(sp, LOG_DEBUG, "lcp nak opts:");
3031 "received malicious LCP option, dropping.\n");
3041 if (ISSET(sp->lcp.opts, SPPP_LCP_OPT_MAGIC) &&
3050 if (magic == ~sp->lcp.magic) {
3053 sp->lcp.magic = cprng_fast32();
3055 sp->lcp.magic = magic;
3073 sp->lcp.mru = mru;
3074 SET(sp->lcp.opts, SPPP_LCP_OPT_MRU);
3130 if (ifp->if_mtu > sp->lcp.their_mru) {
3132 ifp->if_mtu = sp->lcp.their_mru;
3139 if (ISSET(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO) ||
3236 sp->lcp.tlf_sent = false;
3253 sp->lcp.tlf_sent = true;
3258 sp->lcp.tlf_sent = false;
3271 if (ISSET(sp->lcp.opts, SPPP_LCP_OPT_MAGIC)) {
3272 if (! sp->lcp.magic)
3273 sp->lcp.magic = cprng_fast32();
3276 opt[i++] = sp->lcp.magic >> 24;
3277 opt[i++] = sp->lcp.magic >> 16;
3278 opt[i++] = sp->lcp.magic >> 8;
3279 opt[i++] = sp->lcp.magic;
3282 if (ISSET(sp->lcp.opts,SPPP_LCP_OPT_MRU)) {
3285 opt[i++] = sp->lcp.mru >> 8;
3286 opt[i++] = sp->lcp.mru;
3289 if (ISSET(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO)) {
3313 if ((sp->lcp.protos & mask) && (cps[i])->flags & cp_flags)
4578 * - scn: send CHAP_FAILURE and shutdown lcp
4745 * await LCP shutdown by authenticator,
4901 sp->scp[IDX_CHAP].rst_counter = sp->lcp.max_configure;
5172 * await LCP shutdown by authenticator,
5208 sp->scp[IDX_PAP].rst_counter = sp->lcp.max_configure;
5363 ISSET(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO))
5401 callout_schedule(&sp->scp[cp->protoidx].ch, sp->lcp.timeout);
5441 /* shutdown LCP if auth failed */
5489 /* No keepalive in PPP mode if LCP not opened yet. */
5520 SPPP_LOG(sp, LOG_INFO,"LCP keepalive timed out, "
5527 /* And now prepare LCP to reestablish the link, if configured to do so. */
5528 sp->lcp.reestablish = true;
5536 int32_t nmagic = htonl(sp->lcp.magic);
5537 sp->lcp.echoid = ++sp->scp[IDX_LCP].seq;
5539 sp->lcp.echoid, 4, &nmagic);
6025 SET(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO);
6027 CLR(sp->lcp.opts, SPPP_LCP_OPT_AUTH_PROTO);
6037 lcpp->lcp_timeout = sp->lcp.timeout;
6046 sp->lcp.timeout = lcpp->lcp_timeout;
6184 status->opts = sp->lcp.opts;
6185 status->magic = sp->lcp.magic;
6186 status->mru = sp->lcp.mru;
6401 case PPP_LCP: return "lcp";
6466 /* notify lcp that is lower layer */
6467 sp->lcp.protos |= (1 << cp->protoidx);
6476 /* notify lcp that is lower layer */
6477 sp->lcp.protos &= ~(1 << cp->protoidx);