mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
For /usr/sbin/ppp, you must choose between running ppp in the background or
connecting to a host immediately in the foreground. I would like to be able to run ppp from a script so that my script can be sure that it is connected to the 'net before it continues running: # Dial up the internet. ppp -background myprovider || exit 1 do-some-net-command # Hang up the modem. kill -HUP `cat /var/run/ppp.tun0.pid` Another problem is that the current ppp calls its process id file `/var/run/PPP.server', which may conflict if you have more than one IP tunnel interface available. Closes PR#1469 Submitted by: Gord Matzigkeit <gord@enci.ucalgary.ca>
This commit is contained in:
parent
17e762ca3d
commit
6d14e2a8e6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20813
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: command.c,v 1.25 1996/12/03 21:38:39 nate Exp $
|
||||
* $Id: command.c,v 1.26 1996/12/22 17:09:12 jkh Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@ -164,7 +164,7 @@ char **argv;
|
||||
{
|
||||
const char *shell;
|
||||
pid_t shpid;
|
||||
|
||||
|
||||
if((shell = getenv("SHELL")) == 0) {
|
||||
shell = _PATH_BSHELL;
|
||||
}
|
||||
@ -222,7 +222,7 @@ char **argv;
|
||||
}
|
||||
else
|
||||
execl(shell, shell, NULL);
|
||||
|
||||
|
||||
fprintf(stdout, "exec() of %s failed\n", argc > 0? argv[0]: shell);
|
||||
exit(255);
|
||||
}
|
||||
@ -232,9 +232,9 @@ char **argv;
|
||||
int status;
|
||||
(void)waitpid(shpid, &status, 0);
|
||||
}
|
||||
|
||||
|
||||
TtyCommandMode(1);
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -822,7 +822,7 @@ char **argv;
|
||||
if (--argc > 0) {
|
||||
ParseAddr(argc, argv++,
|
||||
&DefTriggerAddress.ipaddr,
|
||||
&DefTriggerAddress.mask,
|
||||
&DefTriggerAddress.mask,
|
||||
&DefTriggerAddress.width);
|
||||
}
|
||||
}
|
||||
@ -981,7 +981,6 @@ char **argv;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static char StrChatStr[] = "chat-script";
|
||||
static char StrValue[] = "value";
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: defs.h,v 1.6 1996/12/12 14:39:39 jkh Exp $
|
||||
* $Id: defs.h,v 1.7 1996/12/22 17:09:13 jkh Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -62,6 +62,8 @@
|
||||
#define MODE_DEDICATED 8 /* Dedicated line mode */
|
||||
#define MODE_DDIAL 16 /* Dedicated dialing line mode */
|
||||
#define MODE_ALIAS 32 /* Packet aliasing (masquerading) */
|
||||
#define MODE_BACKGROUND 64 /* Background mode. */
|
||||
|
||||
|
||||
#define EX_NORMAL 0
|
||||
#define EX_START 1
|
||||
@ -74,8 +76,11 @@
|
||||
#define EX_ERRDEAD 8
|
||||
#define EX_HANGUP 10
|
||||
#define EX_TERM 11
|
||||
#define EX_NODIAL 12
|
||||
#define EX_NOLOGIN 13
|
||||
|
||||
int mode;
|
||||
int BGFiledes[2];
|
||||
|
||||
int modem;
|
||||
int tun_in, tun_out;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: main.c,v 1.24 1996/12/12 14:39:45 jkh Exp $
|
||||
* $Id: main.c,v 1.25 1996/12/19 00:41:42 nate Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Add commands for traffic summary, version display, etc.
|
||||
@ -74,6 +74,7 @@ static struct termios oldtio; /* Original tty mode */
|
||||
static struct termios comtio; /* Command level tty mode */
|
||||
int TermMode;
|
||||
static int server;
|
||||
static pid_t BGPid = 0;
|
||||
struct sockaddr_in ifsin;
|
||||
char pid_filename[128];
|
||||
|
||||
@ -159,6 +160,8 @@ int excode;
|
||||
sleep(1);
|
||||
if (mode & MODE_AUTO) {
|
||||
DeleteIfRoutes(1);
|
||||
}
|
||||
if (mode & (MODE_AUTO | MODE_BACKGROUND)) {
|
||||
unlink(pid_filename);
|
||||
}
|
||||
OsInterfaceDown(1);
|
||||
@ -180,20 +183,31 @@ int signo;
|
||||
LogClose();
|
||||
abort();
|
||||
}
|
||||
LogPrintf(LOG_PHASE_BIT, "Signal %d, hangup.\n", signo);
|
||||
Cleanup(EX_HANGUP);
|
||||
if (BGPid) {
|
||||
kill (BGPid, SIGHUP);
|
||||
exit (EX_HANGUP);
|
||||
}
|
||||
else {
|
||||
LogPrintf(LOG_PHASE_BIT, "Signal %d, hangup.\n", signo);
|
||||
Cleanup(EX_HANGUP);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
CloseSession(signo)
|
||||
int signo;
|
||||
{
|
||||
LogPrintf(LOG_PHASE_BIT, "Signal %d, terminate.\n", signo);
|
||||
LcpClose();
|
||||
Cleanup(EX_TERM);
|
||||
if (BGPid) {
|
||||
kill (BGPid, SIGINT);
|
||||
exit (EX_TERM);
|
||||
}
|
||||
else {
|
||||
LogPrintf(LOG_PHASE_BIT, "Signal %d, terminate.\n", signo);
|
||||
LcpClose();
|
||||
Cleanup(EX_TERM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
TerminalCont()
|
||||
{
|
||||
@ -217,7 +231,7 @@ void
|
||||
Usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: ppp [-auto | -direct | -dedicated | -ddial ] [ -alias ] [system]\n");
|
||||
"Usage: ppp [-auto | -background | -direct | -dedicated | -ddial ] [ -alias ] [system]\n");
|
||||
exit(EX_START);
|
||||
}
|
||||
|
||||
@ -232,6 +246,8 @@ ProcessArgs(int argc, char **argv)
|
||||
cp = *argv + 1;
|
||||
if (strcmp(cp, "auto") == 0)
|
||||
mode |= MODE_AUTO;
|
||||
else if (strcmp(cp, "background") == 0)
|
||||
mode |= MODE_BACKGROUND;
|
||||
else if (strcmp(cp, "direct") == 0)
|
||||
mode |= MODE_DIRECT;
|
||||
else if (strcmp(cp, "dedicated") == 0)
|
||||
@ -308,7 +324,7 @@ char **argv;
|
||||
exit(EX_START);
|
||||
}
|
||||
|
||||
if (mode & (MODE_AUTO|MODE_DIRECT|MODE_DEDICATED))
|
||||
if (mode & (MODE_AUTO|MODE_DIRECT|MODE_DEDICATED|MODE_BACKGROUND))
|
||||
mode &= ~MODE_INTER;
|
||||
if (mode & MODE_INTER) {
|
||||
printf("Interactive mode\n");
|
||||
@ -320,6 +336,12 @@ char **argv;
|
||||
"Destination system must be specified in auto or ddial mode.\n");
|
||||
exit(EX_START);
|
||||
}
|
||||
} else if (mode & MODE_BACKGROUND) {
|
||||
printf("Background mode\n");
|
||||
if (dstsystem == NULL) {
|
||||
fprintf(stderr, "Destination system must be specified in background mode.\n");
|
||||
exit(EX_START);
|
||||
}
|
||||
}
|
||||
|
||||
tcgetattr(0, &oldtio); /* Save original tty mode */
|
||||
@ -370,36 +392,61 @@ char **argv;
|
||||
#endif
|
||||
|
||||
if (!(mode & MODE_INTER)) {
|
||||
int port = SERVER_PORT + tunno;
|
||||
/*
|
||||
* Create server socket and listen at there.
|
||||
*/
|
||||
server = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (server < 0) {
|
||||
perror("socket");
|
||||
Cleanup(EX_SOCK);
|
||||
int port = SERVER_PORT + tunno;
|
||||
if (mode & MODE_BACKGROUND) {
|
||||
if (pipe (BGFiledes)) {
|
||||
perror("pipe");
|
||||
Cleanup(EX_SOCK);
|
||||
}
|
||||
server = -1;
|
||||
}
|
||||
ifsin.sin_family = AF_INET;
|
||||
ifsin.sin_addr.s_addr = INADDR_ANY;
|
||||
ifsin.sin_port = htons(port);
|
||||
if (bind(server, (struct sockaddr *) &ifsin, sizeof(ifsin)) < 0) {
|
||||
perror("bind");
|
||||
if (errno == EADDRINUSE)
|
||||
fprintf(stderr, "Wait for a while, then try again.\n");
|
||||
Cleanup(EX_SOCK);
|
||||
else {
|
||||
/*
|
||||
* Create server socket and listen at there.
|
||||
*/
|
||||
server = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (server < 0) {
|
||||
perror("socket");
|
||||
Cleanup(EX_SOCK);
|
||||
}
|
||||
ifsin.sin_family = AF_INET;
|
||||
ifsin.sin_addr.s_addr = INADDR_ANY;
|
||||
ifsin.sin_port = htons(port);
|
||||
if (bind(server, (struct sockaddr *) &ifsin, sizeof(ifsin)) < 0) {
|
||||
perror("bind");
|
||||
if (errno == EADDRINUSE)
|
||||
fprintf(stderr, "Wait for a while, then try again.\n");
|
||||
Cleanup(EX_SOCK);
|
||||
}
|
||||
listen(server, 5);
|
||||
}
|
||||
listen(server, 5);
|
||||
|
||||
DupLog();
|
||||
if (!(mode & MODE_DIRECT)) {
|
||||
int fd;
|
||||
char pid[32];
|
||||
pid_t bgpid;
|
||||
|
||||
if (fork())
|
||||
exit(0);
|
||||
bgpid = fork ();
|
||||
if (bgpid == -1) {
|
||||
perror ("fork");
|
||||
Cleanup (EX_SOCK);
|
||||
}
|
||||
if (bgpid) {
|
||||
char c = EX_NORMAL;
|
||||
|
||||
snprintf(pid_filename, sizeof (pid_filename), "%s/PPP.%s",
|
||||
_PATH_VARRUN, dstsystem);
|
||||
if (mode & MODE_BACKGROUND) {
|
||||
/* Wait for our child to close its pipe before we exit. */
|
||||
BGPid = bgpid;
|
||||
read (BGFiledes[0], &c, 1);
|
||||
if (c == EX_NORMAL)
|
||||
LogPrintf (LOG_CHAT, "PPP enabled.\n");
|
||||
}
|
||||
exit(c);
|
||||
}
|
||||
|
||||
snprintf(pid_filename, sizeof (pid_filename), "%s/ppp.tun%d.pid",
|
||||
_PATH_VARRUN, tunno);
|
||||
unlink(pid_filename);
|
||||
sprintf(pid, "%d\n", (int)getpid());
|
||||
|
||||
@ -409,7 +456,8 @@ char **argv;
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
LogPrintf(LOG_PHASE_BIT, "Listening at %d.\n", port);
|
||||
if (server > 0)
|
||||
LogPrintf(LOG_PHASE_BIT, "Listening at %d.\n", port);
|
||||
#ifdef DOTTYINIT
|
||||
if (mode & (MODE_DIRECT|MODE_DEDICATED)) { /* } */
|
||||
#else
|
||||
@ -444,7 +492,7 @@ char **argv;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn into packet mode, where we speek PPP.
|
||||
* Turn into packet mode, where we speak PPP.
|
||||
*/
|
||||
void
|
||||
PacketMode()
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: modem.c,v 1.24 1996/05/11 20:48:36 phk Exp $
|
||||
* $Id: modem.c,v 1.25 1996/12/22 17:09:14 jkh Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -724,6 +724,7 @@ int
|
||||
DialModem()
|
||||
{
|
||||
char ScriptBuffer[200];
|
||||
int excode = 0;
|
||||
|
||||
strcpy(ScriptBuffer, VarDialScript);
|
||||
if (DoChat(ScriptBuffer) > 0) {
|
||||
@ -735,16 +736,25 @@ DialModem()
|
||||
fprintf(stderr, "login OK!\n");
|
||||
return(1);
|
||||
} else {
|
||||
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
|
||||
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER) {
|
||||
fprintf(stderr, "login failed.\n");
|
||||
excode = EX_NOLOGIN;
|
||||
}
|
||||
}
|
||||
ModemTimeout(); /* Dummy call to check modem status */
|
||||
}
|
||||
else {
|
||||
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER)
|
||||
if ((mode & (MODE_INTER|MODE_AUTO)) == MODE_INTER) {
|
||||
fprintf(stderr, "dial failed.\n");
|
||||
excode = EX_NODIAL;
|
||||
}
|
||||
}
|
||||
HangupModem(0);
|
||||
if (mode & MODE_BACKGROUND) {
|
||||
extern void Cleanup();
|
||||
CloseModem();
|
||||
Cleanup(excode);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: phase.h,v 1.1.1.1 1995/01/31 06:29:55 amurai Exp $
|
||||
* $Id: phase.h,v 1.2 1995/02/26 12:17:53 amurai Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -26,9 +26,10 @@
|
||||
|
||||
#define PHASE_DEAD 0 /* Link is dead */
|
||||
#define PHASE_ESTABLISH 1 /* Establishing link */
|
||||
#define PHASE_AUTHENTICATE 2 /* Beeing authenticate */
|
||||
#define PHASE_AUTHENTICATE 2 /* Being authenticated */
|
||||
#define PHASE_NETWORK 3
|
||||
#define PHASE_TERMINATE 4 /* Terminating link */
|
||||
#define PHASE_OSLINKED 5 /* The OS is linked up */
|
||||
|
||||
int phase; /* Curent phase */
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" manual page [] for ppp 0.94 beta2 + alpha
|
||||
.\" $Id: ppp.8,v 1.21 1996/12/12 14:39:47 jkh Exp $
|
||||
.\" $Id: ppp.8,v 1.22 1996/12/22 17:09:15 jkh Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -9,7 +9,7 @@
|
||||
Point to Point Protocol (aka iijppp)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl auto | ddial | direct | dedicated
|
||||
.Op Fl auto | background | ddial | direct | dedicated
|
||||
.Op Fl alias
|
||||
.Op Ar system
|
||||
.Sh DESCRIPTION
|
||||
@ -33,7 +33,7 @@ easily enter commands to establish the connection with the remote end, check
|
||||
the status of connection and close the connection. All functions can
|
||||
also be optionally password protected for security.
|
||||
|
||||
.It Supports both manual and automatic dialing.
|
||||
.It Supports both manual and automatic dialing.
|
||||
Interactive mode has a
|
||||
.Dq term
|
||||
command which enables you to talk to your modem directly. When your
|
||||
@ -69,11 +69,17 @@ host acts as a masquerading gateway. IP addresses as well as TCP and
|
||||
UDP port numbers are aliased for outgoing packets and de-aliased for
|
||||
returning packets.
|
||||
|
||||
.It Supports background PPP connections.
|
||||
In background mode, if
|
||||
.Nm
|
||||
successfully establishes the connection, it will become a daemon.
|
||||
Otherwise, it will exit with an error.
|
||||
|
||||
.It Supports server-side PPP connections.
|
||||
Can act as server which accepts incoming
|
||||
.Em PPP
|
||||
connections.
|
||||
|
||||
connections.
|
||||
|
||||
.It Supports PAP and CHAP authentication.
|
||||
|
||||
.It Supports Proxy Arp.
|
||||
@ -85,7 +91,7 @@ connection.
|
||||
.It Supports packet filtering.
|
||||
User can define four kinds of filters:
|
||||
.Em ifilter
|
||||
for incoming packets,
|
||||
for incoming packets,
|
||||
.Em ofilter
|
||||
for outgoing packets,
|
||||
.Em dfilter
|
||||
@ -100,14 +106,14 @@ to check the packet flow over the
|
||||
.Em PPP
|
||||
link.
|
||||
|
||||
.It Supports PPP over TCP capability.
|
||||
.It Supports PPP over TCP capability.
|
||||
|
||||
|
||||
.It Supports IETF draft Predictor-1 compression.
|
||||
.It Supports IETF draft Predictor-1 compression.
|
||||
.Nm
|
||||
supports not only VJ-compression but also Predictor-1 compression.
|
||||
Normally, a modem has built-in compression (e.g. v42.bis) and the system
|
||||
may receive higher data rates from it as a result of such compression.
|
||||
may receive higher data rates from it as a result of such compression.
|
||||
While this is generally a good thing in most other situations, this
|
||||
higher speed data imposes a penalty on the system by increasing the
|
||||
number of serial interrupts the system has to process in talking to the
|
||||
@ -140,7 +146,7 @@ following line in your kernel configuration file:
|
||||
|
||||
.Dl pseudo-device tun 1
|
||||
|
||||
You should set the numeric field to the maximum number of
|
||||
You should set the numeric field to the maximum number of
|
||||
.Em PPP
|
||||
connections you wish to support.
|
||||
|
||||
@ -152,7 +158,7 @@ If it doesn't exist, you can create it by running "MAKEDEV tun0"
|
||||
|
||||
.Sh MANUAL DIALING
|
||||
|
||||
%
|
||||
%
|
||||
.Nm
|
||||
User Process PPP written by Toshiharu OHNO.
|
||||
|
||||
@ -163,7 +169,7 @@ anything except run the quit and help commands *
|
||||
|
||||
ppp on "your hostname"> help
|
||||
passwd : Password for security
|
||||
quit : Quit the PPP program
|
||||
quit : Quit the PPP program
|
||||
help : Display this message
|
||||
|
||||
ppp on tama> pass <password>
|
||||
@ -304,6 +310,39 @@ connection is established. See the provided example which adds a
|
||||
default route. The string HISADDR represents the IP address of the
|
||||
remote peer.
|
||||
|
||||
.Sh BACKGROUND DIALING
|
||||
|
||||
If you want to establish a connection using
|
||||
.Nm ppp non-interactively (such as from a
|
||||
.Xr crontab(5)
|
||||
entry or an
|
||||
.Xr at(1)
|
||||
script) you should use the
|
||||
.Fl background
|
||||
option. You must also specify the destination label in
|
||||
.Pa /etc/ppp/ppp.conf
|
||||
to use.
|
||||
|
||||
When
|
||||
.Fl background
|
||||
is specified,
|
||||
.Nm
|
||||
attempts to establish the connection. If this attempt fails,
|
||||
.Nm ppp
|
||||
exits immediately with a non-zero exit code.
|
||||
|
||||
If it succeeds, then
|
||||
.Nm ppp
|
||||
becomes a daemon, and returns an exit status of zero to its caller.
|
||||
The daemon exits automatically if the connection is dropped by the
|
||||
remote system, or it receives a HUP or TERM signal.
|
||||
|
||||
The file
|
||||
.Pa /var/run/ppp.tun0.pid
|
||||
contains the process id number of the
|
||||
.Nm ppp
|
||||
program that is using the tunnel device tun0.
|
||||
|
||||
.Sh DIAL ON DEMAND
|
||||
|
||||
To play with demand dialing, you must use the
|
||||
@ -336,7 +375,7 @@ configuration by using the diagnostic port as follows:
|
||||
Connected to localhost.spec.co.jp.
|
||||
Escape character is '^]'.
|
||||
User Process PPP. Written by Toshiharu OHNO.
|
||||
Working as auto mode.
|
||||
Working as auto mode.
|
||||
PPP on tama> show ipcp
|
||||
what ?
|
||||
PPP on tama> pass xxxx
|
||||
@ -447,11 +486,11 @@ set filter-name rule-no action [src_addr/src_width] [dst_addr/dst_width]
|
||||
.Sq filter-name
|
||||
should be one of ifilter, ofilter, or dfilter.
|
||||
.It
|
||||
There are two actions:
|
||||
There are two actions:
|
||||
.Sq permit
|
||||
and
|
||||
.Sq deny .
|
||||
If a given packet
|
||||
If a given packet
|
||||
matches the rule, the associated action is taken immediately.
|
||||
.It
|
||||
.Sq src_width
|
||||
@ -495,7 +534,7 @@ To handle an incoming
|
||||
connection request, follow these steps:
|
||||
|
||||
.Bl -enum
|
||||
.It
|
||||
.It
|
||||
Make sure the modem and (optionally)
|
||||
.Pa /etc/rc.serial
|
||||
is configured correctly.
|
||||
@ -526,7 +565,7 @@ ppp:xxxx:66:66:PPP Login User:/home/ppp:/usr/local/bin/ppplogin
|
||||
.Ed
|
||||
|
||||
.It
|
||||
Create a
|
||||
Create a
|
||||
.Pa /usr/local/bin/ppplogin
|
||||
file with the following contents:
|
||||
.Bd -literal -offset indent
|
||||
@ -612,7 +651,7 @@ commands.
|
||||
.Dl ppp ON tama> set timeout 600
|
||||
|
||||
The timeout period is measured in seconds, the default values for which
|
||||
are timeout = 180 or 3 min, lqrtimer = 30sec and retrytimer = 3sec.
|
||||
are timeout = 180 or 3 min, lqrtimer = 30sec and retrytimer = 3sec.
|
||||
To disable the idle timer function,
|
||||
use the command
|
||||
.Dq set timeout 0 .
|
||||
@ -648,7 +687,7 @@ uses IPCP to negotiate IP addresses. Each side of the connection
|
||||
specifies the IP address that it's willing to use, and if the requested
|
||||
IP address is acceptable then
|
||||
.Nm
|
||||
returns ACK to the requester. Otherwise,
|
||||
returns ACK to the requester. Otherwise,
|
||||
.Nm
|
||||
returns NAK to suggest that the peer use a different IP address. When
|
||||
both sides of the connection agree to accept the received request (and
|
||||
@ -692,7 +731,7 @@ My interface netmask will be 255.255.255.0.
|
||||
.It
|
||||
This is all fine when each side has a pre-determined IP address, however
|
||||
it is often the case that one side is acting as a server which controls
|
||||
all IP addresses and the other side should obey the direction from it.
|
||||
all IP addresses and the other side should obey the direction from it.
|
||||
.El
|
||||
|
||||
In order to allow more flexible behavior, `ifaddr' variable allows the
|
||||
@ -708,7 +747,7 @@ the IP address. The above example signifies that:
|
||||
I'd like to use 192.244.177.38 as my address if it is possible, but I'll
|
||||
also accept any IP address between 192.244.177.0 and 192.244.177.255.
|
||||
|
||||
.It
|
||||
.It
|
||||
I'd like to make him use 192.244.177.2 as his own address, but I'll also
|
||||
permit him to use any IP address between 192.244.176.0 and
|
||||
192.244.191.255.
|
||||
@ -863,6 +902,9 @@ tty port locking file.
|
||||
.Pa /var/run/PPP.system
|
||||
Holds the pid for ppp -auto system.
|
||||
|
||||
.Pa /var/run/ppp.tun0.pid
|
||||
The process id (pid) of the ppp program connected to the ppp0 device.
|
||||
|
||||
.Pa /etc/services
|
||||
Get port number if port number is using service name.
|
||||
.El
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" manual page [] for ppp 0.94 beta2 + alpha
|
||||
.\" $Id: ppp.8,v 1.21 1996/12/12 14:39:47 jkh Exp $
|
||||
.\" $Id: ppp.8,v 1.22 1996/12/22 17:09:15 jkh Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -9,7 +9,7 @@
|
||||
Point to Point Protocol (aka iijppp)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl auto | ddial | direct | dedicated
|
||||
.Op Fl auto | background | ddial | direct | dedicated
|
||||
.Op Fl alias
|
||||
.Op Ar system
|
||||
.Sh DESCRIPTION
|
||||
@ -33,7 +33,7 @@ easily enter commands to establish the connection with the remote end, check
|
||||
the status of connection and close the connection. All functions can
|
||||
also be optionally password protected for security.
|
||||
|
||||
.It Supports both manual and automatic dialing.
|
||||
.It Supports both manual and automatic dialing.
|
||||
Interactive mode has a
|
||||
.Dq term
|
||||
command which enables you to talk to your modem directly. When your
|
||||
@ -69,11 +69,17 @@ host acts as a masquerading gateway. IP addresses as well as TCP and
|
||||
UDP port numbers are aliased for outgoing packets and de-aliased for
|
||||
returning packets.
|
||||
|
||||
.It Supports background PPP connections.
|
||||
In background mode, if
|
||||
.Nm
|
||||
successfully establishes the connection, it will become a daemon.
|
||||
Otherwise, it will exit with an error.
|
||||
|
||||
.It Supports server-side PPP connections.
|
||||
Can act as server which accepts incoming
|
||||
.Em PPP
|
||||
connections.
|
||||
|
||||
connections.
|
||||
|
||||
.It Supports PAP and CHAP authentication.
|
||||
|
||||
.It Supports Proxy Arp.
|
||||
@ -85,7 +91,7 @@ connection.
|
||||
.It Supports packet filtering.
|
||||
User can define four kinds of filters:
|
||||
.Em ifilter
|
||||
for incoming packets,
|
||||
for incoming packets,
|
||||
.Em ofilter
|
||||
for outgoing packets,
|
||||
.Em dfilter
|
||||
@ -100,14 +106,14 @@ to check the packet flow over the
|
||||
.Em PPP
|
||||
link.
|
||||
|
||||
.It Supports PPP over TCP capability.
|
||||
.It Supports PPP over TCP capability.
|
||||
|
||||
|
||||
.It Supports IETF draft Predictor-1 compression.
|
||||
.It Supports IETF draft Predictor-1 compression.
|
||||
.Nm
|
||||
supports not only VJ-compression but also Predictor-1 compression.
|
||||
Normally, a modem has built-in compression (e.g. v42.bis) and the system
|
||||
may receive higher data rates from it as a result of such compression.
|
||||
may receive higher data rates from it as a result of such compression.
|
||||
While this is generally a good thing in most other situations, this
|
||||
higher speed data imposes a penalty on the system by increasing the
|
||||
number of serial interrupts the system has to process in talking to the
|
||||
@ -140,7 +146,7 @@ following line in your kernel configuration file:
|
||||
|
||||
.Dl pseudo-device tun 1
|
||||
|
||||
You should set the numeric field to the maximum number of
|
||||
You should set the numeric field to the maximum number of
|
||||
.Em PPP
|
||||
connections you wish to support.
|
||||
|
||||
@ -152,7 +158,7 @@ If it doesn't exist, you can create it by running "MAKEDEV tun0"
|
||||
|
||||
.Sh MANUAL DIALING
|
||||
|
||||
%
|
||||
%
|
||||
.Nm
|
||||
User Process PPP written by Toshiharu OHNO.
|
||||
|
||||
@ -163,7 +169,7 @@ anything except run the quit and help commands *
|
||||
|
||||
ppp on "your hostname"> help
|
||||
passwd : Password for security
|
||||
quit : Quit the PPP program
|
||||
quit : Quit the PPP program
|
||||
help : Display this message
|
||||
|
||||
ppp on tama> pass <password>
|
||||
@ -304,6 +310,39 @@ connection is established. See the provided example which adds a
|
||||
default route. The string HISADDR represents the IP address of the
|
||||
remote peer.
|
||||
|
||||
.Sh BACKGROUND DIALING
|
||||
|
||||
If you want to establish a connection using
|
||||
.Nm ppp non-interactively (such as from a
|
||||
.Xr crontab(5)
|
||||
entry or an
|
||||
.Xr at(1)
|
||||
script) you should use the
|
||||
.Fl background
|
||||
option. You must also specify the destination label in
|
||||
.Pa /etc/ppp/ppp.conf
|
||||
to use.
|
||||
|
||||
When
|
||||
.Fl background
|
||||
is specified,
|
||||
.Nm
|
||||
attempts to establish the connection. If this attempt fails,
|
||||
.Nm ppp
|
||||
exits immediately with a non-zero exit code.
|
||||
|
||||
If it succeeds, then
|
||||
.Nm ppp
|
||||
becomes a daemon, and returns an exit status of zero to its caller.
|
||||
The daemon exits automatically if the connection is dropped by the
|
||||
remote system, or it receives a HUP or TERM signal.
|
||||
|
||||
The file
|
||||
.Pa /var/run/ppp.tun0.pid
|
||||
contains the process id number of the
|
||||
.Nm ppp
|
||||
program that is using the tunnel device tun0.
|
||||
|
||||
.Sh DIAL ON DEMAND
|
||||
|
||||
To play with demand dialing, you must use the
|
||||
@ -336,7 +375,7 @@ configuration by using the diagnostic port as follows:
|
||||
Connected to localhost.spec.co.jp.
|
||||
Escape character is '^]'.
|
||||
User Process PPP. Written by Toshiharu OHNO.
|
||||
Working as auto mode.
|
||||
Working as auto mode.
|
||||
PPP on tama> show ipcp
|
||||
what ?
|
||||
PPP on tama> pass xxxx
|
||||
@ -447,11 +486,11 @@ set filter-name rule-no action [src_addr/src_width] [dst_addr/dst_width]
|
||||
.Sq filter-name
|
||||
should be one of ifilter, ofilter, or dfilter.
|
||||
.It
|
||||
There are two actions:
|
||||
There are two actions:
|
||||
.Sq permit
|
||||
and
|
||||
.Sq deny .
|
||||
If a given packet
|
||||
If a given packet
|
||||
matches the rule, the associated action is taken immediately.
|
||||
.It
|
||||
.Sq src_width
|
||||
@ -495,7 +534,7 @@ To handle an incoming
|
||||
connection request, follow these steps:
|
||||
|
||||
.Bl -enum
|
||||
.It
|
||||
.It
|
||||
Make sure the modem and (optionally)
|
||||
.Pa /etc/rc.serial
|
||||
is configured correctly.
|
||||
@ -526,7 +565,7 @@ ppp:xxxx:66:66:PPP Login User:/home/ppp:/usr/local/bin/ppplogin
|
||||
.Ed
|
||||
|
||||
.It
|
||||
Create a
|
||||
Create a
|
||||
.Pa /usr/local/bin/ppplogin
|
||||
file with the following contents:
|
||||
.Bd -literal -offset indent
|
||||
@ -612,7 +651,7 @@ commands.
|
||||
.Dl ppp ON tama> set timeout 600
|
||||
|
||||
The timeout period is measured in seconds, the default values for which
|
||||
are timeout = 180 or 3 min, lqrtimer = 30sec and retrytimer = 3sec.
|
||||
are timeout = 180 or 3 min, lqrtimer = 30sec and retrytimer = 3sec.
|
||||
To disable the idle timer function,
|
||||
use the command
|
||||
.Dq set timeout 0 .
|
||||
@ -648,7 +687,7 @@ uses IPCP to negotiate IP addresses. Each side of the connection
|
||||
specifies the IP address that it's willing to use, and if the requested
|
||||
IP address is acceptable then
|
||||
.Nm
|
||||
returns ACK to the requester. Otherwise,
|
||||
returns ACK to the requester. Otherwise,
|
||||
.Nm
|
||||
returns NAK to suggest that the peer use a different IP address. When
|
||||
both sides of the connection agree to accept the received request (and
|
||||
@ -692,7 +731,7 @@ My interface netmask will be 255.255.255.0.
|
||||
.It
|
||||
This is all fine when each side has a pre-determined IP address, however
|
||||
it is often the case that one side is acting as a server which controls
|
||||
all IP addresses and the other side should obey the direction from it.
|
||||
all IP addresses and the other side should obey the direction from it.
|
||||
.El
|
||||
|
||||
In order to allow more flexible behavior, `ifaddr' variable allows the
|
||||
@ -708,7 +747,7 @@ the IP address. The above example signifies that:
|
||||
I'd like to use 192.244.177.38 as my address if it is possible, but I'll
|
||||
also accept any IP address between 192.244.177.0 and 192.244.177.255.
|
||||
|
||||
.It
|
||||
.It
|
||||
I'd like to make him use 192.244.177.2 as his own address, but I'll also
|
||||
permit him to use any IP address between 192.244.176.0 and
|
||||
192.244.191.255.
|
||||
@ -863,6 +902,9 @@ tty port locking file.
|
||||
.Pa /var/run/PPP.system
|
||||
Holds the pid for ppp -auto system.
|
||||
|
||||
.Pa /var/run/ppp.tun0.pid
|
||||
The process id (pid) of the ppp program connected to the ppp0 device.
|
||||
|
||||
.Pa /etc/services
|
||||
Get port number if port number is using service name.
|
||||
.El
|
||||
|
Loading…
Reference in New Issue
Block a user