X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Flcp.c;h=995ba736f604b8dd8a72d2ece87291caad195a46;hp=23f69fe5f0360a10f7c1b34a16b90da19037cf4a;hb=3e451dfe42426b51e6ce1d66a3e04de43e055568;hpb=ec27e67401c1e4031be2fa7f692d3d66d5bee586 diff --git a/pppd/lcp.c b/pppd/lcp.c index 23f69fe..995ba73 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -40,7 +40,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: lcp.c,v 1.74 2004/11/13 02:28:15 paulus Exp $" +#define RCSID "$Id: lcp.c,v 1.76 2006/05/22 00:04:07 paulus Exp $" /* * TODO: @@ -494,7 +494,6 @@ lcp_input(unit, p, len) fsm_input(f, p, len); } - /* * lcp_extcode - Handle a LCP-specific code. */ @@ -525,6 +524,8 @@ lcp_extcode(f, code, id, inp, len) break; case DISCREQ: + case IDENTIF: + case TIMEREM: break; default: @@ -548,6 +549,7 @@ lcp_rprotrej(f, inp, len) int i; struct protent *protp; u_short prot; + const char *pname; if (len < 2) { LCPDEBUG(("lcp_rprotrej: Rcvd short Protocol-Reject packet!")); @@ -565,16 +567,27 @@ lcp_rprotrej(f, inp, len) return; } + pname = protocol_name(prot); + /* * Upcall the proper Protocol-Reject routine. */ for (i = 0; (protp = protocols[i]) != NULL; ++i) if (protp->protocol == prot && protp->enabled_flag) { + if (pname == NULL) + dbglog("Protocol-Reject for 0x%x received", prot); + else + dbglog("Protocol-Reject for '%s' (0x%x) received", pname, + prot); (*protp->protrej)(f->unit); return; } - warn("Protocol-Reject for unsupported protocol 0x%x", prot); + if (pname == NULL) + warn("Protocol-Reject for unsupported protocol 0x%x", prot); + else + warn("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname, + prot); } @@ -1292,8 +1305,8 @@ lcp_nakci(f, p, len, treat_as_reject) if (looped_back) { if (++try.numloops >= lcp_loopbackfail) { notice("Serial line is looped back."); - lcp_close(f->unit, "Loopback detected"); status = EXIT_LOOPBACK; + lcp_close(f->unit, "Loopback detected"); } } else try.numloops = 0; @@ -1964,7 +1977,8 @@ lcp_finished(f) static char *lcp_codenames[] = { "ConfReq", "ConfAck", "ConfNak", "ConfRej", "TermReq", "TermAck", "CodeRej", "ProtRej", - "EchoReq", "EchoRep", "DiscReq" + "EchoReq", "EchoRep", "DiscReq", "Ident", + "TimeRem" }; static int @@ -2168,10 +2182,31 @@ lcp_printpkt(p, plen, printer, arg) if (len >= 4) { GETLONG(cilong, p); printer(arg, " magic=0x%x", cilong); - p += 4; len -= 4; } break; + + case IDENTIF: + case TIMEREM: + if (len >= 4) { + GETLONG(cilong, p); + printer(arg, " magic=0x%x", cilong); + len -= 4; + } + if (code == TIMEREM) { + if (len < 4) + break; + GETLONG(cilong, p); + printer(arg, " seconds=%u", cilong); + len -= 4; + } + if (len > 0) { + printer(arg, " "); + print_string((char *)p, len, printer, arg); + p += len; + len = 0; + } + break; } /* print the rest of the bytes in the packet */ @@ -2198,8 +2233,8 @@ void LcpLinkFailure (f) if (f->state == OPENED) { 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; + lcp_close(f->unit, "Peer not responding"); } }