1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-05 16:54:59 +02:00
openwrt-xburst/package/ppp/patches/100-debian_close_dev_ppp.patch
nbd b5cb1795de refresh all package patches in the buildroot using quilt
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7490 3c298f89-4303-0410-b956-a3cf2f4a3e73
2007-06-04 11:25:53 +00:00

36 lines
1.2 KiB
Diff

From: Simon Peter <dn.tlp@gmx.net>
Subject: Bug#306261: pppd does not properly close /dev/ppp on persist
When using the kernel PPPoE driver, pppd never
closes /dev/ppp when the link has come down.
It opens superfluous fds to the device each time it re-opens the
connection, with the unclosed ones falsely reported always ready for
data by select().
This makes pppd eat up 100% CPU time after the first persist because of
the always instantly returning select() on the unclosed fds.
The problem also occurs with the upstream version, but does not occur
when a pty/tty device is used for the ppp connection.
Index: ppp-2.4.3/pppd/sys-linux.c
===================================================================
--- ppp-2.4.3.orig/pppd/sys-linux.c 2007-06-04 13:22:08.527558896 +0200
+++ ppp-2.4.3/pppd/sys-linux.c 2007-06-04 13:22:08.807516336 +0200
@@ -453,6 +453,13 @@
if (new_style_driver) {
int flags;
+ /* if a ppp_fd is already open, close it first */
+ if(ppp_fd > 0) {
+ close(ppp_fd);
+ remove_fd(ppp_fd);
+ ppp_fd = -1;
+ }
+
/* Open an instance of /dev/ppp and connect the channel to it */
if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) {
error("Couldn't get channel number: %m");