X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=e963c79786097d2957ac65b6ca2323d58edd44de;hp=dcdb2ab82be3b8e58fb7deba324aa1131dd4cff3;hb=f9f667ee187be5d34ac94f11bf366dd218191122;hpb=64c5979a37b7865bc750f13dbe0b77507250e077 diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index dcdb2ab..e963c79 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -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;