fix sstrip compile on mac os x
[openwrt.git] / package / ppp / patches / 100-debian_close_dev_ppp.patch
1 From: Simon Peter <dn.tlp@gmx.net>
2 Subject: Bug#306261: pppd does not properly close /dev/ppp on persist
3
4 When using the kernel PPPoE driver, pppd never
5 closes /dev/ppp when the link has come down.
6
7 It opens superfluous fds to the device each time it re-opens the
8 connection, with the unclosed ones falsely reported always ready for
9 data by select().
10
11 This makes pppd eat up 100% CPU time after the first persist because of
12 the always instantly returning select() on the unclosed fds.
13
14 The problem also occurs with the upstream version, but does not occur
15 when a pty/tty device is used for the ppp connection.
16
17
18 Index: ppp-2.4.3/pppd/sys-linux.c
19 ===================================================================
20 --- ppp-2.4.3.orig/pppd/sys-linux.c 2007-06-04 13:22:08.527558896 +0200
21 +++ ppp-2.4.3/pppd/sys-linux.c 2007-06-04 13:22:08.807516336 +0200
22 @@ -453,6 +453,13 @@
23 if (new_style_driver) {
24 int flags;
25
26 + /* if a ppp_fd is already open, close it first */
27 + if(ppp_fd > 0) {
28 + close(ppp_fd);
29 + remove_fd(ppp_fd);
30 + ppp_fd = -1;
31 + }
32 +
33 /* Open an instance of /dev/ppp and connect the channel to it */
34 if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) {
35 error("Couldn't get channel number: %m");
This page took 0.040746 seconds and 5 git commands to generate.