system/5368: ppp: "set reconnect random 0" doesn't work

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

system/5368: ppp: "set reconnect random 0" doesn't work

Martin Schröder
>Number:         5368
>Category:       system
>Synopsis:       ppp: "set reconnect random 0" doesn't work
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:      
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 11 03:00:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Martin Schrvder
>Release:        4.0 stable
>Organization:
net
>Environment:
       
        System      : OpenBSD 4.0
        Architecture: OpenBSD.i386
        Machine     : i386
>Description:
I'm trying to set the reconnect time of ppp to random. This should be
possible according to ppp(8):
----------------
         set reconnect timeout ntries
             Should the line drop unexpectedly (due to loss of CD or LQR fail-
             ure), a connection will be re-established after the given
             timeout.  The line will be re-connected at most ntries times.
             Ntries defaults to zero.  A value of random for timeout will re-
             sult in a variable pause, somewhere between 1 and 30 seconds.
----------------

But in my tries "random" sets the time to 0; numerical values work. I've
tried to understand the code and think that datalink_SetReconnect in
usr.sbin/ppp/ppp/datalink.c doesn't handle "random" at all, it just feeds
the string to atoi, which probably returns 0 as default:
----------------
datalink_SetReconnect(struct cmdargs const *arg)
{
  if (arg->argc == arg->argn+2) {
    arg->cx->cfg.reconnect.timeout = atoi(arg->argv[arg->argn]);
    arg->cx->cfg.reconnect.max = atoi(arg->argv[arg->argn+1]);
    return 0;
  }
  return -1;
}
----------------
>How-To-Repeat:
sudo pppctl /var/run/internet set reconnect random 0
sudo pppctl /var/run/internet close\; open
>Fix:
       

>Release-Note:
>Audit-Trail:
>Unformatted:

Reply | Threaded
Open this post in threaded view
|

Re: system/5368: ppp: "set reconnect random 0" doesn't work

Martin Schröder
Here is a patch:
-----------------------------------
> cvs diff -du datalink.c
Index: datalink.c
===================================================================
RCS file: /home/ms/obsd/cvsroot/src/usr.sbin/ppp/ppp/datalink.c,v
retrieving revision 1.47
diff -d -u -r1.47 datalink.c
--- datalink.c  18 Jul 2005 22:51:03 -0000      1.47
+++ datalink.c  14 Feb 2007 00:15:54 -0000
@@ -1158,7 +1158,13 @@
 datalink_SetReconnect(struct cmdargs const *arg)
 {
   if (arg->argc == arg->argn+2) {
-    arg->cx->cfg.reconnect.timeout = atoi(arg->argv[arg->argn]);
+    if (strncasecmp(arg->argv[arg->argn], "random", 6) == 0 &&
+       (arg->argv[arg->argn][6] == '\0')) {
+      arg->cx->cfg.reconnect.timeout = -1;
+      randinit();
+    } else {
+      arg->cx->cfg.reconnect.timeout = atoi(arg->argv[arg->argn]);
+    }
     arg->cx->cfg.reconnect.max = atoi(arg->argv[arg->argn+1]);
     return 0;
   }
-----------------------------------
Any chance that this will be in 4.1?

Best
   Martin

Reply | Threaded
Open this post in threaded view
|

Re: system/5368: ppp: "set reconnect random 0" doesn't work

Martin Schröder
In reply to this post by Martin Schröder
The following reply was made to PR system/5368; it has been noted by GNATS.

From: "=?ISO-8859-1?Q?Martin_Schr=F6der?=" <[hidden email]>
To: [hidden email], [hidden email]
Cc:  
Subject: Re: system/5368: ppp: "set reconnect random 0" doesn't work
Date: Wed, 14 Feb 2007 01:29:22 +0100

 Here is a patch:
 -----------------------------------
 > cvs diff -du datalink.c
 Index: datalink.c
 ===================================================================
 RCS file: /home/ms/obsd/cvsroot/src/usr.sbin/ppp/ppp/datalink.c,v
 retrieving revision 1.47
 diff -d -u -r1.47 datalink.c
 --- datalink.c  18 Jul 2005 22:51:03 -0000      1.47
 +++ datalink.c  14 Feb 2007 00:15:54 -0000
 @@ -1158,7 +1158,13 @@
  datalink_SetReconnect(struct cmdargs const *arg)
  {
    if (arg->argc == arg->argn+2) {
 -    arg->cx->cfg.reconnect.timeout = atoi(arg->argv[arg->argn]);
 +    if (strncasecmp(arg->argv[arg->argn], "random", 6) == 0 &&
 +       (arg->argv[arg->argn][6] == '\0')) {
 +      arg->cx->cfg.reconnect.timeout = -1;
 +      randinit();
 +    } else {
 +      arg->cx->cfg.reconnect.timeout = atoi(arg->argv[arg->argn]);
 +    }
      arg->cx->cfg.reconnect.max = atoi(arg->argv[arg->argn+1]);
      return 0;
    }
 -----------------------------------
 Any chance that this will be in 4.1?
 
 Best
    Martin

Reply | Threaded
Open this post in threaded view
|

Re: system/5368: ppp: "set reconnect random 0" doesn't work

Martin Schröder
In reply to this post by Martin Schröder
2007/2/14, Martin Schrvder <[hidden email]>:
> Here is a patch:
[...]
> Any chance that this will be in 4.1?

Any chance that this will be in at all, i.e. is anybody actually reading
this?

Best
   Martin

Reply | Threaded
Open this post in threaded view
|

Re: system/5368: ppp: "set reconnect random 0" doesn't work

Martin Schröder
In reply to this post by Martin Schröder
The following reply was made to PR system/5368; it has been noted by GNATS.

From: "=?ISO-8859-1?Q?Martin_Schr=F6der?=" <[hidden email]>
To: [hidden email], [hidden email]
Cc:  
Subject: Re: system/5368: ppp: "set reconnect random 0" doesn't work
Date: Sun, 25 Feb 2007 23:39:28 +0100

 2007/2/14, Martin Schrvder <[hidden email]>:
 > Here is a patch:
 [...]
 > Any chance that this will be in 4.1?
 
 Any chance that this will be in at all, i.e. is anybody actually reading this?
 
 Best
    Martin