summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/datalink.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2002-03-30 12:30:09 +0000
committerbrian <brian@FreeBSD.org>2002-03-30 12:30:09 +0000
commitee9763124d8cbeceba9f2194f3ea61c1f2c1d362 (patch)
treeb285f7b912098d74c02bd2a8b542e1472a52003a /usr.sbin/ppp/datalink.c
parentef538de24ea069ff6846f7363f8a329a92cf1aa1 (diff)
downloadFreeBSD-src-ee9763124d8cbeceba9f2194f3ea61c1f2c1d362.zip
FreeBSD-src-ee9763124d8cbeceba9f2194f3ea61c1f2c1d362.tar.gz
Merge the NETGRAPH branch into HEAD. tty devices now use netgraph's line
discipline to do the async escaping, but no other benefits are available yet. Change ``ifdef HAVE_DES'' to ``ifndef NODES'' for consistency. Make the Makefile a little more sane WRT RELEASE_CRUNCH.
Diffstat (limited to 'usr.sbin/ppp/datalink.c')
-rw-r--r--usr.sbin/ppp/datalink.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c
index 135160b..87cab95 100644
--- a/usr.sbin/ppp/datalink.c
+++ b/usr.sbin/ppp/datalink.c
@@ -489,7 +489,10 @@ datalink_Write(struct fdescriptor *d, struct bundle *bundle,
case DATALINK_DIAL:
case DATALINK_LOGOUT:
case DATALINK_LOGIN:
- result = descriptor_Write(&dl->chat.desc, bundle, fdset);
+ if ((result = descriptor_Write(&dl->chat.desc, bundle, fdset)) == -1) {
+ datalink_ComeDown(dl, CLOSE_NORMAL);
+ result = 0;
+ }
break;
case DATALINK_READY:
@@ -498,16 +501,28 @@ datalink_Write(struct fdescriptor *d, struct bundle *bundle,
case DATALINK_CBCP:
case DATALINK_OPEN:
if (descriptor_IsSet(&dl->chap.desc, fdset))
- result += descriptor_Write(&dl->chap.desc, bundle, fdset);
+ switch (descriptor_Write(&dl->chap.desc, bundle, fdset)) {
+ case -1:
+ datalink_ComeDown(dl, CLOSE_NORMAL);
+ break;
+ case 1:
+ result++;
+ }
if (descriptor_IsSet(&dl->physical->desc, fdset))
- result += descriptor_Write(&dl->physical->desc, bundle, fdset);
+ switch (descriptor_Write(&dl->physical->desc, bundle, fdset)) {
+ case -1:
+ datalink_ComeDown(dl, CLOSE_NORMAL);
+ break;
+ case 1:
+ result++;
+ }
break;
}
return result;
}
-static void
+void
datalink_ComeDown(struct datalink *dl, int how)
{
int stayonline;
OpenPOWER on IntegriCloud