X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=7cae7ce780f58b5bee07710e298ab6fb2ab842b2;hp=33e338d29a46546b761e9e9ea7adf3f4ebc2c9a7;hb=2ab2f6e584f5a0d5a23c180644e4ce7fd1f759ae;hpb=e8be982dbc5c6c50dfc9f66737867570c8ed4973 diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 33e338d..7cae7ce 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -381,10 +381,20 @@ int establish_ppp (int tty_fd) void disestablish_ppp(int tty_fd) { + int nout; + + if (!hungup) { /* - * Attempt to restore the previous tty settings + * Flush the tty output buffer so that the TIOCSETD doesn't hang. + * We may have to do this several times because the tcflush only + * affects the serial driver, and may trigger the ppp driver to + * supply more data to the serial driver. */ - if (!hungup) { + do { + if (tcflush(tty_fd, TCIOFLUSH) < 0) + break; + nout = 0; + } while (ioctl(tty_fd, TIOCOUTQ, &nout) >= 0 && nout > 0); /* * Restore the previous line discipline */ @@ -1608,9 +1618,11 @@ int ppp_available(void) no_ppp_msg = "This system lacks kernel support for PPP. This could be because\n" - "the PPP kernel module is not loaded, or because the kernel is\n" - "not configured for PPP. See the README.linux file in the\n" - "ppp-2.3.7 distribution.\n"; + "the PPP kernel module could not be loaded, or because PPP was not\n" + "included in the kernel configuration. If PPP was included as a\n" + "module, try `/sbin/modprobe -v ppp'. If that fails, check that\n" + "ppp.o exists in /lib/modules/`uname -r`/net.\n" + "See README.linux file in the ppp distribution for more details.\n"; /* * Open a socket for doing the ioctl operations.