Root/package/network/services/ppp/patches/101-debian_close_dev_ppp.patch

1pppd: Close already open ppp descriptors
2
3When using the kernel PPPoE driver in conjunction with the "persist" option,
4the already open descriptor to /dev/ppp is not closed when the link is
5reestablished. This eventually leads to high CPU load because the stray
6descriptors are always reported as ready by select().
7
8This patch closes the descriptor if it is already open when establishing a
9new connection. It originated from the Debian project.
10
11Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
12
13--- a/pppd/sys-linux.c
14+++ b/pppd/sys-linux.c
15@@ -453,6 +453,13 @@ int generic_establish_ppp (int fd)
16     if (new_style_driver) {
17     int flags;
18 
19+ /* if a ppp_fd is already open, close it first */
20+ if(ppp_fd > 0) {
21+ close(ppp_fd);
22+ remove_fd(ppp_fd);
23+ ppp_fd = -1;
24+ }
25+
26     /* Open an instance of /dev/ppp and connect the channel to it */
27     if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) {
28         error("Couldn't get channel number: %m");
29

Archive Download this file



interactive