Date: Fri, 27 Oct 1995 08:26:11 -0600 From: Nate Williams <nate@rocky.sri.MT.net> To: sos@FreeBSD.org Cc: nate@rocky.sri.MT.net (Nate Williams), hackers@FreeBSD.org Subject: Re: User-mode PPP, -auto, and -direct Message-ID: <199510271426.IAA03757@rocky.sri.MT.net> In-Reply-To: <199510270815.BAA06354@freefall.freebsd.org> References: <199510270642.AAA03303@rocky.sri.MT.net> <199510270815.BAA06354@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> In reply to Nate Williams who wrote:
> >
> > [ Having PPP auto-dial the connection no matter if it's needed or not ]
> >
> > OK. The PPP code is quite readable, so I was able to get it to do what
> > I wanted in 5 lines of actual code. However, being a good programmer, I
> > also updated the documentation and changed some of the error messages to
> > reflect the new option so the diffs come out to be 5K as a context diff.
> > If anyone is interested in the code I can send it to them. I'm passing
> > it by Atsushi first before I commit it, but it's *really* short so let
> > me know if you want it.
>
> We want it ! (or at least I do :)
I've got enough requests for it that I'm posting it to the list. It's
short enough that it's smaller than most of Terry's posts anyway. *grin*
The new mode is called 'ddial', which stands for either 'dedicated dial'
or 'demon dial', whichever you prefer.
Instead of using
$ ppp -auto remotesite
you now do
$ ppp -ddial remotesite
Nate
-----
Index: command.c
===================================================================
RCS file: /home/CVS/src/usr.sbin/ppp/command.c,v
retrieving revision 1.5.4.2
diff -c -r1.5.4.2 command.c
*** command.c 1995/10/06 11:24:32 1.5.4.2
--- command.c 1995/10/27 06:26:51
***************
*** 95,101 ****
{
char *mes = NULL;
! if (mode & MODE_AUTO)
mes = "Working in auto mode.";
else if (mode & MODE_DIRECT)
mes = "Working in direct mode.";
--- 95,103 ----
{
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.1
diff -c -r1.2.4.1 defs.h
*** defs.h 1995/10/06 11:24:33 1.2.4.1
--- defs.h 1995/10/27 05:46:27
***************
*** 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: main.c
===================================================================
RCS file: /home/CVS/src/usr.sbin/ppp/main.c,v
retrieving revision 1.5.4.2
diff -c -r1.5.4.2 main.c
*** main.c 1995/10/06 11:24:42 1.5.4.2
--- main.c 1995/10/27 06:29:32
***************
*** 198,204 ****
void
Usage()
{
! fprintf(stderr, "Usage: ppp [-auto | -direct | -dedicated] [system]\n");
exit(EX_START);
}
--- 198,205 ----
void
Usage()
{
! fprintf(stderr,
! "Usage: ppp [-auto | -direct | -dedicated | -ddial ] [system]\n");
exit(EX_START);
}
***************
*** 217,222 ****
--- 218,225 ----
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++;
***************
*** 289,297 ****
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);
}
}
--- 292,301 ----
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);
}
}
***************
*** 330,336 ****
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);
}
}
--- 334,340 ----
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);
}
}
***************
*** 614,619 ****
--- 618,630 ----
if ( modem )
IpStartOutput();
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 & 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.2
diff -c -r1.8.4.2 ppp.8
*** ppp.8 1995/10/06 11:24:45 1.8.4.2
--- ppp.8 1995/10/27 06:11:28
***************
*** 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?199510271426.IAA03757>
