]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
Added log messages for LCP Identification, Time-Remaining, and other
[ppp.git] / pppd / sys-linux.c
index dcdb2ab82be3b8e58fb7deba324aa1131dd4cff3..e963c79786097d2957ac65b6ca2323d58edd44de 100644 (file)
@@ -173,8 +173,8 @@ static int ppp_disc = N_PPP;        /* The PPP discpline */
 static int initfdflags = -1;   /* Initial file descriptor flags for fd */
 static int ppp_fd = -1;                /* fd which is set to PPP discipline */
 static int sock_fd = -1;       /* socket for doing interface ioctls */
-static int slave_fd = -1;
-static int master_fd = -1;
+static int slave_fd = -1;      /* pty for old-style demand mode, slave */
+static int master_fd = -1;     /* pty for old-style demand mode, master */
 #ifdef INET6
 static int sock6_fd = -1;
 #endif /* INET6 */
@@ -593,7 +593,7 @@ void generic_disestablish_ppp(int dev_fd)
        if (demand) {
            modify_flags(ppp_dev_fd, 0, SC_LOOP_TRAFFIC);
            looped = 1;
-       } else if (ppp_dev_fd >= 0) {
+       } else if (!doing_multilink && ppp_dev_fd >= 0) {
            close(ppp_dev_fd);
            remove_fd(ppp_dev_fd);
            ppp_dev_fd = -1;
@@ -712,6 +712,18 @@ int bundle_attach(int ifnum)
        return 1;
 }
 
+/*
+ * destroy_bundle - tell the driver to destroy our bundle.
+ */
+void destroy_bundle(void)
+{
+       if (ppp_dev_fd >= 0) {
+               close(ppp_dev_fd);
+               remove_fd(ppp_dev_fd);
+               ppp_dev_fd = -1;
+       }
+}
+
 /********************************************************************
  *
  * clean_check - Fetch the flags for the device and generate
@@ -1086,15 +1098,21 @@ int read_packet (unsigned char *buf)
        if (nr < 0 && errno == ENXIO)
            return 0;
     }
-    if (nr < 0 && new_style_driver && ppp_dev_fd >= 0) {
+    if (nr < 0 && new_style_driver && ppp_dev_fd >= 0 && !bundle_eof) {
        /* N.B. we read ppp_fd first since LCP packets come in there. */
        nr = read(ppp_dev_fd, buf, len);
        if (nr < 0 && errno != EWOULDBLOCK && errno != EAGAIN
            && errno != EIO && errno != EINTR)
            error("read /dev/ppp: %m");
        if (nr < 0 && errno == ENXIO)
-           return 0;
+           nr = 0;
+       if (nr == 0 && doing_multilink) {
+           remove_fd(ppp_dev_fd);
+           bundle_eof = 1;
+       }
     }
+    if (new_style_driver && ppp_fd < 0 && ppp_dev_fd < 0)
+       nr = 0;
     return (new_style_driver && nr > 0)? nr+2: nr;
 }
 
@@ -2790,7 +2808,8 @@ sys_check_options(void)
 
     if (ipxcp_protent.enabled_flag) {
        struct stat stat_buf;
-       if ((path = path_to_procfs("/net/ipx_interface")) == 0
+       if ((path = path_to_procfs("/net/ipx/interface")) == 0
+           || (path = path_to_procfs("/net/ipx_interface")) == 0
            || lstat(path, &stat_buf) < 0) {
            error("IPX support is not present in the kernel\n");
            ipxcp_protent.enabled_flag = 0;