X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Flcp.c;h=d1be64f43b74e3ca68e9a09a4d80094281e8c46a;hb=e9275a1f8240dea5d2f0c147ce817db61dad61ab;hp=1e01de11dfccb1fda3e8ffd1f1741f6ad915851a;hpb=c429353c95439c2722b5206221e9bfb928b02437;p=ppp.git diff --git a/pppd/lcp.c b/pppd/lcp.c index 1e01de1..d1be64f 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: lcp.c,v 1.35 1999/03/16 02:47:00 paulus Exp $"; +static const char rcsid[] = "$Id: lcp.c,v 1.43 1999/08/12 04:25:21 paulus Exp $"; #endif /* @@ -40,6 +40,7 @@ static char rcsid[] = "$Id: lcp.c,v 1.35 1999/03/16 02:47:00 paulus Exp $"; */ int lcp_echo_interval = 0; /* Interval between LCP echo-requests */ int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */ +bool lax_recv = 0; /* accept control chars in asyncmap */ static int setescape __P((char **)); @@ -63,7 +64,7 @@ static option_t lcp_option_list[] = { { "-as", o_uint32, &lcp_wantoptions[0].asyncmap, "Set asyncmap (for received packets)", OPT_OR, &lcp_wantoptions[0].neg_asyncmap }, - { "nomagicnumber", o_bool, &lcp_wantoptions[0].neg_magicnumber, + { "nomagic", o_bool, &lcp_wantoptions[0].neg_magicnumber, "Disable magic number negotiation (looped-back line detection)", OPT_A2COPY, &lcp_allowoptions[0].neg_magicnumber }, { "-mn", o_bool, &lcp_wantoptions[0].neg_magicnumber, @@ -104,6 +105,8 @@ static option_t lcp_option_list[] = { "Set maximum number of LCP configure-request transmissions" }, { "lcp-max-failure", o_int, &lcp_fsm[0].maxnakloops, "Set limit on number of LCP configure-naks" }, + { "receive-all", o_bool, &lax_recv, + "Accept all received control characters", 1 }, {NULL} }; @@ -117,7 +120,7 @@ u_int32_t xmit_accm[NUM_PPP][8]; /* extended transmit ACCM */ static u_int32_t lcp_echos_pending = 0; /* Number of outstanding echo msgs */ static u_int32_t lcp_echo_number = 0; /* ID number of next echo frame */ -static u_int32_t lcp_echo_timer_running = 0; /* TRUE if a timer is running */ +static u_int32_t lcp_echo_timer_running = 0; /* set if a timer is running */ static u_char nak_buffer[PPP_MRU]; /* where we construct a nak packet */ @@ -192,6 +195,7 @@ struct protent lcp_protent = { NULL, 1, "LCP", + NULL, lcp_option_list, NULL, NULL, @@ -364,7 +368,7 @@ lcp_lowerup(unit) */ ppp_set_xaccm(unit, xmit_accm[unit]); ppp_send_config(unit, PPP_MRU, 0xffffffff, 0, 0); - ppp_recv_config(unit, PPP_MRU, 0xffffffff, + ppp_recv_config(unit, PPP_MRU, (lax_recv? 0: 0xffffffff), wo->neg_pcompression, wo->neg_accompression); peer_mru[unit] = PPP_MRU; lcp_allowoptions[unit].asyncmap = xmit_accm[unit][0]; @@ -1043,18 +1047,16 @@ lcp_nakci(f, p, len) p = next; } - /* If there is still anything left, this packet is bad. */ - if (len != 0) - goto bad; - /* * OK, the Nak is good. Now we can update state. + * If there are any options left we ignore them. */ if (f->state != OPENED) { if (looped_back) { if (++try.numloops >= lcp_loopbackfail) { notice("Serial line is looped back."); lcp_close(f->unit, "Loopback detected"); + status = EXIT_LOOPBACK; } } else try.numloops = 0; @@ -1550,7 +1552,7 @@ lcp_up(f) (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), ho->neg_pcompression, ho->neg_accompression); ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU), - (go->neg_asyncmap? go->asyncmap: 0xffffffff), + (lax_recv? 0: go->neg_asyncmap? go->asyncmap: 0xffffffff), go->neg_pcompression, go->neg_accompression); if (ho->neg_mru) @@ -1723,7 +1725,7 @@ lcp_printpkt(p, plen, printer, arg) if (olen >= CILEN_CHAR) { p += 2; printer(arg, "callback "); - GETSHORT(cishort, p); + GETCHAR(cishort, p); switch (cishort) { case CBCP_OPT: printer(arg, "CBCP"); @@ -1804,6 +1806,7 @@ void LcpLinkFailure (f) info("No response to %d echo-requests", lcp_echos_pending); notice("Serial link appears to be disconnected."); lcp_close(f->unit, "Peer not responding"); + status = EXIT_PEER_DEAD; } } @@ -1816,6 +1819,8 @@ LcpEchoCheck (f) fsm *f; { LcpSendEchoRequest (f); + if (f->state != OPENED) + return; /* * Start the timer for the next interval.