- * io - Catch SIGIO signal.
- *
- * Indicates that incoming data is available.
- */
-static void
-io(sig)
- int sig;
-{
- int len, i;
- u_char *p;
- u_short protocol;
- fd_set fdset;
- struct timeval notime;
- int ready;
-
- MAINDEBUG((LOG_DEBUG, "IO signal received"));
- adjtimeout(); /* Adjust timeouts */
-
- /* Yup, this is for real */
- for (;;) { /* Read all available packets */
- p = inpacket_buf; /* point to beginning of packet buffer */
-
- len = read_packet(inpacket_buf);
- if (len < 0)
- return;
-
- if (len == 0) {
- MAINDEBUG((LOG_DEBUG, "End of file on fd!"));
- lcp_lowerdown(0);
- return;
- }
-
- if (debug /*&& (debugflags & DBG_INPACKET)*/)
- log_packet(p, len, "rcvd ");
-
- if (len < DLLHEADERLEN) {
- MAINDEBUG((LOG_INFO, "io(): Received short packet."));
- return;
- }
-
- p += 2; /* Skip address and control */
- GETSHORT(protocol, p);
- len -= DLLHEADERLEN;
-
- /*
- * Toss all non-LCP packets unless LCP is OPEN.
- */
- if (protocol != LCP && lcp_fsm[0].state != OPENED) {
- MAINDEBUG((LOG_INFO,
- "io(): Received non-LCP packet when LCP not open."));
- return;
- }
-
- /*
- * Upcall the proper protocol input routine.
- */
- for (i = 0; i < sizeof (prottbl) / sizeof (struct protent); i++)
- if (prottbl[i].protocol == protocol) {
- (*prottbl[i].input)(0, p, len);
- break;
- }
-
- if (i == sizeof (prottbl) / sizeof (struct protent)) {
- syslog(LOG_WARNING, "input: Unknown protocol (%x) received!",
- protocol);
- lcp_sprotrej(0, p - DLLHEADERLEN, len + DLLHEADERLEN);
- }
- }
-}
-
-/*
- * demuxprotrej - Demultiplex a Protocol-Reject.
- */
-void
-demuxprotrej(unit, protocol)
- int unit;
- u_short protocol;
-{
- int i;
-
- /*
- * Upcall the proper Protocol-Reject routine.
- */
- for (i = 0; i < sizeof (prottbl) / sizeof (struct protent); i++)
- if (prottbl[i].protocol == protocol) {
- (*prottbl[i].protrej)(unit);
- return;
- }
-
- syslog(LOG_WARNING,
- "demuxprotrej: Unrecognized Protocol-Reject for protocol %d!",
- protocol);
-}
-
-
-/*
- * incdebug - Catch SIGUSR1 signal.