lkml.org 
[lkml]   [1999]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
Subject[PATCH] PPPD problems in persist mode with new kernel ppp driver
Hello people!

pppd-2.3.9 (release) and pppd-2.3.9-pre1 fails to work in
'persist' mode with new ppp driver (kernels 2.3.13+). During
the first attempt to reestablish PPP it exits:

[...]
Aug 14 00:53:04 greengrass pppd[3243]: Hangup (SIGHUP)
Aug 14 00:53:10 greengrass pppd[3243]: Connection terminated.
Aug 14 00:53:10 greengrass pppd[3243]: Connect time 1.1 minutes.
Aug 14 00:53:10 greengrass pppd[3243]: Sent 626 bytes, received 743 bytes.
Aug 14 00:53:10 greengrass pppd[3243]: tcflush failed: Input/output error
Aug 14 00:53:46 greengrass pppd[3243]: Serial connection established.
Aug 14 00:53:46 greengrass pppd[3243]: Couldn't create new ppp unit: Invalid argument
Aug 14 00:53:47 greengrass pppd[3243]: tcsetattr: Invalid argument
Aug 14 00:53:47 greengrass pppd[3243]: Exit.

Here is a proposed patch to pppd-2.3.9 (release), that solves this
problem, while retaining pppd ability to work both with new and
old kernel's ppp driver. 'demand' mode is not tested, but expected
to work. The patch should be applied after ppp-2.3.9-patch1 (found
at the official pppd ftp site).

Vladimir
P.S. please CC replies to originating email address.

-----------------------------------------------------------------
diff -u --recursive --new-file ppp-2.3.9/pppd/main.c ppp-new/pppd/main.c
--- ppp-2.3.9/pppd/main.c Fri Aug 13 09:46:15 1999
+++ ppp-new/pppd/main.c Sun Aug 15 12:39:32 1999
@@ -1029,18 +1029,19 @@
p = inpacket_buf; /* point to beginning of packet buffer */

len = read_packet(inpacket_buf);
- if (len < 0)
- return;

- if (len == 0) {
+ if (len == 0) hungup = 1;
+ if (hungup) {
notice("Modem hangup");
- hungup = 1;
status = EXIT_HANGUP;
lcp_lowerdown(0); /* serial link is no longer available */
link_terminated(0);
return;
}

+ if (len < 0)
+ return;
+
if (debug /*&& (debugflags & DBG_INPACKET)*/)
dbglog("rcvd %P", p, len);

@@ -1339,6 +1340,7 @@
{
info("Hangup (SIGHUP)");
kill_link = 1;
+ hungup = 1;
if (status != EXIT_HANGUP)
status = EXIT_USER_REQUEST;
if (conn_running)
diff -u --recursive --new-file ppp-2.3.9/pppd/sys-linux.c ppp-new/pppd/sys-linux.c
--- ppp-2.3.9/pppd/sys-linux.c Sun Aug 15 12:56:34 1999
+++ ppp-new/pppd/sys-linux.c Sun Aug 15 12:06:59 1999
@@ -248,6 +248,8 @@
warn("Couldn't set /dev/ppp to nonblock: %m");
}

+ ifunit = -1;
+
/* Get an internet socket for doing socket ioctls. */
sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (sock_fd < 0) {
@@ -362,9 +364,9 @@
if (new_style_driver) {
if (!demand) {
/* allocate ourselves a ppp unit */
- ifunit = -1;
- if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
- fatal("Couldn't create new ppp unit: %m");
+ if (ifunit == -1)
+ if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
+ fatal("Couldn't create new ppp unit: %m");
set_kdebugflag(kdebugflag);
} else {
set_flags(ppp_dev_fd, get_flags(ppp_dev_fd) & ~SC_LOOP_TRAFFIC);
@@ -2107,9 +2109,9 @@

if (new_style_driver) {
/* allocate ourselves a ppp unit */
- ifunit = -1;
- if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
- fatal("Couldn't create PPP unit: %m");
+ if (ifunit == -1)
+ if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
+ fatal("Couldn't create PPP unit: %m");
set_flags(ppp_dev_fd, SC_LOOP_TRAFFIC);
set_kdebugflag(kdebugflag);
ppp_fd = -1;
-------------------------------------------------------------------diff -u --recursive --new-file ppp-2.3.9/pppd/main.c ppp-new/pppd/main.c
--- ppp-2.3.9/pppd/main.c Fri Aug 13 09:46:15 1999
+++ ppp-new/pppd/main.c Sun Aug 15 12:39:32 1999
@@ -1029,18 +1029,19 @@
p = inpacket_buf; /* point to beginning of packet buffer */

len = read_packet(inpacket_buf);
- if (len < 0)
- return;

- if (len == 0) {
+ if (len == 0) hungup = 1;
+ if (hungup) {
notice("Modem hangup");
- hungup = 1;
status = EXIT_HANGUP;
lcp_lowerdown(0); /* serial link is no longer available */
link_terminated(0);
return;
}

+ if (len < 0)
+ return;
+
if (debug /*&& (debugflags & DBG_INPACKET)*/)
dbglog("rcvd %P", p, len);

@@ -1339,6 +1340,7 @@
{
info("Hangup (SIGHUP)");
kill_link = 1;
+ hungup = 1;
if (status != EXIT_HANGUP)
status = EXIT_USER_REQUEST;
if (conn_running)
diff -u --recursive --new-file ppp-2.3.9/pppd/sys-linux.c ppp-new/pppd/sys-linux.c
--- ppp-2.3.9/pppd/sys-linux.c Sun Aug 15 12:56:34 1999
+++ ppp-new/pppd/sys-linux.c Sun Aug 15 12:06:59 1999
@@ -248,6 +248,8 @@
warn("Couldn't set /dev/ppp to nonblock: %m");
}

+ ifunit = -1;
+
/* Get an internet socket for doing socket ioctls. */
sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (sock_fd < 0) {
@@ -362,9 +364,9 @@
if (new_style_driver) {
if (!demand) {
/* allocate ourselves a ppp unit */
- ifunit = -1;
- if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
- fatal("Couldn't create new ppp unit: %m");
+ if (ifunit == -1)
+ if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
+ fatal("Couldn't create new ppp unit: %m");
set_kdebugflag(kdebugflag);
} else {
set_flags(ppp_dev_fd, get_flags(ppp_dev_fd) & ~SC_LOOP_TRAFFIC);
@@ -2107,9 +2109,9 @@

if (new_style_driver) {
/* allocate ourselves a ppp unit */
- ifunit = -1;
- if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
- fatal("Couldn't create PPP unit: %m");
+ if (ifunit == -1)
+ if (ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit) < 0)
+ fatal("Couldn't create PPP unit: %m");
set_flags(ppp_dev_fd, SC_LOOP_TRAFFIC);
set_kdebugflag(kdebugflag);
ppp_fd = -1;
\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.043 / U:0.428 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site