bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The PPP Saga Continues


From: Daniel E Baumann
Subject: The PPP Saga Continues
Date: Sat, 26 May 2001 09:30:12 -0500
User-agent: Mutt/1.3.17i

Hello all, I fixed the very simple problem with the lock file creating thanks to
Marcus ;) and of course Roland. Now I got whole new problem (yay!), here's the 
log:

May 26 08:34:44 localhost ppp[736]: Phase: Using interface: tun0 
May 26 08:34:44 localhost ppp[736]: Phase: deflink: Created in closed state 
May 26 08:34:44 localhost ppp[736]: tun0: Command: default: set device 
/dev/com0 
May 26 08:34:44 localhost ppp[736]: tun0: Command: default: set speed 38400 
May 26 08:34:44 localhost ppp[736]: tun0: Command: default: set dial ABORT BUSY 
ABORT NO\sCARRIER TIMEOUT 5 "" AT            OK-AT-OK ATE1Q0 OK 
\dATDT12628276000\T TIMEOUT 40 CONNECT 
May 26 08:34:44 localhost ppp[736]: tun0: Command: default: load ISP 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: set phone 12628276000 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: set login 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: set authname Pbaberd 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: set authkey ******** 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: set timeout 120 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: set ifaddr 10.0.0.1/0 
10.0.0.2/0 0.0.0.0 0.0.0.0 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: add default HISADDR 
May 26 08:34:45 localhost ppp[736]: tun0: Command: ISP: enable dns 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: PPP Started (background mode). 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: bundle: Establish 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: closed -> opening 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: Connected! 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: opening -> dial 
May 26 08:34:45 localhost ppp[737]: tun0: Chat: Phone: 12628276000 
May 26 08:34:45 localhost ppp[737]: tun0: Chat: deflink: Dial attempt 1 of 1 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: Exception detected on 
descriptor 0 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: Disconnected! 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: dial -> logout 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: logout -> hangup 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: Disconnected! 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: Connect time: 0 secs: 
0 octets in, 0 octets out 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: : 0 packets in, 0 
packets out 
May 26 08:34:45 localhost ppp[737]: tun0: Phase:  total 0 bytes/sec, peak 0 
bytes/sec on Sat May 26 08:34:45 2001 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: deflink: hangup -> closed 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: bundle: Dead 
May 26 08:34:45 localhost ppp[737]: tun0: Phase: PPP Terminated (normal). 
May 26 08:34:45 localhost ppp[737]: tun0: Chat: Parent notified of failure 
May 26 08:34:45 localhost ppp[736]: tun0: Phase: Parent: Child failed (errdead) 

The problem being:

May 26 08:34:45 localhost ppp[737]: tun0: Phase: Exception detected on 
descriptor 0 

when things are set up in select() it uses a set of exception file descriptors 
and
loops through and descriptor 0 throws an exception rigt away (I am not sure 
what to
make of this). The tr light on my modem flashes momentarily before PPP dies. I 
get
no dialing in.

Here's the relevant function which is called from main():

static void
DoLoop(struct bundle *bundle)
{
  fd_set rfds, wfds, efds;
  int i, nfds, nothing_done;
  struct probe probe;

  probe_Init(&probe);

  for (; !bundle_IsDead(bundle); bundle_CleanDatalinks(bundle)) {
    nfds = 0;
    FD_ZERO(&rfds);
    FD_ZERO(&wfds);
    FD_ZERO(&efds);

    /* All our datalinks, the tun device and the MP socket */
    descriptor_UpdateSet(&bundle->desc, &rfds, &wfds, &efds, &nfds);

    /* All our prompts and the diagnostic socket */
    descriptor_UpdateSet(&server.desc, &rfds, NULL, NULL, &nfds);

    bundle_CleanDatalinks(bundle);
    if (bundle_IsDead(bundle))
      /* Don't select - we'll be here forever */
      break;

    /*
     * It's possible that we've had a signal since we last checked.  If
     * we don't check again before calling select(), we may end up stuck
     * after having missed the event.... sig_Handle() tries to be as
     * quick as possible if nothing is likely to have happened.
     * This is only really likely if we block in open(... O_NONBLOCK)
     * which will happen with a misconfigured device.
     */
    if (sig_Handle())
      continue;

    i = select(nfds, &rfds, &wfds, &efds, NULL);

    if (i < 0 && errno != EINTR) {
      log_Printf(LogERROR, "DoLoop: select(): %s\n", strerror(errno));
      if (log_IsKept(LogTIMER)) {
        struct timeval t;

        for (i = 0; i <= nfds; i++) {
          if (FD_ISSET(i, &rfds)) {
            log_Printf(LogTIMER, "Read set contains %d\n", i);
            FD_CLR(i, &rfds);
            t.tv_sec = t.tv_usec = 0;
            if (select(nfds, &rfds, &wfds, &efds, &t) != -1) {
              log_Printf(LogTIMER, "The culprit !\n");
              break;
            }
          }
          if (FD_ISSET(i, &wfds)) {
            log_Printf(LogTIMER, "Write set contains %d\n", i);
            FD_CLR(i, &wfds);
            t.tv_sec = t.tv_usec = 0;
            if (select(nfds, &rfds, &wfds, &efds, &t) != -1) {
              log_Printf(LogTIMER, "The culprit !\n");
              break;
            }
          }
          if (FD_ISSET(i, &efds)) {
            log_Printf(LogTIMER, "Error set contains %d\n", i);
            FD_CLR(i, &efds);
            t.tv_sec = t.tv_usec = 0;
            if (select(nfds, &rfds, &wfds, &efds, &t) != -1) {
              log_Printf(LogTIMER, "The culprit !\n");
              break;
            }
          }
        }
      }
      break;
    }

    log_Printf(LogTIMER, "Select returns %d\n", i);

    sig_Handle();

    if (i <= 0)
      continue;

    for (i = 0; i <= nfds; i++)
      if (FD_ISSET(i, &efds)) {
        log_Printf(LogPHASE, "Exception detected on descriptor %d\n", i);
        /* We deal gracefully with link descriptor exceptions */
        if (!bundle_Exception(bundle, i)) {
          log_Printf(LogERROR, "Exception cannot be handled !\n");
          break;
        }
      }

    if (i <= nfds)
      break;

    nothing_done = 1;

    if (descriptor_IsSet(&server.desc, &rfds)) {
      descriptor_Read(&server.desc, bundle, &rfds);
      nothing_done = 0;
    }

    if (descriptor_IsSet(&bundle->desc, &rfds)) {
      descriptor_Read(&bundle->desc, bundle, &rfds);
      nothing_done = 0;
    }

    if (descriptor_IsSet(&bundle->desc, &wfds))
      if (!descriptor_Write(&bundle->desc, bundle, &wfds) && nothing_done) {
        /*
         * This is disasterous.  The OS has told us that something is
         * writable, and all our write()s have failed.  Rather than
         * going back immediately to do our UpdateSet()s and select(),
         * we sleep for a bit to avoid gobbling up all cpu time.
         */
        struct timeval t;

        t.tv_sec = 0;
        t.tv_usec = 100000;
        select(0, NULL, NULL, NULL, &t);
      }
  }

  log_Printf(LogDEBUG, "DoLoop done.\n");
}

-- 
Daniel E Baumann      danielb@freedevelopers.net 

And if cynics ridicule freedom, ridicule community...if ``hard nosed 
realists'' say that profit is the only ideal...just ignore them, and use 
copyleft all the same.
      -- RMS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]