]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
fix problem where lcp echo requests were getting doubled,
[ppp.git] / pppd / sys-linux.c
index 33e338d29a46546b761e9e9ea7adf3f4ebc2c9a7..436a5f1af66eab217a846c70e7b0e04e44f8b653 100644 (file)
@@ -381,10 +381,12 @@ int establish_ppp (int tty_fd)
 
 void disestablish_ppp(int tty_fd)
 {
+    if (!hungup) {
 /*
- * Attempt to restore the previous tty settings
+ * Flush the tty output buffer so that the TIOCSETD doesn't hang.
  */
-    if (!hungup) {
+       if (tcflush(tty_fd, TCIOFLUSH) < 0)
+           warn("tcflush failed: %m");
 /*
  * Restore the previous line discipline
  */
@@ -1022,7 +1024,7 @@ static int read_route_table (struct rtentry *rt);
  * path_to_procfs - find the path to the proc file system mount point
  */
 
-static int path_to_procfs (void)
+static int path_to_procfs (const char *tail)
 {
     struct mntent *mntent;
     FILE *fp;
@@ -1031,6 +1033,7 @@ static int path_to_procfs (void)
     if (fp == NULL) {
        /* Default the mount location of /proc */
        strlcpy (route_buffer, "/proc", sizeof (route_buffer));
+       strlcat (route_buffer, tail, sizeof(route_buffer));
        return 1;
     }
 
@@ -1045,6 +1048,7 @@ static int path_to_procfs (void)
        return 0;
 
     strlcpy(route_buffer, mntent->mnt_dir, sizeof (route_buffer));
+    strlcat (route_buffer, tail, sizeof(route_buffer));
     return 1;
 }
 
@@ -1055,11 +1059,10 @@ static int path_to_procfs (void)
 
 static char *path_to_route (void)
 {
-    if (!path_to_procfs()) {
+    if (!path_to_procfs("/net/route")) {
        error("proc file system not mounted");
        return 0;
     }
-    strlcat (route_buffer, "/net/route", sizeof(route_buffer));
     return (route_buffer);
 }
 
@@ -1608,9 +1611,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.
@@ -2392,21 +2397,16 @@ int
 sys_check_options(void)
 {
 #ifdef IPX_CHANGE
-    struct stat stat_buf;
 /*
  * Disable the IPX protocol if the support is not present in the kernel.
- * If we disable it then ensure that IP support is enabled.
  */
-    while (ipxcp_protent.enabled_flag) {
-        if (path_to_procfs()) {
-           strlcat (route_buffer, "/net/ipx_interface", sizeof(route_buffer));
-           if (lstat (route_buffer, &stat_buf) >= 0)
-               break;
+    if (ipxcp_protent.enabled_flag) {
+       struct stat stat_buf;
+        if (!path_to_procfs("/net/ipx_interface")
+           || lstat (route_buffer, &stat_buf) < 0) {
+           error("IPX support is not present in the kernel\n");
+           ipxcp_protent.enabled_flag = 0;
        }
-       error("IPX support is not present in the kernel\n");
-       ipxcp_protent.enabled_flag = 0;
-       ipcp_protent.enabled_flag  = 1;
-       break;
     }
 #endif
     if (demand && driver_is_old) {