* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define RCSID "$Id: lcp.c,v 1.72 2004/11/12 10:30:51 paulus Exp $"
+#define RCSID "$Id: lcp.c,v 1.76 2006/05/22 00:04:07 paulus Exp $"
/*
* TODO:
static int lcp_cilen __P((fsm *)); /* Return length of our CI */
static void lcp_addci __P((fsm *, u_char *, int *)); /* Add our CI to pkt */
static int lcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */
-static int lcp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */
+static int lcp_nakci __P((fsm *, u_char *, int, int)); /* Peer nak'd our CI */
static int lcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */
static int lcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv peer CI */
static void lcp_up __P((fsm *)); /* We're UP */
ao->neg_magicnumber = 1;
ao->neg_pcompression = 1;
ao->neg_accompression = 1;
-#ifdef CBCP_SUPPORT
- ao->neg_cbcp = 1;
-#endif
ao->neg_endpoint = 1;
}
fsm_input(f, p, len);
}
-
/*
* lcp_extcode - Handle a LCP-specific code.
*/
break;
case DISCREQ:
+ case IDENTIF:
+ case TIMEREM:
break;
default:
int i;
struct protent *protp;
u_short prot;
+ const char *pname;
if (len < 2) {
LCPDEBUG(("lcp_rprotrej: Rcvd short Protocol-Reject packet!"));
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);
}
* 1 - Nak was good.
*/
static int
-lcp_nakci(f, p, len)
+lcp_nakci(f, p, len, treat_as_reject)
fsm *f;
u_char *p;
int len;
+ int treat_as_reject;
{
lcp_options *go = &lcp_gotoptions[f->unit];
lcp_options *wo = &lcp_wantoptions[f->unit];
*/
if (go->neg_mrru) {
NAKCISHORT(CI_MRRU, neg_mrru,
- if (cishort <= wo->mrru)
+ if (treat_as_reject)
+ try.neg_mrru = 0;
+ else if (cishort <= wo->mrru)
try.mrru = cishort;
);
}
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;
static char *lcp_codenames[] = {
"ConfReq", "ConfAck", "ConfNak", "ConfRej",
"TermReq", "TermAck", "CodeRej", "ProtRej",
- "EchoReq", "EchoRep", "DiscReq"
+ "EchoReq", "EchoRep", "DiscReq", "Ident",
+ "TimeRem"
};
static int
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 */
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");
}
}