summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/i4b.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-11-26 22:44:33 +0000
committerbrian <brian@FreeBSD.org>1999-11-26 22:44:33 +0000
commitf0003f34563b650e7d94531962fc8f09b2a5f5ec (patch)
tree32e3392d0d02f834be36bca1b87a8e39b935837e /usr.sbin/ppp/i4b.c
parent9e78c04cff601ba0a8897f3dc1b3740190596105 (diff)
downloadFreeBSD-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/i4b.c')
-rw-r--r--usr.sbin/ppp/i4b.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/usr.sbin/ppp/i4b.c b/usr.sbin/ppp/i4b.c
index eae596c..8046a45 100644
--- a/usr.sbin/ppp/i4b.c
+++ b/usr.sbin/ppp/i4b.c
@@ -122,17 +122,17 @@ i4b_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) {
+ else if (++dev->carrier_seconds >= dev->dev.cd.delay) {
log_Printf(LogPHASE, "%s: %s: No carrier"
" (increase ``set cd'' from %d ?)\n",
- p->link.name, p->name.full, p->cfg.cd.delay);
+ p->link.name, p->name.full, dev->dev.cd.delay);
timer_Stop(&dev->Timer);
/* i4b_AwaitCarrier() will notice */
} else {
/* 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 {
@@ -291,6 +291,7 @@ i4b_device2iov(struct device *d, struct iovec *iov, int *niov,
static struct device basei4bdevice = {
I4B_DEVICE,
"i4b",
+ { CD_REQUIRED, DEF_I4BCDDELAY },
i4b_AwaitCarrier,
NULL,
i4b_Raw,
@@ -373,6 +374,20 @@ i4b_Create(struct physical *p)
memset(&dev->Timer, '\0', sizeof dev->Timer);
dev->mbits = -1;
+ switch (p->cfg.cd.necessity) {
+ case CD_VARIABLE:
+ dev->dev.cd.delay = p->cfg.cd.delay;
+ break;
+ case CD_REQUIRED:
+ dev->dev.cd = p->cfg.cd;
+ break;
+ case CD_NOTREQUIRED:
+ log_Printf(LogWARN, "%s: Carrier must be set, using ``set cd %d!''\n",
+ p->link.name, dev->dev.cd.delay);
+ case CD_DEFAULT:
+ break;
+ }
+
oldflag = fcntl(p->fd, F_GETFL, 0);
if (oldflag < 0) {
/* Complete failure - parent doesn't continue trying to ``create'' */
OpenPOWER on IntegriCloud