diff options
author | brian <brian@FreeBSD.org> | 1999-11-26 22:44:33 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-11-26 22:44:33 +0000 |
commit | f0003f34563b650e7d94531962fc8f09b2a5f5ec (patch) | |
tree | 32e3392d0d02f834be36bca1b87a8e39b935837e /usr.sbin/ppp/tty.c | |
parent | 9e78c04cff601ba0a8897f3dc1b3740190596105 (diff) | |
download | FreeBSD-src-f0003f34563b650e7d94531962fc8f09b2a5f5ec.zip FreeBSD-src-f0003f34563b650e7d94531962fc8f09b2a5f5ec.tar.gz |
Change ``set cd'' so that its default value is device specific. The
default is still 1 second for ttys, but is now 6 seconds for i4b (ISDN)
devices and 5 seconds for ethernet (PPPoE) devices.
Diffstat (limited to 'usr.sbin/ppp/tty.c')
-rw-r--r-- | usr.sbin/ppp/tty.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/ppp/tty.c b/usr.sbin/ppp/tty.c index 54093b1..13e7a1a 100644 --- a/usr.sbin/ppp/tty.c +++ b/usr.sbin/ppp/tty.c @@ -109,8 +109,9 @@ tty_Timeout(void *data) if (p->fd >= 0) { if (ioctl(p->fd, TIOCMGET, &dev->mbits) < 0) { /* we must be a pty ? */ - log_Printf(LogDEBUG, "%s: ioctl error (%s)!\n", p->link.name, - strerror(errno)); + if (p->cfg.cd.necessity != CD_DEFAULT) + log_Printf(LogWARN, "%s: Carrier ioctl not supported, " + "using ``set cd off''\n", p->link.name); timer_Stop(&dev->Timer); return; } @@ -121,8 +122,8 @@ tty_Timeout(void *data) /* First time looking for carrier */ if (Online(dev)) log_Printf(LogPHASE, "%s: %s: CD detected\n", p->link.name, p->name.full); - else if (++dev->carrier_seconds >= p->cfg.cd.delay) { - if (p->cfg.cd.necessity == CD_REQUIRED) + else if (++dev->carrier_seconds >= dev->dev.cd.delay) { + if (dev->dev.cd.necessity == CD_REQUIRED) log_Printf(LogPHASE, "%s: %s: Required CD not detected\n", p->link.name, p->name.full); else { @@ -136,7 +137,7 @@ tty_Timeout(void *data) /* Keep waiting */ log_Printf(LogDEBUG, "%s: %s: Still no carrier (%d/%d)\n", p->link.name, p->name.full, dev->carrier_seconds, - p->cfg.cd.delay); + dev->dev.cd.delay); dev->mbits = -1; } } else { @@ -176,7 +177,7 @@ tty_AwaitCarrier(struct physical *p) { struct ttydevice *dev = device2tty(p->handler); - if (p->cfg.cd.necessity == CD_NOTREQUIRED || physical_IsSync(p)) + if (dev->dev.cd.necessity == CD_NOTREQUIRED || physical_IsSync(p)) return CARRIER_OK; if (dev->mbits == -1) { @@ -187,7 +188,7 @@ tty_AwaitCarrier(struct physical *p) return CARRIER_PENDING; /* Not yet ! */ } - return Online(dev) || !p->cfg.cd.necessity == CD_REQUIRED ? + return Online(dev) || !dev->dev.cd.necessity == CD_REQUIRED ? CARRIER_OK : CARRIER_LOST; } @@ -331,6 +332,7 @@ tty_device2iov(struct device *d, struct iovec *iov, int *niov, static struct device basettydevice = { TTY_DEVICE, "tty", + { CD_VARIABLE, DEF_TTYCDDELAY }, tty_AwaitCarrier, NULL, tty_Raw, @@ -407,6 +409,10 @@ tty_Create(struct physical *p) tcgetattr(p->fd, &ios); dev->ios = ios; + if (p->cfg.cd.necessity != CD_DEFAULT) + /* Any override is ok for the tty device */ + dev->dev.cd = p->cfg.cd; + log_Printf(LogDEBUG, "%s: tty_Create: physical (get): fd = %d," " iflag = %lx, oflag = %lx, cflag = %lx\n", p->link.name, p->fd, (u_long)ios.c_iflag, (u_long)ios.c_oflag, (u_long)ios.c_cflag); |