Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 1996 08:32:24 -0700
From:      Nate Williams <nate@sri.MT.net>
To:        "Jay L. West" <jlwest@tseinc.com>
Cc:        nate@sri.MT.net, freebsd-questions@freebsd.org
Subject:   Auto-dial iijppp (was Re: Several misc. questions on user mode PPP)
Message-ID:  <199602131532.IAA22359@rocky.sri.MT.net>
In-Reply-To: <199602130741.HAA06766@bsd.tseinc.com>
References:  <199602130741.HAA06766@bsd.tseinc.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> >> I think he was just looking for a somewhat more elegant way to
> >> starting the interface, as opposed to editing /etc/netstart, which is
> >> now supposed to be sacrosanct.  Try the following:
> >
> >Hmm, that's not the impression I got.  He was using -auto already, but
> >needed to pint the remote host to get things started.
> 
> I was wanting to have the system bring up the link (ie. dial) upon bootup
> without haveing to do the ping command to 'fudge' an outgoing packet. But I
> do think the start_if.interface script is rather elegant, and will do it
> that way. (Albeit, that doesn't solve the original question).

OK, here are my 'ddial' patches updated to the most recent version of
ppp in -stable.  If you use 'ppp -ddial host', it will do it's darndest
to keep the link up *all* the time, no matter if there is traffic
needing to be sent.


Nate
---------
Index: command.c
===================================================================
RCS file: /home/CVS/src/usr.sbin/ppp/command.c,v
retrieving revision 1.5.4.3
diff -c -r1.5.4.3 command.c
*** command.c	1996/02/05 17:02:52	1.5.4.3
--- command.c	1996/02/13 15:26:28
***************
*** 99,105 ****
  {
    char *mes = NULL;
  
!   if (mode & MODE_AUTO)
      mes = "Working in auto mode.";
    else if (mode & MODE_DIRECT)
      mes = "Working in direct mode.";
--- 99,107 ----
  {
    char *mes = NULL;
  
!   if (mode & MODE_DDIAL)
!     mes = "Working in dedicated dial mode.";
!   else if (mode & MODE_AUTO)
      mes = "Working in auto mode.";
    else if (mode & MODE_DIRECT)
      mes = "Working in direct mode.";
Index: defs.h
===================================================================
RCS file: /home/CVS/src/usr.sbin/ppp/defs.h,v
retrieving revision 1.2.4.2
diff -c -r1.2.4.2 defs.h
*** defs.h	1996/02/05 17:02:54	1.2.4.2
--- defs.h	1996/02/13 15:26:29
***************
*** 59,64 ****
--- 59,65 ----
  #define MODE_AUTO	2	/* Auto calling mode */
  #define	MODE_DIRECT	4	/* Direct connection mode */
  #define	MODE_DEDICATED	8	/* Dedicated line mode */
+ #define	MODE_DDIAL	16	/* Dedicated dialing line mode */
  
  #define	EX_NORMAL	0
  #define	EX_START	1
Index: ip.c
===================================================================
RCS file: /home/CVS/src/usr.sbin/ppp/ip.c,v
retrieving revision 1.4.4.2
diff -c -r1.4.4.2 ip.c
*** ip.c	1996/02/05 17:03:02	1.4.4.2
--- ip.c	1996/02/13 15:26:33
***************
*** 53,59 ****
  void
  StartIdleTimer()
  {
!   if (!(mode & MODE_DEDICATED)) {
      StopTimer(&IdleTimer);
      IdleTimer.func = IdleTimeout;
      IdleTimer.load = VarIdleTimeout * SECTICKS;
--- 53,59 ----
  void
  StartIdleTimer()
  {
!   if (!(mode & MODE_DEDICATED|MODE_DDIAL)) {
      StopTimer(&IdleTimer);
      IdleTimer.func = IdleTimeout;
      IdleTimer.load = VarIdleTimeout * SECTICKS;
***************
*** 74,80 ****
  static void
  RestartIdleTimer()
  {
!   if (!(mode & MODE_DEDICATED) && ipKeepAlive ) {
      StartTimer(&IdleTimer);
      ipIdleSecs = 0;
    }
--- 74,80 ----
  static void
  RestartIdleTimer()
  {
!   if (!(mode & MODE_DEDICATED|MODE_DDIAL) && ipKeepAlive ) {
      StartTimer(&IdleTimer);
      ipIdleSecs = 0;
    }
Index: main.c
===================================================================
RCS file: /home/CVS/src/usr.sbin/ppp/main.c,v
retrieving revision 1.5.4.3
diff -c -r1.5.4.3 main.c
*** main.c	1996/02/05 17:03:09	1.5.4.3
--- main.c	1996/02/13 15:26:39
***************
*** 204,210 ****
  void
  Usage()
  {
!   fprintf(stderr, "Usage: ppp [-auto | -direct | -dedicated] [system]\n");
    exit(EX_START);
  }
  
--- 204,211 ----
  void
  Usage()
  {
!   fprintf(stderr,
!           "Usage: ppp [-auto | -direct | -dedicated | -ddial ] [system]\n");
    exit(EX_START);
  }
  
***************
*** 223,228 ****
--- 224,231 ----
        mode |= MODE_DIRECT;
      else if (strcmp(cp, "dedicated") == 0)
        mode |= MODE_DEDICATED;
+     else if (strcmp(cp, "ddial") == 0)
+       mode |= MODE_DDIAL|MODE_AUTO;
      else
        Usage();
      optc++;
***************
*** 294,302 ****
      printf("Interactive mode\n");
      netfd = 0;
    } else if (mode & MODE_AUTO) {
!     printf("Automatic mode\n");
      if (dstsystem == NULL) {
!       fprintf(stderr, "Destination system must be specified in auto mode.\n");
        exit(EX_START);
      }
    }
--- 297,306 ----
      printf("Interactive mode\n");
      netfd = 0;
    } else if (mode & MODE_AUTO) {
!     printf("Automatic Dialer mode\n");
      if (dstsystem == NULL) {
!       fprintf(stderr,
!               "Destination system must be specified in auto or ddial mode.\n");
        exit(EX_START);
      }
    }
***************
*** 335,341 ****
        Cleanup(EX_START);
      }
      if ((mode & MODE_AUTO) && DefHisAddress.ipaddr.s_addr == INADDR_ANY) {
!       fprintf(stderr, "Must specify dstaddr with auto mode.\n");
        Cleanup(EX_START);
      }
    }
--- 339,345 ----
        Cleanup(EX_START);
      }
      if ((mode & MODE_AUTO) && DefHisAddress.ipaddr.s_addr == INADDR_ANY) {
!       fprintf(stderr, "Must specify dstaddr with auto or ddial mode.\n");
        Cleanup(EX_START);
      }
    }
***************
*** 639,644 ****
--- 643,655 ----
    tries = 0;
    for (;;) {
      FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&efds);
+ 
+     /* 
+      * If the link is down and we're in DDIAL mode, bring it back
+      * up.
+      */
+     if (mode & MODE_DDIAL && LcpFsm.state <= ST_CLOSED)
+         dial_up = TRUE;
  
     /*
      * If Ip packet for output is enqueued and require dial up,
Index: ppp.8
===================================================================
RCS file: /home/CVS/src/usr.sbin/ppp/ppp.8,v
retrieving revision 1.8.4.3
diff -c -r1.8.4.3 ppp.8
*** ppp.8	1996/02/05 17:03:17	1.8.4.3
--- ppp.8	1996/02/13 15:26:44
***************
*** 9,15 ****
  Point to Point Protocol (aka iijppp)
  .Sh SYNOPSIS
  .Nm
! .Op Fl auto \*(Ba Fl direct Fl dedicated
  .Sh DESCRIPTION
  This is a user process
  .Em PPP
--- 9,15 ----
  Point to Point Protocol (aka iijppp)
  .Sh SYNOPSIS
  .Nm
! .Op Fl auto \*(Ba Fl direct \*(Ba Fl dedicated \*(Ba Fl ddial
  .Sh DESCRIPTION
  This is a user process
  .Em PPP
***************
*** 52,57 ****
--- 52,64 ----
  link.  When this happens, the daemon automatically dials and establishes the
  connection.
  
+ In almost the same manner ddial mode (dedicated dialing or demon dialing)
+ also automatically dials and establishes the connection.  However, it
+ differs in that it will dial the remote site any time it detects the
+ link is down, even if there are no packets to be sent.  This mode is
+ useful for full-time connections who worry less about line charges
+ and more about being connected full time.
+ 
  .It Supports server-side PPP connections.
  Can act as server which accepts incoming
  .Em PPP
***************
*** 274,279 ****
--- 281,288 ----
  
  To play with demand dialing, you must use the
  .Fl auto
+ or
+ .Fl ddial
  option.  You must also specify the destination label in
  .Pa /etc/ppp/ppp.conf
  to use.  It should contain the
***************
*** 287,292 ****
--- 296,303 ----
  
  When
  .Fl auto
+ or
+ .Fl ddial
  is specified,
  .Nm
  runs as a daemon but you can still configure or examine its



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602131532.IAA22359>