o Remove the `mode' global - it's now per physical device.
o Shuffle things that live at the datalink level into ``show link'' rather than ``show modem''. o Make both ``show'' commands prettier and more consistent, and display carrier status, link type and our name in ``show modem''. o Show redial and reconnect information in ``show link'' and remove ``show redial'' and ``show reconnect''. o Down the correct link in bundle_LinkLost(). o Remove stale -direct and -background links at the end of our main loop, not when we know they're going. This prevents unexpected pointer-invalidations... o If we ``set server'' with the same values twice, notice and don't moan about failure. o Record dial script despite our link mode. The mode may be changed later (next mod) :-) We never run scripts in -direct and -dedicated modes. o Make ``set server none'' functional again. o Correct datalink state array so that we don't report an ``unknown'' state. o Pass struct ipcp to IpcpCleanInterface, not struct fsm. o Create TUN_PREFIX define rather than hard-coding in main.c o prompt_TtyInit now handles a NULL prompt for -direct mode rather than having to create one then destroy it uncleanly. o Mention our mode in the "PPP Started" LogPHASE message. o Bring all auto links up when we have something to send. o Remove some redundant Physical_*() functions. o Show which connection is running a command when logging commands. o Initialise throughput uptime correctly.
This commit is contained in:
parent
c06d604b03
commit
565e35e50e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35118
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.c,v 1.1.2.42 1998/04/07 01:49:24 brian Exp $
|
||||
* $Id: bundle.c,v 1.1.2.43 1998/04/07 23:45:41 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -199,7 +199,7 @@ bundle_LayerUp(struct bundle *bundle, struct fsm *fp)
|
||||
* The given fsm is now up
|
||||
* If it's an LCP (including MP initialisation), set our mtu
|
||||
* (This routine is also called from mp_Init() with it's LCP)
|
||||
* If it's an NCP, tell our background mode parent to go away.
|
||||
* If it's an NCP, tell our -background parent to go away.
|
||||
* If it's the first NCP, start the idle timer.
|
||||
*/
|
||||
|
||||
@ -422,7 +422,7 @@ bundle_DescriptorWrite(struct descriptor *d, struct bundle *bundle,
|
||||
* (ENXIO) or the third `No such file or directory' (ENOENT) error.
|
||||
*/
|
||||
struct bundle *
|
||||
bundle_Create(const char *prefix, struct prompt *prompt)
|
||||
bundle_Create(const char *prefix, struct prompt *prompt, int type)
|
||||
{
|
||||
int s, enoentcount, err;
|
||||
struct ifreq ifrq;
|
||||
@ -518,8 +518,9 @@ bundle_Create(const char *prefix, struct prompt *prompt)
|
||||
bundle.fsm.object = &bundle;
|
||||
|
||||
bundle.cfg.idle_timeout = NCP_IDLE_TIMEOUT;
|
||||
bundle.phys_type = type;
|
||||
|
||||
bundle.links = datalink_Create("Modem", &bundle, &bundle.fsm);
|
||||
bundle.links = datalink_Create("default", &bundle, &bundle.fsm, type);
|
||||
if (bundle.links == NULL) {
|
||||
LogPrintf(LogERROR, "Cannot create data link: %s\n", strerror(errno));
|
||||
close(bundle.tun_fd);
|
||||
@ -601,9 +602,8 @@ bundle_Destroy(struct bundle *bundle)
|
||||
struct datalink *dl;
|
||||
struct descriptor *desc, *ndesc;
|
||||
|
||||
|
||||
if (mode & MODE_AUTO) {
|
||||
IpcpCleanInterface(&bundle->ncp.ipcp.fsm);
|
||||
if (bundle->phys_type & PHYS_DEMAND) {
|
||||
IpcpCleanInterface(&bundle->ncp.ipcp);
|
||||
bundle_DownInterface(bundle);
|
||||
}
|
||||
|
||||
@ -744,7 +744,7 @@ bundle_SetRoute(struct bundle *bundle, int cmd, struct in_addr dst,
|
||||
}
|
||||
|
||||
void
|
||||
bundle_LinkLost(struct bundle *bundle, struct link *link, int staydown)
|
||||
bundle_LinkLost(struct bundle *bundle, struct physical *p, int staydown)
|
||||
{
|
||||
/*
|
||||
* Locate the appropriate datalink, and Down it.
|
||||
@ -757,9 +757,9 @@ bundle_LinkLost(struct bundle *bundle, struct link *link, int staydown)
|
||||
* and MAY cause a program exit.
|
||||
*/
|
||||
|
||||
if ((mode & MODE_DIRECT) || bundle->CleaningUp)
|
||||
if (p->type == PHYS_STDIN || bundle->CleaningUp)
|
||||
staydown = 1;
|
||||
datalink_Down(bundle->links, staydown);
|
||||
datalink_Down(p->dl, staydown);
|
||||
}
|
||||
|
||||
void
|
||||
@ -767,27 +767,20 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
|
||||
{
|
||||
/*
|
||||
* Our datalink has closed.
|
||||
* If it's DIRECT or BACKGROUND, delete it.
|
||||
* UpdateSet() will remove 1OFF and STDIN links.
|
||||
* If it's the last data link, enter phase DEAD.
|
||||
*/
|
||||
|
||||
struct datalink *odl;
|
||||
int other_links;
|
||||
|
||||
if (mode & (MODE_DIRECT|MODE_BACKGROUND)) {
|
||||
struct datalink **dlp;
|
||||
for (dlp = &bundle->links; *dlp; dlp = &(*dlp)->next)
|
||||
if (*dlp == dl)
|
||||
*dlp = datalink_Destroy(*dlp);
|
||||
}
|
||||
|
||||
other_links = 0;
|
||||
for (odl = bundle->links; odl; odl = odl->next)
|
||||
if (odl != dl && odl->state != DATALINK_CLOSED)
|
||||
other_links++;
|
||||
|
||||
if (!other_links) {
|
||||
if (!(mode & MODE_AUTO))
|
||||
if (dl->physical->type != PHYS_DEMAND)
|
||||
bundle_DownInterface(bundle);
|
||||
bundle_NewPhase(bundle, PHASE_DEAD);
|
||||
bundle_DisplayPrompt(bundle);
|
||||
@ -795,18 +788,17 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
|
||||
}
|
||||
|
||||
void
|
||||
bundle_Open(struct bundle *bundle, const char *name)
|
||||
bundle_Open(struct bundle *bundle, const char *name, int mask)
|
||||
{
|
||||
/*
|
||||
* Please open the given datalink, or all if name == NULL
|
||||
*/
|
||||
struct datalink *dl;
|
||||
int runscripts;
|
||||
|
||||
runscripts = (mode & (MODE_DIRECT|MODE_DEDICATED)) ? 0 : 1;
|
||||
for (dl = bundle->links; dl; dl = dl->next)
|
||||
if (name == NULL || !strcasecmp(dl->name, name)) {
|
||||
datalink_Up(dl, runscripts, 1);
|
||||
if (mask & dl->physical->type)
|
||||
datalink_Up(dl, 1, 1);
|
||||
if (name != NULL)
|
||||
break;
|
||||
}
|
||||
@ -875,7 +867,8 @@ bundle_IdleTimeout(void *v)
|
||||
void
|
||||
bundle_StartIdleTimer(struct bundle *bundle)
|
||||
{
|
||||
if (!(mode & (MODE_DEDICATED | MODE_DDIAL)) && bundle->cfg.idle_timeout) {
|
||||
if (!(bundle->phys_type & (PHYS_DEDICATED|PHYS_PERM)) &&
|
||||
bundle->cfg.idle_timeout) {
|
||||
StopTimer(&bundle->idle.timer);
|
||||
bundle->idle.timer.func = bundle_IdleTimeout;
|
||||
bundle->idle.timer.name = "idle";
|
||||
@ -993,6 +986,17 @@ bundle_SetTtyCommandMode(struct bundle *bundle, struct datalink *dl)
|
||||
prompt_TtyCommandMode(p);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bundle_GenPhysType(struct bundle *bundle)
|
||||
{
|
||||
struct datalink *dl;
|
||||
|
||||
bundle->phys_type = 0;
|
||||
for (dl = bundle->links; dl; dl = dl->next)
|
||||
bundle->phys_type |= dl->physical->type;
|
||||
}
|
||||
|
||||
void
|
||||
bundle_DatalinkClone(struct bundle *bundle, struct datalink *dl,
|
||||
const char *name)
|
||||
@ -1001,6 +1005,7 @@ bundle_DatalinkClone(struct bundle *bundle, struct datalink *dl,
|
||||
|
||||
ndl->next = dl->next;
|
||||
dl->next = ndl;
|
||||
bundle_GenPhysType(bundle);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1014,4 +1019,19 @@ bundle_DatalinkRemove(struct bundle *bundle, struct datalink *dl)
|
||||
*dlp = datalink_Destroy(dl);
|
||||
break;
|
||||
}
|
||||
bundle_GenPhysType(bundle);
|
||||
}
|
||||
|
||||
void
|
||||
bundle_CleanDatalinks(struct bundle *bundle)
|
||||
{
|
||||
struct datalink **dlp = &bundle->links;
|
||||
|
||||
while (*dlp)
|
||||
if ((*dlp)->state == DATALINK_CLOSED &&
|
||||
(*dlp)->physical->type & (PHYS_STDIN|PHYS_1OFF))
|
||||
*dlp = datalink_Destroy(*dlp);
|
||||
else
|
||||
dlp = &(*dlp)->next;
|
||||
bundle_GenPhysType(bundle);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.h,v 1.1.2.25 1998/04/03 19:26:17 brian Exp $
|
||||
* $Id: bundle.h,v 1.1.2.26 1998/04/05 22:48:02 brian Exp $
|
||||
*/
|
||||
|
||||
#define PHASE_DEAD 0 /* Link is dead */
|
||||
@ -48,6 +48,7 @@ struct bundle {
|
||||
char *ifname; /* The interface name */
|
||||
int routing_seq; /* The current routing sequence number */
|
||||
u_int phase; /* Curent phase */
|
||||
int phys_type; /* Union of all physical::type's */
|
||||
|
||||
unsigned CleaningUp : 1; /* Going to exit.... */
|
||||
|
||||
@ -87,7 +88,7 @@ struct bundle {
|
||||
#define descriptor2bundle(d) \
|
||||
((d)->type == BUNDLE_DESCRIPTOR ? (struct bundle *)(d) : NULL)
|
||||
|
||||
extern struct bundle *bundle_Create(const char *, struct prompt *);
|
||||
extern struct bundle *bundle_Create(const char *, struct prompt *, int);
|
||||
extern void bundle_Destroy(struct bundle *);
|
||||
extern const char *bundle_PhaseName(struct bundle *);
|
||||
#define bundle_Phase(b) ((b)->phase)
|
||||
@ -95,9 +96,9 @@ extern void bundle_NewPhase(struct bundle *, u_int);
|
||||
extern int bundle_LinkIsUp(const struct bundle *);
|
||||
extern void bundle_SetRoute(struct bundle *, int, struct in_addr,
|
||||
struct in_addr, struct in_addr, int);
|
||||
extern void bundle_LinkLost(struct bundle *, struct link *, int);
|
||||
extern void bundle_LinkLost(struct bundle *, struct physical *, int);
|
||||
extern void bundle_Close(struct bundle *, const char *, int);
|
||||
extern void bundle_Open(struct bundle *, const char *name);
|
||||
extern void bundle_Open(struct bundle *, const char *, int);
|
||||
extern void bundle_LinkClosed(struct bundle *, struct datalink *);
|
||||
|
||||
extern int bundle_FillQueues(struct bundle *);
|
||||
@ -122,3 +123,4 @@ extern void bundle_SetTtyCommandMode(struct bundle *, struct datalink *);
|
||||
extern void bundle_DatalinkClone(struct bundle *, struct datalink *,
|
||||
const char *);
|
||||
extern void bundle_DatalinkRemove(struct bundle *, struct datalink *);
|
||||
extern void bundle_CleanDatalinks(struct bundle *);
|
||||
|
@ -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.131.2.55 1998/04/07 00:53:33 brian Exp $
|
||||
* $Id: command.c,v 1.131.2.56 1998/04/07 23:45:45 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@ -28,6 +28,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <net/route.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#ifndef NOALIAS
|
||||
#include <alias.h>
|
||||
@ -182,12 +183,41 @@ RemoveCommand(struct cmdargs const *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
LoadCommand(struct cmdargs const *arg)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (arg->argc > 0)
|
||||
name = *arg->argv;
|
||||
else
|
||||
name = "default";
|
||||
|
||||
if (!ValidSystem(name, arg->prompt, arg->bundle->phys_type)) {
|
||||
LogPrintf(LogERROR, "%s: Label not allowed\n", name);
|
||||
return 1;
|
||||
} else if (SelectSystem(arg->bundle, name, CONFFILE, arg->prompt) < 0) {
|
||||
LogPrintf(LogWARN, "%s: label not found.\n", name);
|
||||
return -1;
|
||||
} else
|
||||
SetLabel(arg->argc ? name : NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SaveCommand(struct cmdargs const *arg)
|
||||
{
|
||||
LogPrintf(LogWARN, "save command is not implemented (yet).\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
DialCommand(struct cmdargs const *arg)
|
||||
{
|
||||
int res;
|
||||
|
||||
if ((mode & MODE_DAEMON) && !(mode & MODE_AUTO)) {
|
||||
if ((arg->cx && !(arg->cx->physical->type & (PHYS_MANUAL|PHYS_DEMAND)))
|
||||
|| (!arg->cx && (arg->bundle->phys_type & ~(PHYS_MANUAL|PHYS_DEMAND)))) {
|
||||
LogPrintf(LogWARN,
|
||||
"Manual dial is only available in auto and interactive mode\n");
|
||||
return 1;
|
||||
@ -196,7 +226,7 @@ DialCommand(struct cmdargs const *arg)
|
||||
if (arg->argc > 0 && (res = LoadCommand(arg)) != 0)
|
||||
return res;
|
||||
|
||||
bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL);
|
||||
bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -211,43 +241,33 @@ ShellCommand(struct cmdargs const *arg, int bg)
|
||||
|
||||
#ifdef SHELL_ONLY_INTERACTIVELY
|
||||
/* we're only allowed to shell when we run ppp interactively */
|
||||
if (mode != MODE_INTER) {
|
||||
LogPrintf(LogWARN, "Can only start a shell in interactive mode\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef NO_SHELL_IN_AUTO_INTERACTIVE
|
||||
|
||||
/*
|
||||
* we want to stop shell commands when we've got a telnet connection to an
|
||||
* auto mode ppp
|
||||
*/
|
||||
if (arg->prompt && !(mode & MODE_INTER)) {
|
||||
LogPrintf(LogWARN, "Shell is not allowed interactively in auto mode\n");
|
||||
if (arg->prompt && arg->prompt->owner) {
|
||||
LogPrintf(LogWARN, "Can't start a shell from a network connection\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (arg->argc == 0)
|
||||
if (!(mode & MODE_INTER)) {
|
||||
if (arg->prompt)
|
||||
LogPrintf(LogWARN, "Can't start an interactive shell from"
|
||||
" a telnet session\n");
|
||||
else
|
||||
LogPrintf(LogWARN, "Can only start an interactive shell in"
|
||||
" interactive mode\n");
|
||||
if (!arg->prompt) {
|
||||
LogPrintf(LogWARN, "Can't start an interactive shell from"
|
||||
" a config file\n");
|
||||
return 1;
|
||||
} else if (arg->prompt->owner) {
|
||||
LogPrintf(LogWARN, "Can't start an interactive shell from"
|
||||
" a socket connection\n");
|
||||
return 1;
|
||||
} else if (bg) {
|
||||
LogPrintf(LogWARN, "Can only start an interactive shell in"
|
||||
" the foreground mode\n");
|
||||
return 1;
|
||||
}
|
||||
if ((shell = getenv("SHELL")) == 0)
|
||||
shell = _PATH_BSHELL;
|
||||
|
||||
if ((shpid = fork()) == 0) {
|
||||
int dtablesize, i, fd;
|
||||
|
||||
if ((shell = getenv("SHELL")) == 0)
|
||||
shell = _PATH_BSHELL;
|
||||
|
||||
TermTimerService();
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGQUIT, SIG_DFL);
|
||||
@ -267,7 +287,6 @@ ShellCommand(struct cmdargs const *arg, int bg)
|
||||
for (dtablesize = getdtablesize(), i = 3; i < dtablesize; i++)
|
||||
close(i);
|
||||
|
||||
prompt_TtyOldMode(arg->prompt);
|
||||
setuid(geteuid());
|
||||
if (arg->argc > 0) {
|
||||
/* substitute pseudo args */
|
||||
@ -297,6 +316,7 @@ ShellCommand(struct cmdargs const *arg, int bg)
|
||||
} else {
|
||||
if (arg->prompt)
|
||||
printf("ppp: Pausing until %s finishes\n", shell);
|
||||
prompt_TtyOldMode(arg->prompt);
|
||||
execl(shell, shell, NULL);
|
||||
}
|
||||
|
||||
@ -304,18 +324,18 @@ ShellCommand(struct cmdargs const *arg, int bg)
|
||||
arg->argc > 0 ? arg->argv[0] : shell);
|
||||
exit(255);
|
||||
}
|
||||
if (shpid == (pid_t) - 1) {
|
||||
LogPrintf(LogERROR, "Fork failed: %s\n", strerror(errno));
|
||||
} else {
|
||||
int status;
|
||||
|
||||
if (shpid == (pid_t) - 1)
|
||||
LogPrintf(LogERROR, "Fork failed: %s\n", strerror(errno));
|
||||
else {
|
||||
int status;
|
||||
waitpid(shpid, &status, 0);
|
||||
}
|
||||
|
||||
if (arg->prompt)
|
||||
if (arg->prompt && !arg->prompt->owner)
|
||||
prompt_TtyCommandMode(arg->prompt);
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -367,7 +387,7 @@ static struct cmdtab const Commands[] = {
|
||||
"Generate a down event", "down"},
|
||||
{"enable", NULL, EnableCommand, LOCAL_AUTH,
|
||||
"Enable option", "enable option .."},
|
||||
{"link", NULL, LinkCommand, LOCAL_AUTH,
|
||||
{"link", "datalink", LinkCommand, LOCAL_AUTH,
|
||||
"Link specific commands", "link name command ..."},
|
||||
{"load", NULL, LoadCommand, LOCAL_AUTH,
|
||||
"Load settings", "load [remote]"},
|
||||
@ -466,7 +486,7 @@ static int
|
||||
ShowVersion(struct cmdargs const *arg)
|
||||
{
|
||||
static char VarVersion[] = "PPP Version 2.0-beta";
|
||||
static char VarLocalVersion[] = "$Date: 1998/04/07 00:53:33 $";
|
||||
static char VarLocalVersion[] = "$Date: 1998/04/07 23:45:45 $";
|
||||
|
||||
prompt_Printf(arg->prompt, "%s - %s \n", VarVersion, VarLocalVersion);
|
||||
return 0;
|
||||
@ -483,40 +503,6 @@ ShowProtocolStats(struct cmdargs const *arg)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ShowReconnect(struct cmdargs const *arg)
|
||||
{
|
||||
prompt_Printf(arg->prompt, "%s: Reconnect Timer: %d, %d tries\n",
|
||||
arg->cx->name, arg->cx->cfg.reconnect_timeout,
|
||||
arg->cx->cfg.max_reconnect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ShowRedial(struct cmdargs const *arg)
|
||||
{
|
||||
prompt_Printf(arg->prompt, " Redial Timer: ");
|
||||
|
||||
if (arg->cx->cfg.dial_timeout >= 0)
|
||||
prompt_Printf(arg->prompt, " %d seconds, ", arg->cx->cfg.dial_timeout);
|
||||
else
|
||||
prompt_Printf(arg->prompt, " Random 0 - %d seconds, ", DIAL_TIMEOUT);
|
||||
|
||||
prompt_Printf(arg->prompt, " Redial Next Timer: ");
|
||||
|
||||
if (arg->cx->cfg.dial_next_timeout >= 0)
|
||||
prompt_Printf(arg->prompt, " %d seconds, ", arg->cx->cfg.dial_next_timeout);
|
||||
else
|
||||
prompt_Printf(arg->prompt, " Random 0 - %d seconds, ", DIAL_TIMEOUT);
|
||||
|
||||
if (arg->cx->cfg.max_dial)
|
||||
prompt_Printf(arg->prompt, "%d dial tries", arg->cx->cfg.max_dial);
|
||||
|
||||
prompt_Printf(arg->prompt, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef NOMSEXT
|
||||
static int
|
||||
ShowMSExt(struct cmdargs const *arg)
|
||||
@ -567,10 +553,6 @@ static struct cmdtab const ShowCommands[] = {
|
||||
#endif
|
||||
{"proto", NULL, ShowProtocolStats, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Show protocol summary", "show proto"},
|
||||
{"reconnect", NULL, ShowReconnect, LOCAL_AUTH | LOCAL_CX,
|
||||
"Show reconnect timer", "show reconnect"},
|
||||
{"redial", NULL, ShowRedial, LOCAL_AUTH | LOCAL_CX,
|
||||
"Show Redial timeout", "show redial"},
|
||||
{"route", NULL, ShowRoute, LOCAL_AUTH,
|
||||
"Show routing table", "show route"},
|
||||
{"stopped", NULL, ShowStopped, LOCAL_AUTH | LOCAL_CX,
|
||||
@ -833,73 +815,6 @@ SetModemSpeed(struct cmdargs const *arg)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
SetReconnect(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc == 2) {
|
||||
arg->cx->cfg.reconnect_timeout = atoi(arg->argv[0]);
|
||||
arg->cx->cfg.max_reconnect = (mode & MODE_DIRECT) ? 0 : atoi(arg->argv[1]);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
SetRedialTimeout(struct cmdargs const *arg)
|
||||
{
|
||||
int timeout;
|
||||
int tries;
|
||||
char *dot;
|
||||
|
||||
if (arg->argc == 1 || arg->argc == 2) {
|
||||
if (strncasecmp(arg->argv[0], "random", 6) == 0 &&
|
||||
(arg->argv[0][6] == '\0' || arg->argv[0][6] == '.')) {
|
||||
arg->cx->cfg.dial_timeout = -1;
|
||||
randinit();
|
||||
} else {
|
||||
timeout = atoi(arg->argv[0]);
|
||||
|
||||
if (timeout >= 0)
|
||||
arg->cx->cfg.dial_timeout = timeout;
|
||||
else {
|
||||
LogPrintf(LogWARN, "Invalid redial timeout\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dot = strchr(arg->argv[0], '.');
|
||||
if (dot) {
|
||||
if (strcasecmp(++dot, "random") == 0) {
|
||||
arg->cx->cfg.dial_next_timeout = -1;
|
||||
randinit();
|
||||
} else {
|
||||
timeout = atoi(dot);
|
||||
if (timeout >= 0)
|
||||
arg->cx->cfg.dial_next_timeout = timeout;
|
||||
else {
|
||||
LogPrintf(LogWARN, "Invalid next redial timeout\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
/* Default next timeout */
|
||||
arg->cx->cfg.dial_next_timeout = DIAL_NEXT_TIMEOUT;
|
||||
|
||||
if (arg->argc == 2) {
|
||||
tries = atoi(arg->argv[1]);
|
||||
|
||||
if (tries >= 0) {
|
||||
arg->cx->cfg.max_dial = tries;
|
||||
} else {
|
||||
LogPrintf(LogWARN, "Invalid retry value\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
SetStoppedTimeout(struct cmdargs const *arg)
|
||||
{
|
||||
@ -940,9 +855,6 @@ SetServer(struct cmdargs const *arg)
|
||||
if (!ismask(mask))
|
||||
return -1;
|
||||
} else if (strcasecmp(port, "none") == 0) {
|
||||
if (mask != NULL || passwd != NULL)
|
||||
return -1;
|
||||
|
||||
if (ServerClose(arg->bundle))
|
||||
LogPrintf(LogPHASE, "Disabled server port.\n");
|
||||
return 0;
|
||||
@ -1076,7 +988,8 @@ SetInterfaceAddr(struct cmdargs const *arg)
|
||||
ipcp->cfg.peer_range.width = 0;
|
||||
}
|
||||
|
||||
if (hisaddr && !UseHisaddr(arg->bundle, hisaddr, mode & MODE_AUTO))
|
||||
if (hisaddr &&
|
||||
!UseHisaddr(arg->bundle, hisaddr, arg->bundle->phys_type & PHYS_DEMAND))
|
||||
return 4;
|
||||
|
||||
return 0;
|
||||
@ -1091,11 +1004,6 @@ SetMSEXT(struct ipcp *ipcp, struct in_addr * pri_addr,
|
||||
int dummyint;
|
||||
struct in_addr dummyaddr;
|
||||
|
||||
if (!(mode & MODE_DIRECT)) {
|
||||
LogPrintf(LogWARN, "set nbns|ns: Only available in direct mode\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pri_addr->s_addr = sec_addr->s_addr = 0L;
|
||||
|
||||
if (argc > 0) {
|
||||
@ -1180,16 +1088,12 @@ SetVariable(struct cmdargs const *arg)
|
||||
}
|
||||
break;
|
||||
case VAR_DIAL:
|
||||
if (!(mode & (MODE_DIRECT|MODE_DEDICATED))) {
|
||||
strncpy(cx->cfg.script.dial, argp, sizeof cx->cfg.script.dial - 1);
|
||||
cx->cfg.script.dial[sizeof cx->cfg.script.dial - 1] = '\0';
|
||||
}
|
||||
strncpy(cx->cfg.script.dial, argp, sizeof cx->cfg.script.dial - 1);
|
||||
cx->cfg.script.dial[sizeof cx->cfg.script.dial - 1] = '\0';
|
||||
break;
|
||||
case VAR_LOGIN:
|
||||
if (!(mode & (MODE_DIRECT|MODE_DEDICATED))) {
|
||||
strncpy(cx->cfg.script.login, argp, sizeof cx->cfg.script.login - 1);
|
||||
cx->cfg.script.login[sizeof cx->cfg.script.login - 1] = '\0';
|
||||
}
|
||||
strncpy(cx->cfg.script.login, argp, sizeof cx->cfg.script.login - 1);
|
||||
cx->cfg.script.login[sizeof cx->cfg.script.login - 1] = '\0';
|
||||
break;
|
||||
case VAR_WINSIZE:
|
||||
if (arg->argc > 0) {
|
||||
@ -1267,10 +1171,8 @@ SetVariable(struct cmdargs const *arg)
|
||||
cx->cfg.phone.list[sizeof cx->cfg.phone.list - 1] = '\0';
|
||||
break;
|
||||
case VAR_HANGUP:
|
||||
if (!(mode & (MODE_DIRECT|MODE_DEDICATED))) {
|
||||
strncpy(cx->cfg.script.hangup, argp, sizeof cx->cfg.script.hangup - 1);
|
||||
cx->cfg.script.hangup[sizeof cx->cfg.script.hangup - 1] = '\0';
|
||||
}
|
||||
strncpy(cx->cfg.script.hangup, argp, sizeof cx->cfg.script.hangup - 1);
|
||||
cx->cfg.script.hangup[sizeof cx->cfg.script.hangup - 1] = '\0';
|
||||
break;
|
||||
case VAR_IDLETIMEOUT:
|
||||
if (arg->argc > 1)
|
||||
@ -1408,9 +1310,9 @@ static struct cmdtab const SetCommands[] = {
|
||||
"Set modem parity", "set parity [odd|even|none]"},
|
||||
{"phone", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "Set telephone number(s)",
|
||||
"set phone phone1[:phone2[...]]", (const void *)VAR_PHONE},
|
||||
{"reconnect", NULL, SetReconnect, LOCAL_AUTH | LOCAL_CX,
|
||||
{"reconnect", NULL, datalink_SetReconnect, LOCAL_AUTH | LOCAL_CX,
|
||||
"Set Reconnect timeout", "set reconnect value ntries"},
|
||||
{"redial", NULL, SetRedialTimeout, LOCAL_AUTH | LOCAL_CX,
|
||||
{"redial", NULL, datalink_SetRedial, LOCAL_AUTH | LOCAL_CX,
|
||||
"Set Redial timeout", "set redial value|random[.value|random] [attempts]"},
|
||||
{"server", "socket", SetServer, LOCAL_AUTH,
|
||||
"Set server port", "set server|socket TcpPort|LocalName|none [mask]"},
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: datalink.c,v 1.1.2.34 1998/04/06 09:12:26 brian Exp $
|
||||
* $Id: datalink.c,v 1.1.2.35 1998/04/07 00:53:35 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -63,6 +63,7 @@
|
||||
#include "lcpproto.h"
|
||||
#include "pap.h"
|
||||
#include "chap.h"
|
||||
#include "command.h"
|
||||
#include "datalink.h"
|
||||
|
||||
static const char *datalink_State(struct datalink *);
|
||||
@ -102,31 +103,31 @@ static void
|
||||
datalink_HangupDone(struct datalink *dl)
|
||||
{
|
||||
modem_Close(dl->physical);
|
||||
dl->phone.chosen = "[N/A]";
|
||||
dl->phone.chosen = "N/A";
|
||||
|
||||
if (dl->bundle->CleaningUp ||
|
||||
(mode & MODE_DIRECT) ||
|
||||
(dl->physical->type == PHYS_STDIN) ||
|
||||
((!dl->dial_tries || (dl->dial_tries < 0 && !dl->reconnect_tries)) &&
|
||||
!(mode & (MODE_DDIAL|MODE_DEDICATED)))) {
|
||||
!(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)))) {
|
||||
LogPrintf(LogPHASE, "%s: Entering CLOSED state\n", dl->name);
|
||||
dl->state = DATALINK_CLOSED;
|
||||
dl->dial_tries = -1;
|
||||
dl->reconnect_tries = 0;
|
||||
bundle_LinkClosed(dl->bundle, dl);
|
||||
if (!dl->bundle->CleaningUp)
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial_timeout);
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial.timeout);
|
||||
} else {
|
||||
LogPrintf(LogPHASE, "%s: Re-entering OPENING state\n", dl->name);
|
||||
dl->state = DATALINK_OPENING;
|
||||
if (dl->dial_tries < 0) {
|
||||
datalink_StartDialTimer(dl, dl->cfg.reconnect_timeout);
|
||||
dl->dial_tries = dl->cfg.max_dial;
|
||||
datalink_StartDialTimer(dl, dl->cfg.reconnect.timeout);
|
||||
dl->dial_tries = dl->cfg.dial.max;
|
||||
dl->reconnect_tries--;
|
||||
} else {
|
||||
if (dl->phone.next == NULL)
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial_timeout);
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial.timeout);
|
||||
else
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial_next_timeout);
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial.next_timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,7 +196,17 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
result = 0;
|
||||
switch (dl->state) {
|
||||
case DATALINK_CLOSED:
|
||||
break;
|
||||
if ((dl->physical->type & (PHYS_STDIN|PHYS_DEDICATED|PHYS_1OFF)) &&
|
||||
!bundle_IsDead(dl->bundle))
|
||||
/*
|
||||
* Our first time in - DEDICATED never comes down, and STDIN & 1OFF
|
||||
* get deleted when they enter DATALINK_CLOSED. Go to
|
||||
* DATALINK_OPENING via datalink_Up() and fall through.
|
||||
*/
|
||||
datalink_Up(dl, 1, 1);
|
||||
else
|
||||
break;
|
||||
/* fall through */
|
||||
|
||||
case DATALINK_OPENING:
|
||||
if (dl->dial_timer.state != TIMER_RUNNING) {
|
||||
@ -207,22 +218,24 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
dl->state = DATALINK_DIAL;
|
||||
chat_Init(&dl->chat, dl->physical, dl->cfg.script.dial, 1,
|
||||
datalink_ChoosePhoneNumber(dl));
|
||||
if (!(mode & MODE_DDIAL) && dl->cfg.max_dial)
|
||||
if (!(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)) &&
|
||||
dl->cfg.dial.max)
|
||||
LogPrintf(LogCHAT, "%s: Dial attempt %u of %d\n",
|
||||
dl->name, dl->cfg.max_dial - dl->dial_tries,
|
||||
dl->cfg.max_dial);
|
||||
dl->name, dl->cfg.dial.max - dl->dial_tries,
|
||||
dl->cfg.dial.max);
|
||||
} else
|
||||
datalink_LoginDone(dl);
|
||||
} else {
|
||||
if (!(mode & MODE_DDIAL) && dl->cfg.max_dial)
|
||||
if (!(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)) &&
|
||||
dl->cfg.dial.max)
|
||||
LogPrintf(LogCHAT, "Failed to open modem (attempt %u of %d)\n",
|
||||
dl->cfg.max_dial - dl->dial_tries, dl->cfg.max_dial);
|
||||
dl->cfg.dial.max - dl->dial_tries, dl->cfg.dial.max);
|
||||
else
|
||||
LogPrintf(LogCHAT, "Failed to open modem\n");
|
||||
|
||||
if (dl->bundle->CleaningUp ||
|
||||
(!(mode & (MODE_DDIAL|MODE_DEDICATED)) &&
|
||||
dl->cfg.max_dial && dl->dial_tries == 0)) {
|
||||
(!(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)) &&
|
||||
dl->cfg.dial.max && dl->dial_tries == 0)) {
|
||||
LogPrintf(LogPHASE, "%s: Entering CLOSED state\n", dl->name);
|
||||
dl->state = DATALINK_CLOSED;
|
||||
dl->reconnect_tries = 0;
|
||||
@ -230,7 +243,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
bundle_LinkClosed(dl->bundle, dl);
|
||||
}
|
||||
if (!dl->bundle->CleaningUp)
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial_timeout);
|
||||
datalink_StartDialTimer(dl, dl->cfg.dial.timeout);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -468,7 +481,7 @@ datalink_LayerFinish(void *v, struct fsm *fp)
|
||||
|
||||
struct datalink *
|
||||
datalink_Create(const char *name, struct bundle *bundle,
|
||||
const struct fsm_parent *parent)
|
||||
const struct fsm_parent *parent, int type)
|
||||
{
|
||||
struct datalink *dl;
|
||||
|
||||
@ -503,13 +516,13 @@ datalink_Create(const char *name, struct bundle *bundle,
|
||||
memset(&dl->dial_timer, '\0', sizeof dl->dial_timer);
|
||||
|
||||
dl->dial_tries = 0;
|
||||
dl->cfg.max_dial = 1;
|
||||
dl->cfg.dial_timeout = DIAL_TIMEOUT;
|
||||
dl->cfg.dial_next_timeout = DIAL_NEXT_TIMEOUT;
|
||||
dl->cfg.dial.max = 1;
|
||||
dl->cfg.dial.next_timeout = DIAL_NEXT_TIMEOUT;
|
||||
dl->cfg.dial.timeout = DIAL_TIMEOUT;
|
||||
|
||||
dl->reconnect_tries = 0;
|
||||
dl->cfg.max_reconnect = 0;
|
||||
dl->cfg.reconnect_timeout = RECONNECT_TIMEOUT;
|
||||
dl->cfg.reconnect.max = 0;
|
||||
dl->cfg.reconnect.timeout = RECONNECT_TIMEOUT;
|
||||
|
||||
dl->name = strdup(name);
|
||||
dl->parent = parent;
|
||||
@ -522,7 +535,7 @@ datalink_Create(const char *name, struct bundle *bundle,
|
||||
authinfo_Init(&dl->pap);
|
||||
authinfo_Init(&dl->chap.auth);
|
||||
|
||||
if ((dl->physical = modem_Create(dl)) == NULL) {
|
||||
if ((dl->physical = modem_Create(dl, type)) == NULL) {
|
||||
free(dl->name);
|
||||
free(dl);
|
||||
return NULL;
|
||||
@ -569,7 +582,7 @@ datalink_Clone(struct datalink *odl, const char *name)
|
||||
authinfo_Init(&dl->chap.auth);
|
||||
dl->chap.auth.cfg.fsmretry = odl->chap.auth.cfg.fsmretry;
|
||||
|
||||
if ((dl->physical = modem_Create(dl)) == NULL) {
|
||||
if ((dl->physical = modem_Create(dl, PHYS_MANUAL)) == NULL) {
|
||||
free(dl->name);
|
||||
free(dl);
|
||||
return NULL;
|
||||
@ -610,6 +623,10 @@ datalink_Destroy(struct datalink *dl)
|
||||
void
|
||||
datalink_Up(struct datalink *dl, int runscripts, int packetmode)
|
||||
{
|
||||
if (dl->physical->type & (PHYS_STDIN|PHYS_DEDICATED))
|
||||
/* Ignore scripts */
|
||||
runscripts = 0;
|
||||
|
||||
switch (dl->state) {
|
||||
case DATALINK_CLOSED:
|
||||
LogPrintf(LogPHASE, "%s: Entering OPENING state\n", dl->name);
|
||||
@ -617,8 +634,9 @@ datalink_Up(struct datalink *dl, int runscripts, int packetmode)
|
||||
bundle_Phase(dl->bundle) == PHASE_TERMINATE)
|
||||
bundle_NewPhase(dl->bundle, PHASE_ESTABLISH);
|
||||
dl->state = DATALINK_OPENING;
|
||||
dl->reconnect_tries = dl->cfg.max_reconnect;
|
||||
dl->dial_tries = dl->cfg.max_dial;
|
||||
dl->reconnect_tries =
|
||||
dl->physical->type == PHYS_STDIN ? 0 : dl->cfg.reconnect.max;
|
||||
dl->dial_tries = dl->cfg.dial.max;
|
||||
dl->script.run = runscripts;
|
||||
dl->script.packetmode = packetmode;
|
||||
break;
|
||||
@ -697,23 +715,113 @@ datalink_StayDown(struct datalink *dl)
|
||||
void
|
||||
datalink_Show(struct datalink *dl, struct prompt *prompt)
|
||||
{
|
||||
prompt_Printf(prompt, "Link %s: State %s\n", dl->name, datalink_State(dl));
|
||||
prompt_Printf(prompt, "Name: %s\n", dl->name);
|
||||
prompt_Printf(prompt, " State: %s\n", datalink_State(dl));
|
||||
#ifdef HAVE_DES
|
||||
prompt_Printf(arg->prompt, " Encryption = %s\n",
|
||||
dl->chap.using_MSChap ? "MSChap" : "MD5" );
|
||||
#endif
|
||||
prompt_Printf(prompt, "\nDefaults:\n");
|
||||
prompt_Printf(prompt, " Phone List: %s\n", dl->cfg.phone.list);
|
||||
if (dl->cfg.dial.max)
|
||||
prompt_Printf(prompt, " Dial tries: %d, delay ", dl->cfg.dial.max);
|
||||
else
|
||||
prompt_Printf(prompt, " Dial tries: infinite, delay ");
|
||||
if (dl->cfg.dial.next_timeout > 0)
|
||||
prompt_Printf(prompt, "%ds/", dl->cfg.dial.next_timeout);
|
||||
else
|
||||
prompt_Printf(prompt, "random/");
|
||||
if (dl->cfg.dial.timeout > 0)
|
||||
prompt_Printf(prompt, "%ds\n", dl->cfg.dial.timeout);
|
||||
else
|
||||
prompt_Printf(prompt, "random\n");
|
||||
prompt_Printf(prompt, " Reconnect tries: %d, delay ", dl->cfg.reconnect.max);
|
||||
if (dl->cfg.reconnect.timeout > 0)
|
||||
prompt_Printf(prompt, "%ds\n", dl->cfg.reconnect.timeout);
|
||||
else
|
||||
prompt_Printf(prompt, "random\n");
|
||||
prompt_Printf(prompt, " Dial Script: %s\n", dl->cfg.script.dial);
|
||||
prompt_Printf(prompt, " Login Script: %s\n", dl->cfg.script.login);
|
||||
prompt_Printf(prompt, " Hangup Script: %s\n", dl->cfg.script.hangup);
|
||||
}
|
||||
|
||||
int
|
||||
datalink_SetReconnect(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc == 2) {
|
||||
arg->cx->cfg.reconnect.timeout = atoi(arg->argv[0]);
|
||||
arg->cx->cfg.reconnect.max = atoi(arg->argv[1]);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
datalink_SetRedial(struct cmdargs const *arg)
|
||||
{
|
||||
int timeout;
|
||||
int tries;
|
||||
char *dot;
|
||||
|
||||
if (arg->argc == 1 || arg->argc == 2) {
|
||||
if (strncasecmp(arg->argv[0], "random", 6) == 0 &&
|
||||
(arg->argv[0][6] == '\0' || arg->argv[0][6] == '.')) {
|
||||
arg->cx->cfg.dial.timeout = -1;
|
||||
randinit();
|
||||
} else {
|
||||
timeout = atoi(arg->argv[0]);
|
||||
|
||||
if (timeout >= 0)
|
||||
arg->cx->cfg.dial.timeout = timeout;
|
||||
else {
|
||||
LogPrintf(LogWARN, "Invalid redial timeout\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dot = strchr(arg->argv[0], '.');
|
||||
if (dot) {
|
||||
if (strcasecmp(++dot, "random") == 0) {
|
||||
arg->cx->cfg.dial.next_timeout = -1;
|
||||
randinit();
|
||||
} else {
|
||||
timeout = atoi(dot);
|
||||
if (timeout >= 0)
|
||||
arg->cx->cfg.dial.next_timeout = timeout;
|
||||
else {
|
||||
LogPrintf(LogWARN, "Invalid next redial timeout\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
/* Default next timeout */
|
||||
arg->cx->cfg.dial.next_timeout = DIAL_NEXT_TIMEOUT;
|
||||
|
||||
if (arg->argc == 2) {
|
||||
tries = atoi(arg->argv[1]);
|
||||
|
||||
if (tries >= 0) {
|
||||
arg->cx->cfg.dial.max = tries;
|
||||
} else {
|
||||
LogPrintf(LogWARN, "Invalid retry value\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char *states[] = {
|
||||
"CLOSED",
|
||||
"OPENING",
|
||||
"HANGUP",
|
||||
"DIAL",
|
||||
"LOGIN",
|
||||
"READY",
|
||||
"LCP"
|
||||
"AUTH"
|
||||
"OPEN"
|
||||
"closed",
|
||||
"opening",
|
||||
"hangup",
|
||||
"dial",
|
||||
"login",
|
||||
"ready",
|
||||
"lcp",
|
||||
"auth",
|
||||
"open"
|
||||
};
|
||||
|
||||
static const char *
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: datalink.h,v 1.1.2.15 1998/04/05 22:48:14 brian Exp $
|
||||
* $Id: datalink.h,v 1.1.2.16 1998/04/07 00:53:36 brian Exp $
|
||||
*/
|
||||
|
||||
#define DATALINK_CLOSED (0)
|
||||
@ -63,11 +63,15 @@ struct datalink {
|
||||
struct {
|
||||
char list[SCRIPT_LEN]; /* Telephone Numbers */
|
||||
} phone;
|
||||
int max_dial; /* initially try again this number of times */
|
||||
int dial_timeout; /* Redial timeout value */
|
||||
int dial_next_timeout; /* Redial next timeout value */
|
||||
int max_reconnect; /* initially try again this number of times */
|
||||
int reconnect_timeout; /* Timeout before reconnect on carrier loss */
|
||||
struct {
|
||||
int max; /* initially try again this number of times */
|
||||
int next_timeout; /* Redial next timeout value */
|
||||
int timeout; /* Redial timeout value (end of phone list) */
|
||||
} dial;
|
||||
struct {
|
||||
int max; /* initially try again this number of times */
|
||||
int timeout; /* Timeout before reconnect on carrier loss */
|
||||
} reconnect;
|
||||
} cfg; /* All our config data is in here */
|
||||
|
||||
struct {
|
||||
@ -99,7 +103,7 @@ struct datalink {
|
||||
((d)->type == DATALINK_DESCRIPTOR ? (struct datalink *)(d) : NULL)
|
||||
|
||||
extern struct datalink *datalink_Create(const char *name, struct bundle *,
|
||||
const struct fsm_parent *);
|
||||
const struct fsm_parent *, int);
|
||||
extern struct datalink *datalink_Clone(struct datalink *, const char *);
|
||||
extern struct datalink *datalink_Destroy(struct datalink *);
|
||||
extern void datalink_Up(struct datalink *, int, int);
|
||||
@ -109,3 +113,5 @@ extern void datalink_StayDown(struct datalink *);
|
||||
extern void datalink_Show(struct datalink *, struct prompt *);
|
||||
extern void datalink_AuthOk(struct datalink *);
|
||||
extern void datalink_AuthNotOk(struct datalink *);
|
||||
extern int datalink_SetRedial(struct cmdargs const *);
|
||||
extern int datalink_SetReconnect(struct cmdargs const *);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: defs.c,v 1.11.4.6 1998/04/03 19:25:29 brian Exp $
|
||||
* $Id: defs.c,v 1.11.4.7 1998/04/06 09:12:26 brian Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
int mode = MODE_INTER;
|
||||
static char dstsystem[50];
|
||||
|
||||
void
|
||||
|
@ -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.29.2.11 1998/04/07 23:45:48 brian Exp $
|
||||
* $Id: defs.h,v 1.29.2.12 1998/04/08 18:27:22 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -31,6 +31,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define TUN_PREFIX "/dev/tun" /* tunnel device prefix */
|
||||
|
||||
#define MODEM_SPEED B38400 /* tty speed */
|
||||
#define SERVER_PORT 3000 /* Base server port no. */
|
||||
#define MODEM_CTSRTS 1 /* Default (true): use CTS/RTS signals */
|
||||
@ -51,19 +53,6 @@
|
||||
#define LINKDOWNFILE "ppp.linkdown"
|
||||
#define SECRETFILE "ppp.secret"
|
||||
|
||||
/*
|
||||
* Definition of working mode
|
||||
*/
|
||||
#define MODE_INTER 1 /* Interactive mode */
|
||||
#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 MODE_BACKGROUND 32 /* Background mode. */
|
||||
|
||||
#define MODE_DAEMON (2|4|8|16|32)
|
||||
#define MODE_OUTGOING_DAEMON (2|8|16|32)
|
||||
|
||||
#define EX_SIG -1
|
||||
#define EX_NORMAL 0
|
||||
#define EX_START 1
|
||||
@ -79,7 +68,14 @@
|
||||
#define EX_NODIAL 12
|
||||
#define EX_NOLOGIN 13
|
||||
|
||||
extern int mode;
|
||||
/* physical::type values (OR'd in bundle::phys_type) */
|
||||
#define PHYS_MANUAL 1 /* Manual link */
|
||||
#define PHYS_DEMAND 2 /* Dial-on-demand link (-auto) */
|
||||
#define PHYS_STDIN 4 /* Incoming link (-direct) */
|
||||
#define PHYS_DEDICATED 8 /* Dedicated link (-dedicated) */
|
||||
#define PHYS_PERM 16 /* Dial immediately, stay connected (-ddial) */
|
||||
#define PHYS_1OFF 32 /* Dial immediately, delete when done. (-background) */
|
||||
#define PHYS_ALL 63
|
||||
|
||||
extern void SetLabel(const char *);
|
||||
extern const char *GetLabel(void);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ipcp.c,v 1.50.2.33 1998/04/07 00:53:51 brian Exp $
|
||||
* $Id: ipcp.c,v 1.50.2.34 1998/04/07 23:45:55 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o More RFC1772 backwoard compatibility
|
||||
@ -319,7 +319,7 @@ ipcp_SetIPaddress(struct bundle *bundle, struct in_addr myaddr,
|
||||
bundle->ncp.ipcp.peer_ifip.s_addr == hisaddr.s_addr)
|
||||
return 0;
|
||||
|
||||
IpcpCleanInterface(&bundle->ncp.ipcp.fsm);
|
||||
IpcpCleanInterface(&bundle->ncp.ipcp);
|
||||
|
||||
s = ID0socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
@ -461,7 +461,7 @@ IpcpLayerStart(struct fsm * fp)
|
||||
/* We're about to start up ! */
|
||||
LogPrintf(LogIPCP, "IpcpLayerStart.\n");
|
||||
|
||||
/* This is where we should be setting up the interface in AUTO mode */
|
||||
/* This is where we should be setting up the interface in DEMAND mode */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -472,9 +472,8 @@ IpcpLayerFinish(struct fsm *fp)
|
||||
}
|
||||
|
||||
void
|
||||
IpcpCleanInterface(struct fsm *fp)
|
||||
IpcpCleanInterface(struct ipcp *ipcp)
|
||||
{
|
||||
struct ipcp *ipcp = fsm2ipcp(fp);
|
||||
struct ifaliasreq ifra;
|
||||
struct sockaddr_in *me, *peer;
|
||||
int s;
|
||||
@ -486,12 +485,13 @@ IpcpCleanInterface(struct fsm *fp)
|
||||
}
|
||||
|
||||
if (Enabled(ConfProxy))
|
||||
cifproxyarp(fp->bundle, ipcp->peer_ifip, s);
|
||||
cifproxyarp(ipcp->fsm.bundle, ipcp->peer_ifip, s);
|
||||
|
||||
if (ipcp->my_ifip.s_addr != INADDR_ANY ||
|
||||
ipcp->peer_ifip.s_addr != INADDR_ANY) {
|
||||
memset(&ifra, '\0', sizeof ifra);
|
||||
strncpy(ifra.ifra_name, fp->bundle->ifname, sizeof ifra.ifra_name - 1);
|
||||
strncpy(ifra.ifra_name, ipcp->fsm.bundle->ifname,
|
||||
sizeof ifra.ifra_name - 1);
|
||||
ifra.ifra_name[sizeof ifra.ifra_name - 1] = '\0';
|
||||
me = (struct sockaddr_in *)&ifra.ifra_addr;
|
||||
peer = (struct sockaddr_in *)&ifra.ifra_broadaddr;
|
||||
@ -533,8 +533,8 @@ IpcpLayerDown(struct fsm *fp)
|
||||
} else
|
||||
SelectSystem(fp->bundle, "MYADDR", LINKDOWNFILE, NULL);
|
||||
|
||||
if (!(mode & MODE_AUTO))
|
||||
IpcpCleanInterface(fp);
|
||||
if (ipcp->fsm.bundle->phys_type & PHYS_DEMAND)
|
||||
IpcpCleanInterface(ipcp);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -634,7 +634,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
|
||||
if (iplist_ip2pos(&ipcp->cfg.peer_list, ipcp->peer_ifip) >= 0)
|
||||
/*
|
||||
* If we've already got a valid address configured for the peer
|
||||
* (in AUTO mode), try NAKing with that so that we don't
|
||||
* (in DEMAND mode), try NAKing with that so that we don't
|
||||
* have to upset things too much.
|
||||
*/
|
||||
ipcp->peer_ip = ipcp->peer_ifip;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ipcp.h,v 1.18.2.19 1998/04/05 19:02:42 brian Exp $
|
||||
* $Id: ipcp.h,v 1.18.2.20 1998/04/07 00:53:52 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -100,4 +100,4 @@ extern void ipcp_AddInOctets(struct ipcp *, int);
|
||||
extern void ipcp_AddOutOctets(struct ipcp *, int);
|
||||
extern int UseHisaddr(struct bundle *, const char *, int);
|
||||
extern int SetInitVJ(struct cmdargs const *);
|
||||
extern void IpcpCleanInterface(struct fsm *);
|
||||
extern void IpcpCleanInterface(struct ipcp *);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: log.c,v 1.25.2.5 1998/04/06 09:12:31 brian Exp $
|
||||
* $Id: log.c,v 1.25.2.6 1998/04/07 00:54:00 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -379,7 +379,7 @@ log_ShowWho(struct cmdargs const *arg)
|
||||
struct prompt *p;
|
||||
|
||||
for (p = logprompt; p; p = p->lognext) {
|
||||
prompt_Printf(arg->prompt, "%s", p->who);
|
||||
prompt_Printf(arg->prompt, "%s (%s)", p->src.type, p->src.from);
|
||||
if (p == arg->prompt)
|
||||
prompt_Printf(arg->prompt, " *");
|
||||
if (!p->active)
|
||||
|
@ -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.121.2.46 1998/04/07 00:54:07 brian Exp $
|
||||
* $Id: main.c,v 1.121.2.47 1998/04/07 23:46:02 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -26,6 +26,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -198,36 +199,34 @@ Usage(void)
|
||||
}
|
||||
|
||||
static char *
|
||||
ProcessArgs(int argc, char **argv)
|
||||
ProcessArgs(int argc, char **argv, int *mode)
|
||||
{
|
||||
int optc;
|
||||
int optc, labelrequired;
|
||||
char *cp;
|
||||
|
||||
optc = 0;
|
||||
mode = MODE_INTER;
|
||||
optc = labelrequired = 0;
|
||||
*mode = PHYS_MANUAL;
|
||||
while (argc > 0 && **argv == '-') {
|
||||
cp = *argv + 1;
|
||||
if (strcmp(cp, "auto") == 0) {
|
||||
mode |= MODE_AUTO;
|
||||
mode &= ~MODE_INTER;
|
||||
*mode = PHYS_DEMAND;
|
||||
labelrequired = 1;
|
||||
} else if (strcmp(cp, "background") == 0) {
|
||||
mode |= MODE_BACKGROUND;
|
||||
mode &= ~MODE_INTER;
|
||||
} else if (strcmp(cp, "direct") == 0) {
|
||||
mode |= MODE_DIRECT;
|
||||
mode &= ~MODE_INTER;
|
||||
} else if (strcmp(cp, "dedicated") == 0) {
|
||||
mode |= MODE_DEDICATED;
|
||||
mode &= ~MODE_INTER;
|
||||
} else if (strcmp(cp, "ddial") == 0) {
|
||||
mode |= MODE_DDIAL;
|
||||
mode &= ~MODE_INTER;
|
||||
#ifndef NOALIAS
|
||||
*mode = PHYS_1OFF;
|
||||
labelrequired = 1;
|
||||
} else if (strcmp(cp, "direct") == 0)
|
||||
*mode = PHYS_STDIN;
|
||||
else if (strcmp(cp, "dedicated") == 0)
|
||||
*mode = PHYS_DEDICATED;
|
||||
else if (strcmp(cp, "ddial") == 0) {
|
||||
*mode = PHYS_PERM;
|
||||
labelrequired = 1;
|
||||
} else if (strcmp(cp, "alias") == 0) {
|
||||
#ifndef NOALIAS
|
||||
if (loadAliasHandlers() != 0)
|
||||
#endif
|
||||
LogPrintf(LogWARN, "Cannot load alias library\n");
|
||||
optc--; /* this option isn't exclusive */
|
||||
#endif
|
||||
} else
|
||||
Usage();
|
||||
optc++;
|
||||
@ -244,6 +243,12 @@ ProcessArgs(int argc, char **argv)
|
||||
exit(EX_START);
|
||||
}
|
||||
|
||||
if (labelrequired && argc != 1) {
|
||||
fprintf(stderr, "Destination system must be specified in"
|
||||
" auto, background or ddial mode.\n");
|
||||
exit(EX_START);
|
||||
}
|
||||
|
||||
return argc == 1 ? *argv : NULL; /* Don't SetLabel yet ! */
|
||||
}
|
||||
|
||||
@ -252,7 +257,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
FILE *lockfile;
|
||||
char *name, *label;
|
||||
int nfds;
|
||||
int nfds, mode;
|
||||
struct bundle *bundle;
|
||||
struct prompt *prompt;
|
||||
|
||||
@ -271,7 +276,7 @@ main(int argc, char **argv)
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
label = ProcessArgs(argc, argv);
|
||||
label = ProcessArgs(argc, argv, &mode);
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
@ -281,7 +286,7 @@ main(int argc, char **argv)
|
||||
* routing table and then run ppp in interactive mode. The `show route'
|
||||
* command will drop chunks of data !!!
|
||||
*/
|
||||
if (mode & MODE_INTER) {
|
||||
if (mode == PHYS_MANUAL) {
|
||||
close(STDIN_FILENO);
|
||||
if (open(_PATH_TTY, O_RDONLY) != STDIN_FILENO) {
|
||||
fprintf(stderr, "Cannot open %s for input !\n", _PATH_TTY);
|
||||
@ -291,21 +296,21 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* Allow output for the moment (except in direct mode) */
|
||||
if (mode & MODE_DIRECT)
|
||||
if (mode == PHYS_STDIN)
|
||||
prompt = NULL;
|
||||
else {
|
||||
const char *m;
|
||||
|
||||
SignalPrompt = prompt = prompt_Create(NULL, NULL, PROMPT_STD);
|
||||
if (mode & MODE_DDIAL)
|
||||
if (mode == PHYS_PERM)
|
||||
m = "direct dial";
|
||||
else if (mode & MODE_BACKGROUND)
|
||||
else if (mode & PHYS_1OFF)
|
||||
m = "background";
|
||||
else if (mode & MODE_AUTO)
|
||||
else if (mode & PHYS_DEMAND)
|
||||
m = "auto";
|
||||
else if (mode & MODE_DEDICATED)
|
||||
else if (mode & PHYS_DEDICATED)
|
||||
m = "dedicated";
|
||||
else if (mode & MODE_INTER)
|
||||
else if (mode & PHYS_MANUAL)
|
||||
m = "interactive";
|
||||
else
|
||||
m = NULL;
|
||||
@ -330,9 +335,9 @@ main(int argc, char **argv)
|
||||
} while (ptr >= conf);
|
||||
}
|
||||
|
||||
if (!ValidSystem(label, prompt)) {
|
||||
if (!ValidSystem(label, prompt, mode)) {
|
||||
fprintf(stderr, "You may not use ppp in this mode with this label\n");
|
||||
if (mode & MODE_DIRECT) {
|
||||
if (mode == PHYS_STDIN) {
|
||||
const char *l;
|
||||
l = label ? label : "default";
|
||||
LogPrintf(LogWARN, "Label %s rejected -direct connection\n", l);
|
||||
@ -341,22 +346,14 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((bundle = bundle_Create("/dev/tun", prompt)) == NULL) {
|
||||
if ((bundle = bundle_Create(TUN_PREFIX, prompt, mode)) == NULL) {
|
||||
LogPrintf(LogWARN, "bundle_Create: %s\n", strerror(errno));
|
||||
return EX_START;
|
||||
}
|
||||
SignalBundle = bundle;
|
||||
|
||||
if (SelectSystem(bundle, "default", CONFFILE, prompt) < 0)
|
||||
prompt_Printf(prompt,
|
||||
"Warning: No default entry is given in config file.\n");
|
||||
|
||||
if ((mode & MODE_OUTGOING_DAEMON) && !(mode & MODE_DEDICATED))
|
||||
if (label == NULL) {
|
||||
prompt_Printf(prompt, "Destination system must be specified in"
|
||||
" auto, background or ddial mode.\n");
|
||||
return EX_START;
|
||||
}
|
||||
prompt_Printf(prompt, "Warning: No default entry found in config file.\n");
|
||||
|
||||
pending_signal(SIGHUP, CloseSession);
|
||||
pending_signal(SIGTERM, CloseSession);
|
||||
@ -364,7 +361,8 @@ main(int argc, char **argv)
|
||||
pending_signal(SIGQUIT, CloseSession);
|
||||
pending_signal(SIGALRM, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
if (mode & MODE_INTER)
|
||||
|
||||
if (mode == PHYS_MANUAL)
|
||||
pending_signal(SIGTSTP, TerminalStop);
|
||||
|
||||
#if 0 /* What's our passwd :-O */
|
||||
@ -382,20 +380,20 @@ main(int argc, char **argv)
|
||||
* embeded load "otherlabel" command.
|
||||
*/
|
||||
SetLabel(label);
|
||||
if (mode & MODE_AUTO &&
|
||||
if (mode == PHYS_DEMAND &&
|
||||
bundle->ncp.ipcp.cfg.peer_range.ipaddr.s_addr == INADDR_ANY) {
|
||||
prompt_Printf(prompt, "You must \"set ifaddr\" in label %s for "
|
||||
"auto mode.\n", label);
|
||||
prompt_Printf(prompt, "You must \"set ifaddr\" with a peer address "
|
||||
"in label %s for auto mode.\n", label);
|
||||
AbortProgram(EX_START);
|
||||
}
|
||||
}
|
||||
|
||||
if (mode & MODE_DAEMON) {
|
||||
if (!(mode & MODE_DIRECT)) {
|
||||
if (mode != PHYS_MANUAL) {
|
||||
if (mode != PHYS_STDIN) {
|
||||
int bgpipe[2];
|
||||
pid_t bgpid;
|
||||
|
||||
if (mode & MODE_BACKGROUND && pipe(bgpipe)) {
|
||||
if (mode == PHYS_1OFF && pipe(bgpipe)) {
|
||||
LogPrintf(LogERROR, "pipe: %s\n", strerror(errno));
|
||||
AbortProgram(EX_SOCK);
|
||||
}
|
||||
@ -409,7 +407,7 @@ main(int argc, char **argv)
|
||||
if (bgpid) {
|
||||
char c = EX_NORMAL;
|
||||
|
||||
if (mode & MODE_BACKGROUND) {
|
||||
if (mode == PHYS_1OFF) {
|
||||
close(bgpipe[1]);
|
||||
BGPid = bgpid;
|
||||
/* If we get a signal, kill the child */
|
||||
@ -433,29 +431,27 @@ main(int argc, char **argv)
|
||||
close(bgpipe[0]);
|
||||
}
|
||||
return c;
|
||||
} else if (mode & MODE_BACKGROUND) {
|
||||
} else if (mode == PHYS_1OFF) {
|
||||
close(bgpipe[0]);
|
||||
bundle->notify.fd = bgpipe[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (mode & MODE_DIRECT) {
|
||||
/* STDIN_FILENO gets used by modem_Open in DIRECT mode */
|
||||
prompt = prompt_Create(NULL, bundle, PROMPT_STD);
|
||||
prompt_TtyInit(prompt, PROMPT_DONT_WANT_INT);
|
||||
prompt_DestroyUnclean(prompt);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
} else if (mode & MODE_DAEMON) {
|
||||
/* -auto, -dedicated, -ddial & -background */
|
||||
prompt_Destroy(prompt, 0);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
close(STDIN_FILENO);
|
||||
setsid();
|
||||
} else {
|
||||
/* -direct: STDIN_FILENO gets used by modem_Open */
|
||||
prompt_TtyInit(NULL);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
}
|
||||
} else {
|
||||
/* Interactive mode */
|
||||
close(STDERR_FILENO);
|
||||
prompt_TtyInit(prompt, PROMPT_WANT_INT);
|
||||
prompt_TtyInit(prompt);
|
||||
prompt_TtyCommandMode(prompt);
|
||||
prompt_Required(prompt);
|
||||
}
|
||||
@ -473,13 +469,8 @@ main(int argc, char **argv)
|
||||
pid_filename, strerror(errno));
|
||||
#endif
|
||||
|
||||
LogPrintf(LogPHASE, "PPP Started.\n");
|
||||
|
||||
|
||||
do
|
||||
DoLoop(bundle, prompt);
|
||||
while (mode & MODE_DEDICATED);
|
||||
|
||||
LogPrintf(LogPHASE, "PPP Started (%s mode).\n", mode2Nam(mode));
|
||||
DoLoop(bundle, prompt);
|
||||
AbortProgram(EX_NORMAL);
|
||||
|
||||
return EX_NORMAL;
|
||||
@ -493,10 +484,7 @@ DoLoop(struct bundle *bundle, struct prompt *prompt)
|
||||
int qlen;
|
||||
struct tun_data tun;
|
||||
|
||||
if (mode & (MODE_DIRECT|MODE_DEDICATED|MODE_BACKGROUND))
|
||||
bundle_Open(bundle, NULL);
|
||||
|
||||
while (!bundle_IsDead(bundle)) {
|
||||
do {
|
||||
nfds = 0;
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&wfds);
|
||||
@ -596,9 +584,8 @@ DoLoop(struct bundle *bundle, struct prompt *prompt)
|
||||
* Note, we must be in AUTO mode :-/ otherwise our interface should
|
||||
* *not* be UP and we can't receive data
|
||||
*/
|
||||
if ((mode & MODE_AUTO) &&
|
||||
(pri = PacketCheck(bundle, tun.data, n, &bundle->filter.dial)) >= 0)
|
||||
bundle_Open(bundle, NULL);
|
||||
if ((pri = PacketCheck(bundle, tun.data, n, &bundle->filter.dial)) >= 0)
|
||||
bundle_Open(bundle, NULL, PHYS_DEMAND);
|
||||
else
|
||||
/*
|
||||
* Drop the packet. If we were to queue it, we'd just end up with
|
||||
@ -620,6 +607,7 @@ DoLoop(struct bundle *bundle, struct prompt *prompt)
|
||||
IpEnqueue(pri, tun.data, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
LogPrintf(LogDEBUG, "Job (DoLoop) done.\n");
|
||||
} while (bundle_CleanDatalinks(bundle), !bundle_IsDead(bundle));
|
||||
|
||||
LogPrintf(LogDEBUG, "DoLoop done.\n");
|
||||
}
|
||||
|
@ -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.77.2.44 1998/04/03 19:26:22 brian Exp $
|
||||
* $Id: modem.c,v 1.77.2.45 1998/04/06 09:12:33 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -70,6 +70,7 @@
|
||||
#include "auth.h"
|
||||
#include "chap.h"
|
||||
#include "datalink.h"
|
||||
#include "systems.h"
|
||||
|
||||
|
||||
#ifndef O_NONBLOCK
|
||||
@ -87,7 +88,7 @@ static int modem_UpdateSet(struct descriptor *, fd_set *, fd_set *, fd_set *,
|
||||
int *);
|
||||
|
||||
struct physical *
|
||||
modem_Create(struct datalink *dl)
|
||||
modem_Create(struct datalink *dl, int type)
|
||||
{
|
||||
struct physical *p;
|
||||
|
||||
@ -109,6 +110,7 @@ modem_Create(struct datalink *dl)
|
||||
p->desc.IsSet = Physical_IsSet;
|
||||
p->desc.Read = modem_DescriptorRead;
|
||||
p->desc.Write = modem_DescriptorWrite;
|
||||
p->type = type;
|
||||
|
||||
hdlc_Init(&p->hdlc);
|
||||
async_Init(&p->async);
|
||||
@ -125,8 +127,6 @@ modem_Create(struct datalink *dl)
|
||||
|
||||
p->Utmp = 0;
|
||||
|
||||
p->cfg.is_direct = 0; /* not yet used */
|
||||
p->cfg.is_dedicated = 0; /* not yet used */
|
||||
p->cfg.rts_cts = MODEM_CTSRTS;
|
||||
p->cfg.speed = MODEM_SPEED;
|
||||
p->cfg.parity = CS8;
|
||||
@ -288,7 +288,7 @@ modem_Timeout(void *data)
|
||||
if (ioctl(to->modem->fd, TIOCMGET, &to->modem->mbits) < 0) {
|
||||
LogPrintf(LogPHASE, "ioctl error (%s)!\n", strerror(errno));
|
||||
modem_Hangup(to->modem, 0);
|
||||
bundle_LinkLost(to->bundle, &to->modem->link, 0);
|
||||
bundle_LinkLost(to->bundle, to->modem, 0);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
@ -298,13 +298,13 @@ modem_Timeout(void *data)
|
||||
if (to->modem->mbits & TIOCM_CD) {
|
||||
LogPrintf(LogDEBUG, "modem_Timeout: offline -> online\n");
|
||||
/*
|
||||
* In dedicated mode, start packet mode immediate after we detected
|
||||
* carrier.
|
||||
* In -dedicated mode, start packet mode immediately after we've
|
||||
* detected carrier.
|
||||
*/
|
||||
} else {
|
||||
LogPrintf(LogDEBUG, "modem_Timeout: online -> offline\n");
|
||||
modem_Hangup(to->modem, 0);
|
||||
bundle_LinkLost(to->bundle, &to->modem->link, 0);
|
||||
bundle_LinkLost(to->bundle, to->modem, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -433,12 +433,7 @@ modem_lock(struct physical *modem, int tunno)
|
||||
if (*modem->name.full != '/')
|
||||
return 0;
|
||||
|
||||
if (
|
||||
#ifdef notyet
|
||||
!modem->is_direct &&
|
||||
#else
|
||||
!(mode & MODE_DIRECT) &&
|
||||
#endif
|
||||
if (modem->type != PHYS_STDIN &&
|
||||
(res = ID0uu_lock(modem->name.base)) != UU_LOCK_OK) {
|
||||
if (res == UU_LOCK_INUSE)
|
||||
LogPrintf(LogPHASE, "Modem %s is in use\n", modem->name.full);
|
||||
@ -478,13 +473,7 @@ modem_Unlock(struct physical *modem)
|
||||
ID0unlink(fn);
|
||||
#endif
|
||||
|
||||
if (
|
||||
#ifdef notyet
|
||||
!modem->is_direct &&
|
||||
#else
|
||||
!(mode & MODE_DIRECT) &&
|
||||
#endif
|
||||
ID0uu_unlock(modem->name.base) == -1)
|
||||
if (modem->type != PHYS_STDIN && ID0uu_unlock(modem->name.base) == -1)
|
||||
LogPrintf(LogALERT, "Warning: Can't uu_unlock %s\n", fn);
|
||||
}
|
||||
|
||||
@ -509,13 +498,7 @@ modem_Open(struct physical *modem, struct bundle *bundle)
|
||||
if (modem->fd >= 0)
|
||||
LogPrintf(LogDEBUG, "modem_Open: Modem is already open!\n");
|
||||
/* We're going back into "term" mode */
|
||||
else if (
|
||||
#ifdef notyet
|
||||
modem->is_direct
|
||||
#else
|
||||
mode & MODE_DIRECT
|
||||
#endif
|
||||
) {
|
||||
else if (modem->type == PHYS_STDIN) {
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
LogPrintf(LogDEBUG, "modem_Open(direct): Modem is a tty\n");
|
||||
modem_SetDevice(modem, ttyname(STDIN_FILENO));
|
||||
@ -616,49 +599,28 @@ modem_Open(struct physical *modem, struct bundle *bundle)
|
||||
rstio.c_iflag |= IXOFF;
|
||||
}
|
||||
rstio.c_iflag |= IXON;
|
||||
if (
|
||||
#ifdef notyet
|
||||
!modem->is_dedicated
|
||||
#else
|
||||
!(mode & MODE_DEDICATED)
|
||||
#endif
|
||||
)
|
||||
if (modem->type != PHYS_DEDICATED)
|
||||
rstio.c_cflag |= HUPCL;
|
||||
if (
|
||||
#ifdef notyet
|
||||
!modem->is_direct
|
||||
#else
|
||||
!(mode & MODE_DIRECT)
|
||||
#endif
|
||||
) {
|
||||
|
||||
/*
|
||||
* If we are working as direct mode, don't change tty speed.
|
||||
*/
|
||||
else if (modem->type != PHYS_STDIN) {
|
||||
/* Change tty speed when we're not in -direct mode */
|
||||
rstio.c_cflag &= ~(CSIZE | PARODD | PARENB);
|
||||
rstio.c_cflag |= modem->cfg.parity;
|
||||
if (cfsetspeed(&rstio, IntToSpeed(modem->cfg.speed)) == -1) {
|
||||
if (cfsetspeed(&rstio, IntToSpeed(modem->cfg.speed)) == -1)
|
||||
LogPrintf(LogWARN, "Unable to set modem speed (modem %d to %d)\n",
|
||||
modem->fd, modem->cfg.speed);
|
||||
}
|
||||
}
|
||||
tcsetattr(modem->fd, TCSADRAIN, &rstio);
|
||||
LogPrintf(LogDEBUG, "modem (put): iflag = %x, oflag = %x, cflag = %x\n",
|
||||
rstio.c_iflag, rstio.c_oflag, rstio.c_cflag);
|
||||
|
||||
if (
|
||||
#ifdef notyet
|
||||
!modem->is_direct
|
||||
#else
|
||||
!(mode & MODE_DIRECT)
|
||||
#endif
|
||||
)
|
||||
if (ioctl(modem->fd, TIOCMGET, &modem->mbits)) {
|
||||
if (ioctl(modem->fd, TIOCMGET, &modem->mbits) == -1)
|
||||
if (modem->type != PHYS_STDIN) {
|
||||
LogPrintf(LogERROR, "modem_Open: Cannot get modem status: %s\n",
|
||||
strerror(errno));
|
||||
modem_LogicalClose(modem);
|
||||
return (-1);
|
||||
}
|
||||
} else
|
||||
modem->mbits = TIOCM_CD;
|
||||
LogPrintf(LogDEBUG, "modem_Open: modem control = %o\n", modem->mbits);
|
||||
|
||||
oldflag = fcntl(modem->fd, F_GETFL, 0);
|
||||
@ -668,11 +630,13 @@ modem_Open(struct physical *modem, struct bundle *bundle)
|
||||
modem_LogicalClose(modem);
|
||||
return (-1);
|
||||
}
|
||||
(void) fcntl(modem->fd, F_SETFL, oldflag & ~O_NONBLOCK);
|
||||
}
|
||||
modem_StartTimer(bundle, modem);
|
||||
fcntl(modem->fd, F_SETFL, oldflag & ~O_NONBLOCK);
|
||||
|
||||
return (modem->fd);
|
||||
/* We do the timer only for ttys */
|
||||
modem_StartTimer(bundle, modem);
|
||||
}
|
||||
|
||||
return modem->fd;
|
||||
}
|
||||
|
||||
int
|
||||
@ -699,16 +663,10 @@ modem_Raw(struct physical *modem, struct bundle *bundle)
|
||||
if (!isatty(modem->fd) || Physical_IsSync(modem))
|
||||
return 0;
|
||||
|
||||
if (
|
||||
#ifdef notyet
|
||||
!modem->is_direct &&
|
||||
#else
|
||||
!(mode & MODE_DIRECT) &&
|
||||
#endif
|
||||
modem->fd >= 0 && !Online(modem)) {
|
||||
if (modem->type != PHYS_STDIN && modem->fd >= 0 && !Online(modem))
|
||||
LogPrintf(LogDEBUG, "modem_Raw: modem = %d, mbits = %x\n",
|
||||
modem->fd, modem->mbits);
|
||||
}
|
||||
|
||||
tcgetattr(modem->fd, &rstio);
|
||||
cfmakeraw(&rstio);
|
||||
if (modem->cfg.rts_cts)
|
||||
@ -716,19 +674,14 @@ modem_Raw(struct physical *modem, struct bundle *bundle)
|
||||
else
|
||||
rstio.c_cflag |= CLOCAL;
|
||||
|
||||
if (
|
||||
#ifdef notyet
|
||||
!modem->is_dedicated
|
||||
#else
|
||||
!(mode & MODE_DEDICATED)
|
||||
#endif
|
||||
)
|
||||
if (modem->type != PHYS_DEDICATED)
|
||||
rstio.c_cflag |= HUPCL;
|
||||
|
||||
tcsetattr(modem->fd, TCSADRAIN, &rstio);
|
||||
oldflag = fcntl(modem->fd, F_GETFL, 0);
|
||||
if (oldflag < 0)
|
||||
return (-1);
|
||||
(void) fcntl(modem->fd, F_SETFL, oldflag | O_NONBLOCK);
|
||||
fcntl(modem->fd, F_SETFL, oldflag | O_NONBLOCK);
|
||||
|
||||
to.modem = modem;
|
||||
to.bundle = bundle;
|
||||
@ -805,19 +758,16 @@ modem_Close(struct physical *modem)
|
||||
if (modem->link.Timer.load)
|
||||
modem_Hangup(modem, force_hack);
|
||||
|
||||
*modem->name.full = '\0';
|
||||
modem->name.base = modem->name.full;
|
||||
|
||||
if (!isatty(modem->fd)) {
|
||||
modem_PhysicalClose(modem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (modem->fd >= 0) {
|
||||
if (force_hack ||
|
||||
#ifdef notyet
|
||||
!modem->is_dedicated
|
||||
#else
|
||||
!(mode & MODE_DEDICATED)
|
||||
#endif
|
||||
) {
|
||||
if (force_hack || modem->type != PHYS_DEDICATED) {
|
||||
tcflush(modem->fd, TCIOFLUSH);
|
||||
modem_Unraw(modem);
|
||||
modem_LogicalClose(modem);
|
||||
@ -875,7 +825,7 @@ modem_DescriptorWrite(struct descriptor *d, struct bundle *bundle,
|
||||
LogPrintf(LogERROR, "modem write (%d): %s\n", modem->fd,
|
||||
strerror(errno));
|
||||
modem_Hangup(modem, 0);
|
||||
bundle_LinkLost(bundle, &modem->link, 0);
|
||||
bundle_LinkLost(bundle, modem, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -884,17 +834,40 @@ modem_DescriptorWrite(struct descriptor *d, struct bundle *bundle,
|
||||
int
|
||||
modem_ShowStatus(struct cmdargs const *arg)
|
||||
{
|
||||
const char *dev;
|
||||
struct physical *modem = arg->cx->physical;
|
||||
#ifdef TIOCOUTQ
|
||||
int nb;
|
||||
#endif
|
||||
|
||||
dev = *modem->name.full ?
|
||||
modem->name.full : "stdin";
|
||||
prompt_Printf(arg->prompt, "Name: %s\n", modem->link.name);
|
||||
prompt_Printf(arg->prompt, " State: ");
|
||||
if (modem->fd >= 0)
|
||||
if (isatty(modem->fd))
|
||||
prompt_Printf(arg->prompt, "open, %s carrier\n",
|
||||
Online(modem) ? "with" : "no");
|
||||
else
|
||||
prompt_Printf(arg->prompt, "open\n");
|
||||
else
|
||||
prompt_Printf(arg->prompt, "closed\n");
|
||||
prompt_Printf(arg->prompt, " Device: %s\n",
|
||||
*modem->name.full ? modem->name.full :
|
||||
modem->type == PHYS_STDIN ? "stdin" : "N/A");
|
||||
|
||||
prompt_Printf(arg->prompt, "device list: %s\n", modem->cfg.devlist);
|
||||
prompt_Printf(arg->prompt, "device: %s\n ", dev);
|
||||
prompt_Printf(arg->prompt, " Link Type: %s\n", mode2Nam(modem->type));
|
||||
prompt_Printf(arg->prompt, " Connect Count: %d\n",
|
||||
modem->connect_count);
|
||||
#ifdef TIOCOUTQ
|
||||
if (modem->fd >= 0 && ioctl(modem->fd, TIOCOUTQ, &nb) >= 0)
|
||||
prompt_Printf(arg->prompt, " Physical outq: %d\n", nb);
|
||||
#endif
|
||||
|
||||
prompt_Printf(arg->prompt, " Queued Packets: %d\n",
|
||||
link_QueueLen(&modem->link));
|
||||
prompt_Printf(arg->prompt, " Phone Number: %s\n", arg->cx->phone.chosen);
|
||||
|
||||
prompt_Printf(arg->prompt, "\nDefaults:\n");
|
||||
prompt_Printf(arg->prompt, " Device List: %s\n", modem->cfg.devlist);
|
||||
prompt_Printf(arg->prompt, " Characteristics: ");
|
||||
if (Physical_IsSync(arg->cx->physical))
|
||||
prompt_Printf(arg->prompt, "sync");
|
||||
else
|
||||
@ -919,25 +892,6 @@ modem_ShowStatus(struct cmdargs const *arg)
|
||||
prompt_Printf(arg->prompt, ", CTS/RTS %s\n",
|
||||
(modem->cfg.rts_cts ? "on" : "off"));
|
||||
|
||||
if (LogIsKept(LogDEBUG))
|
||||
prompt_Printf(arg->prompt, "fd = %d, modem control = %o\n",
|
||||
modem->fd, modem->mbits);
|
||||
prompt_Printf(arg->prompt, "connect count: %d\n",
|
||||
modem->connect_count);
|
||||
#ifdef TIOCOUTQ
|
||||
if (modem->fd >= 0)
|
||||
if (ioctl(modem->fd, TIOCOUTQ, &nb) >= 0)
|
||||
prompt_Printf(arg->prompt, "outq: %d\n", nb);
|
||||
else
|
||||
prompt_Printf(arg->prompt, "outq: ioctl probe failed: %s\n", strerror(errno));
|
||||
#endif
|
||||
prompt_Printf(arg->prompt, "outq packets: %d\n",
|
||||
link_QueueLen(&modem->link));
|
||||
prompt_Printf(arg->prompt, "Dial Script: %s\n", arg->cx->cfg.script.dial);
|
||||
prompt_Printf(arg->prompt, "Login Script: %s\n", arg->cx->cfg.script.login);
|
||||
prompt_Printf(arg->prompt, "Hangup Script: %s\n", arg->cx->cfg.script.hangup);
|
||||
prompt_Printf(arg->prompt, "Phone List: %s\n", arg->cx->cfg.phone.list);
|
||||
prompt_Printf(arg->prompt, "Phone Number: %s\n", arg->cx->phone.chosen);
|
||||
|
||||
prompt_Printf(arg->prompt, "\n");
|
||||
throughput_disp(&modem->link.throughput, arg->prompt);
|
||||
@ -957,8 +911,6 @@ int LogIsKept(int garble) { return 0; }
|
||||
int Physical_IsSync(struct physical *phys) {return 0;}
|
||||
int DoChat(struct physical *a, char *b) {return 0;}
|
||||
|
||||
int mode;
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
@ -974,15 +926,15 @@ modem_DescriptorRead(struct descriptor *d, struct bundle *bundle,
|
||||
nointr_usleep(10000);
|
||||
|
||||
n = Physical_Read(p, rbuff, sizeof rbuff);
|
||||
if ((mode & MODE_DIRECT) && n <= 0) {
|
||||
if (p->type == PHYS_STDIN && n <= 0) {
|
||||
modem_Hangup(p, 0);
|
||||
bundle_LinkLost(bundle, &p->link, 1);
|
||||
bundle_LinkLost(bundle, p, 1);
|
||||
} else
|
||||
LogDumpBuff(LogASYNC, "ReadFromModem", rbuff, n);
|
||||
|
||||
if (p->link.lcp.fsm.state <= ST_CLOSED) {
|
||||
/* In dedicated mode, we just discard input until LCP is started */
|
||||
if (!(mode & MODE_DEDICATED)) {
|
||||
/* In -dedicated mode, we just discard input until LCP is started */
|
||||
if (p->type != PHYS_DEDICATED) {
|
||||
cp = HdlcDetect(p, rbuff, n);
|
||||
if (cp) {
|
||||
/* LCP packet is detected. Turn ourselves into packet mode */
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: modem.h,v 1.16.2.13 1998/04/03 19:21:42 brian Exp $
|
||||
* $Id: modem.h,v 1.16.2.14 1998/04/07 00:54:10 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -27,7 +27,7 @@ struct ccp;
|
||||
struct cmdargs;
|
||||
|
||||
extern int modem_Raw(struct physical *, struct bundle *);
|
||||
extern struct physical *modem_Create(struct datalink *);
|
||||
extern struct physical *modem_Create(struct datalink *, int);
|
||||
extern int modem_Open(struct physical *, struct bundle *);
|
||||
extern int modem_Speed(struct physical *);
|
||||
extern speed_t IntToSpeed(int);
|
||||
|
@ -16,7 +16,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: physical.c,v 1.1.2.21 1998/04/06 09:12:34 brian Exp $
|
||||
* $Id: physical.c,v 1.1.2.22 1998/04/07 00:54:13 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -76,18 +76,6 @@ Physical_IsSync(struct physical *phys) {
|
||||
return phys->cfg.speed == 0;
|
||||
}
|
||||
|
||||
int
|
||||
Physical_FD_ISSET(struct physical *phys, fd_set *set) {
|
||||
return phys->fd >= 0 && FD_ISSET(phys->fd, set);
|
||||
}
|
||||
|
||||
void
|
||||
Physical_FD_SET(struct physical *phys, fd_set *set) {
|
||||
assert(phys->fd >= 0);
|
||||
FD_SET(phys->fd, set);
|
||||
}
|
||||
|
||||
|
||||
const char *Physical_GetDevice(struct physical *phys)
|
||||
{
|
||||
return phys->name.full;
|
||||
@ -125,31 +113,6 @@ Physical_SetRtsCts(struct physical *phys, int enable) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
Physical_SetDedicated(struct physical *phys, int enable) {
|
||||
assert(enable == 0 || enable == 1);
|
||||
|
||||
phys->cfg.is_dedicated = enable;
|
||||
}
|
||||
|
||||
void
|
||||
Physical_SetDirect(struct physical *phys, int enable) {
|
||||
assert(enable == 0 || enable == 1);
|
||||
|
||||
phys->cfg.is_direct = enable;
|
||||
}
|
||||
|
||||
int
|
||||
Physical_IsDirect(struct physical *phys) {
|
||||
return phys->cfg.is_direct;
|
||||
}
|
||||
|
||||
int
|
||||
Physical_IsDedicated(struct physical *phys) {
|
||||
return phys->cfg.is_dedicated;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Physical_DupAndClose(struct physical *phys) {
|
||||
int nmodem;
|
||||
@ -209,7 +172,7 @@ Physical_IsSet(struct descriptor *d, const fd_set *fdset)
|
||||
void
|
||||
Physical_Login(struct physical *phys, const char *name)
|
||||
{
|
||||
if ((mode & MODE_DIRECT) && Physical_IsATTY(phys) && Enabled(ConfUtmp))
|
||||
if (phys->type == PHYS_STDIN && Physical_IsATTY(phys) && Enabled(ConfUtmp))
|
||||
if (phys->Utmp)
|
||||
LogPrintf(LogERROR, "Oops, already logged in on %s\n", phys->name.base);
|
||||
else {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: physical.h,v 1.1.2.18 1998/04/03 19:21:50 brian Exp $
|
||||
* $Id: physical.h,v 1.1.2.19 1998/04/07 00:54:14 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -25,6 +25,7 @@ struct bundle;
|
||||
struct physical {
|
||||
struct link link;
|
||||
struct descriptor desc;
|
||||
int type; /* What sort of link are we ? */
|
||||
struct async async; /* Our async state */
|
||||
struct hdlc hdlc; /* Our hdlc state */
|
||||
int fd; /* File descriptor for this device */
|
||||
@ -49,8 +50,6 @@ struct physical {
|
||||
belong in the generic physical struct. It comes from modem.c. */
|
||||
|
||||
struct {
|
||||
unsigned is_dedicated : 1; /* Dedicated mode? XXX-ML - not yet used */
|
||||
unsigned is_direct : 1; /* Direct mode? XXX-ML - not yet used */
|
||||
unsigned rts_cts : 1; /* Is rts/cts enabled? */
|
||||
unsigned parity; /* What parity is enabled? (TTY flags) */
|
||||
unsigned speed; /* Modem speed */
|
||||
@ -74,8 +73,6 @@ struct physical {
|
||||
int Physical_GetFD(struct physical *);
|
||||
int Physical_IsATTY(struct physical *);
|
||||
int Physical_IsSync(struct physical *);
|
||||
int Physical_IsDedicated(struct physical *);
|
||||
int Physical_IsDirect(struct physical *);
|
||||
const char *Physical_GetDevice(struct physical *);
|
||||
|
||||
|
||||
@ -91,12 +88,6 @@ int /* Can this be set? (Might not be a relevant attribute for this
|
||||
device, for instance) */
|
||||
Physical_SetRtsCts(struct physical *, int);
|
||||
|
||||
void Physical_SetDedicated(struct physical *, int);
|
||||
void Physical_SetDirect(struct physical *, int);
|
||||
|
||||
void Physical_FD_SET(struct physical *, fd_set *);
|
||||
int Physical_FD_ISSET(struct physical *, fd_set *);
|
||||
|
||||
void Physical_DupAndClose(struct physical *);
|
||||
ssize_t Physical_Read(struct physical *, void *, size_t);
|
||||
ssize_t Physical_Write(struct physical *, const void *, size_t);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.97.2.12 1998/04/03 19:26:26 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.97.2.13 1998/04/05 22:48:25 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -1685,8 +1685,10 @@ of a loopback route.
|
||||
Default: Disabled. This option allows the use of Microsoft's
|
||||
.Em PPP
|
||||
extensions, supporting the negotiation of the DNS and the NetBIOS NS.
|
||||
Enabling this allows us to pass back the values given in "set ns"
|
||||
and "set nbns".
|
||||
Enabling this allows us to pass back the values given in
|
||||
.Dq set ns
|
||||
and
|
||||
.Dq set nbns .
|
||||
.It passwdauth
|
||||
Default: Disabled. Enabling this option will tell the PAP authentication
|
||||
code to use the password file (see
|
||||
@ -1842,6 +1844,10 @@ Possible modes are:
|
||||
.Sq background
|
||||
and
|
||||
.Sq * .
|
||||
.Pp
|
||||
When running in multilink mode, a section can be loaded if it allows
|
||||
.Em any
|
||||
of the currently existing line modes.
|
||||
.El
|
||||
.Pp
|
||||
.It alias Ar command Op Ar args
|
||||
@ -2417,7 +2423,7 @@ will be negotiated. It is only available in
|
||||
mode.
|
||||
.It set ns Ar x.x.x.x Op Ar y.y.y.y
|
||||
This option allows the setting of the Microsoft DNS servers that
|
||||
will be negotiated. It is only available in
|
||||
will be negotiated. It is only used in
|
||||
.Fl direct
|
||||
mode.
|
||||
.It set openmode active|passive Op Ar delay
|
||||
@ -2614,7 +2620,7 @@ Give a summary of available show commands.
|
||||
Show the current IPCP statistics.
|
||||
.It show lcp
|
||||
Show the current LCP statistics.
|
||||
.It show link Op Ar name
|
||||
.It show [data]link Op Ar name
|
||||
Show link information.
|
||||
.It show log
|
||||
Show the current log values.
|
||||
@ -2626,10 +2632,6 @@ Show current modem statistics.
|
||||
Show the current Microsoft extension values.
|
||||
.It show proto
|
||||
Show current protocol totals.
|
||||
.It show reconnect
|
||||
Show the current reconnect values.
|
||||
.It show redial
|
||||
Show the current redial values.
|
||||
.It show route
|
||||
Show the current routing tables.
|
||||
.It show stopped
|
||||
|
@ -23,13 +23,14 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prompt.c,v 1.1.2.23 1998/04/07 23:46:06 brian Exp $
|
||||
* $Id: prompt.c,v 1.1.2.24 1998/04/08 18:27:29 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
@ -170,9 +171,6 @@ prompt_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
static int ttystate;
|
||||
char linebuff[LINE_LEN];
|
||||
|
||||
LogPrintf(LogDEBUG, "termode = %p, p->fd_in = %d, mode = %d\n",
|
||||
p->TermMode, p->fd_in, mode);
|
||||
|
||||
if (p->TermMode == NULL) {
|
||||
n = read(p->fd_in, linebuff, sizeof linebuff - 1);
|
||||
if (n > 0) {
|
||||
@ -183,8 +181,7 @@ prompt_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
p->nonewline = 1; /* Maybe DecodeCommand does a prompt */
|
||||
prompt_Required(p);
|
||||
if (n)
|
||||
DecodeCommand(bundle, linebuff, n, p,
|
||||
(mode & MODE_INTER) ? NULL : "Client");
|
||||
DecodeCommand(bundle, linebuff, n, p, p->src.from);
|
||||
} else if (n <= 0) {
|
||||
LogPrintf(LogPHASE, "Client connection closed.\n");
|
||||
prompt_Destroy(p, 0);
|
||||
@ -292,14 +289,17 @@ prompt_Create(struct server *s, struct bundle *bundle, int fd)
|
||||
p->Term = stdout;
|
||||
p->owner = NULL;
|
||||
p->auth = LOCAL_AUTH;
|
||||
snprintf(p->who, sizeof p->who, "Controller (%s)", ttyname(p->fd_out));
|
||||
p->src.type = "Controller";
|
||||
strncpy(p->src.from, ttyname(p->fd_out), sizeof p->src.from - 1);
|
||||
p->src.from[sizeof p->src.from - 1] = '\0';
|
||||
tcgetattr(p->fd_in, &p->oldtio); /* Save original tty mode */
|
||||
} else {
|
||||
p->fd_in = p->fd_out = fd;
|
||||
p->Term = fdopen(fd, "a+");
|
||||
p->owner = s;
|
||||
p->auth = *s->passwd ? LOCAL_NO_AUTH : LOCAL_AUTH;
|
||||
*p->who = '\0';
|
||||
p->src.type = "unknown";
|
||||
*p->src.from = '\0';
|
||||
}
|
||||
p->TermMode = NULL;
|
||||
p->nonewline = 1;
|
||||
@ -315,14 +315,6 @@ prompt_Create(struct server *s, struct bundle *bundle, int fd)
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
prompt_DestroyUnclean(struct prompt *p)
|
||||
{
|
||||
log_UnRegisterPrompt(p);
|
||||
bundle_UnRegisterDescriptor(p->bundle, &p->desc);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void
|
||||
prompt_Destroy(struct prompt *p, int verbose)
|
||||
{
|
||||
@ -336,7 +328,9 @@ prompt_Destroy(struct prompt *p, int verbose)
|
||||
} else
|
||||
prompt_TtyOldMode(p);
|
||||
|
||||
prompt_DestroyUnclean(p);
|
||||
log_UnRegisterPrompt(p);
|
||||
bundle_UnRegisterDescriptor(p->bundle, &p->desc);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void
|
||||
@ -363,32 +357,34 @@ prompt_vPrintf(struct prompt *p, const char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
void
|
||||
prompt_TtyInit(struct prompt *p, int DontWantInt)
|
||||
prompt_TtyInit(struct prompt *p)
|
||||
{
|
||||
int stat;
|
||||
int stat, fd = p ? p->fd_in : STDIN_FILENO;
|
||||
struct termios newtio;
|
||||
|
||||
stat = fcntl(p->fd_in, F_GETFL, 0);
|
||||
stat = fcntl(fd, F_GETFL, 0);
|
||||
if (stat > 0) {
|
||||
stat |= O_NONBLOCK;
|
||||
fcntl(p->fd_in, F_SETFL, stat);
|
||||
fcntl(fd, F_SETFL, stat);
|
||||
}
|
||||
|
||||
if (p->Term == stdout) {
|
||||
struct termios newtio;
|
||||
|
||||
if (p)
|
||||
newtio = p->oldtio;
|
||||
newtio.c_lflag &= ~(ECHO | ISIG | ICANON);
|
||||
newtio.c_iflag = 0;
|
||||
newtio.c_oflag &= ~OPOST;
|
||||
newtio.c_cc[VEOF] = _POSIX_VDISABLE;
|
||||
if (DontWantInt)
|
||||
newtio.c_cc[VINTR] = _POSIX_VDISABLE;
|
||||
newtio.c_cc[VMIN] = 1;
|
||||
newtio.c_cc[VTIME] = 0;
|
||||
newtio.c_cflag |= CS8;
|
||||
tcsetattr(p->fd_in, TCSANOW, &newtio);
|
||||
else
|
||||
tcgetattr(fd, &newtio);
|
||||
|
||||
newtio.c_lflag &= ~(ECHO | ISIG | ICANON);
|
||||
newtio.c_iflag = 0;
|
||||
newtio.c_oflag &= ~OPOST;
|
||||
newtio.c_cc[VEOF] = _POSIX_VDISABLE;
|
||||
if (!p)
|
||||
newtio.c_cc[VINTR] = _POSIX_VDISABLE;
|
||||
newtio.c_cc[VMIN] = 1;
|
||||
newtio.c_cc[VTIME] = 0;
|
||||
newtio.c_cflag |= CS8;
|
||||
tcsetattr(fd, TCSANOW, &newtio);
|
||||
if (p)
|
||||
p->comtio = newtio;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prompt.h,v 1.1.2.5 1998/04/05 18:25:34 brian Exp $
|
||||
* $Id: prompt.h,v 1.1.2.6 1998/04/07 00:54:16 brian Exp $
|
||||
*/
|
||||
|
||||
#define LOCAL_AUTH 0x01
|
||||
@ -49,7 +49,10 @@ struct prompt {
|
||||
unsigned needprompt : 1; /* Show a prompt at the next UpdateSet() */
|
||||
unsigned active : 1; /* Is the prompt active (^Z) */
|
||||
|
||||
char who[40]; /* Where do I come from */
|
||||
struct {
|
||||
const char *type; /* Type of connection */
|
||||
char from[40]; /* Source of connection */
|
||||
} src;
|
||||
|
||||
struct prompt *lognext; /* Maintained in log.c */
|
||||
u_long logmask; /* Maintained in log.c */
|
||||
@ -65,13 +68,12 @@ struct prompt {
|
||||
#define PROMPT_STD (-1)
|
||||
extern struct prompt *prompt_Create(struct server *, struct bundle *, int);
|
||||
extern void prompt_Destroy(struct prompt *, int);
|
||||
extern void prompt_DestroyUnclean(struct prompt *);
|
||||
extern void prompt_Required(struct prompt *);
|
||||
extern void prompt_Printf(struct prompt *, const char *, ...);
|
||||
extern void prompt_vPrintf(struct prompt *, const char *, _BSD_VA_LIST_);
|
||||
#define PROMPT_DONT_WANT_INT 1
|
||||
#define PROMPT_WANT_INT 0
|
||||
extern void prompt_TtyInit(struct prompt *, int);
|
||||
extern void prompt_TtyInit(struct prompt *);
|
||||
extern void prompt_TtyCommandMode(struct prompt *);
|
||||
extern void prompt_TtyTermMode(struct prompt *, struct datalink *);
|
||||
extern void prompt_TtyOldMode(struct prompt *);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: server.c,v 1.16.2.13 1998/04/07 00:54:17 brian Exp $
|
||||
* $Id: server.c,v 1.16.2.14 1998/04/07 23:46:09 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -88,8 +88,6 @@ server_IsSet(struct descriptor *d, const fd_set *fdset)
|
||||
#define UN_SIZE sizeof(struct sockaddr_in)
|
||||
#define ADDRSZ (IN_SIZE > UN_SIZE ? IN_SIZE : UN_SIZE)
|
||||
|
||||
static char *rm;
|
||||
|
||||
static void
|
||||
server_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
{
|
||||
@ -135,10 +133,13 @@ server_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
} else {
|
||||
switch (sa->sa_family) {
|
||||
case AF_LOCAL:
|
||||
snprintf(p->who, sizeof p->who, "local (%s)", rm);
|
||||
p->src.type = "local";
|
||||
strncpy(p->src.from, s->rm, sizeof p->src.from - 1);
|
||||
p->src.from[sizeof p->src.from - 1] = '\0';
|
||||
break;
|
||||
case AF_INET:
|
||||
snprintf(p->who, sizeof p->who, "TCP (%s:%u)",
|
||||
p->src.type = "tcp";
|
||||
snprintf(p->src.from, sizeof p->src.from, "%s:%u",
|
||||
inet_ntoa(sin->sin_addr), sin->sin_port);
|
||||
break;
|
||||
}
|
||||
@ -166,21 +167,25 @@ struct server server = {
|
||||
-1
|
||||
};
|
||||
|
||||
static struct sockaddr_un ifsun;
|
||||
|
||||
int
|
||||
ServerLocalOpen(struct bundle *bundle, const char *name, mode_t mask)
|
||||
{
|
||||
int s;
|
||||
|
||||
memset(&ifsun, '\0', sizeof ifsun);
|
||||
ifsun.sun_len = strlen(name);
|
||||
if (ifsun.sun_len > sizeof ifsun.sun_path - 1) {
|
||||
if (server.rm && !strcmp(server.rm, name)) {
|
||||
if (chmod(server.rm, mask))
|
||||
LogPrintf(LogERROR, "Local: chmod: %s\n", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&server.ifsun, '\0', sizeof server.ifsun);
|
||||
server.ifsun.sun_len = strlen(name);
|
||||
if (server.ifsun.sun_len > sizeof server.ifsun.sun_path - 1) {
|
||||
LogPrintf(LogERROR, "Local: %s: Path too long\n", name);
|
||||
return 2;
|
||||
}
|
||||
ifsun.sun_family = AF_LOCAL;
|
||||
strcpy(ifsun.sun_path, name);
|
||||
server.ifsun.sun_family = AF_LOCAL;
|
||||
strcpy(server.ifsun.sun_path, name);
|
||||
|
||||
s = ID0socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
if (s < 0) {
|
||||
@ -190,7 +195,7 @@ ServerLocalOpen(struct bundle *bundle, const char *name, mode_t mask)
|
||||
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &s, sizeof s);
|
||||
if (mask != (mode_t)-1)
|
||||
mask = umask(mask);
|
||||
if (bind(s, (struct sockaddr *)&ifsun, sizeof ifsun) < 0) {
|
||||
if (bind(s, (struct sockaddr *)&server.ifsun, sizeof server.ifsun) < 0) {
|
||||
if (mask != (mode_t)-1)
|
||||
umask(mask);
|
||||
LogPrintf(LogWARN, "Local: bind: %s\n", strerror(errno));
|
||||
@ -207,7 +212,7 @@ ServerLocalOpen(struct bundle *bundle, const char *name, mode_t mask)
|
||||
}
|
||||
ServerClose(bundle);
|
||||
server.fd = s;
|
||||
rm = ifsun.sun_path;
|
||||
server.rm = server.ifsun.sun_path;
|
||||
LogPrintf(LogPHASE, "Listening at local socket %s.\n", name);
|
||||
return 0;
|
||||
}
|
||||
@ -218,6 +223,9 @@ ServerTcpOpen(struct bundle *bundle, int port)
|
||||
struct sockaddr_in ifsin;
|
||||
int s;
|
||||
|
||||
if (server.port == port)
|
||||
return 0;
|
||||
|
||||
s = ID0socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (s < 0) {
|
||||
LogPrintf(LogERROR, "Tcp: socket: %s\n", strerror(errno));
|
||||
@ -240,6 +248,7 @@ ServerTcpOpen(struct bundle *bundle, int port)
|
||||
}
|
||||
ServerClose(bundle);
|
||||
server.fd = s;
|
||||
server.port = port;
|
||||
LogPrintf(LogPHASE, "Listening at port %d.\n", port);
|
||||
return 0;
|
||||
}
|
||||
@ -249,11 +258,12 @@ ServerClose(struct bundle *bundle)
|
||||
{
|
||||
if (server.fd >= 0) {
|
||||
close(server.fd);
|
||||
if (rm) {
|
||||
ID0unlink(rm);
|
||||
rm = 0;
|
||||
if (server.rm) {
|
||||
ID0unlink(server.rm);
|
||||
server.rm = NULL;
|
||||
}
|
||||
server.fd = -1;
|
||||
server.port = 0;
|
||||
/* Drop associated prompts */
|
||||
bundle_DelPromptDescriptors(bundle, &server);
|
||||
return 1;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: server.h,v 1.4.2.2 1998/04/03 19:25:55 brian Exp $
|
||||
* $Id: server.h,v 1.4.2.3 1998/04/07 00:54:18 brian Exp $
|
||||
*/
|
||||
|
||||
struct bundle;
|
||||
@ -32,6 +32,11 @@ struct server {
|
||||
struct descriptor desc;
|
||||
int fd;
|
||||
char passwd[50];
|
||||
|
||||
struct sockaddr_un ifsun; /* local socket */
|
||||
char *rm; /* Points to local socket path */
|
||||
|
||||
u_short port; /* tcp socket */
|
||||
};
|
||||
|
||||
#define server2descriptor(s) (&(s)->desc)
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: systems.c,v 1.35.2.4 1998/04/03 19:25:58 brian Exp $
|
||||
* $Id: systems.c,v 1.35.2.5 1998/04/06 09:12:37 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -157,7 +157,10 @@ DecodeCtrlCommand(char *line, char *arg)
|
||||
return CTRL_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Initialised in ValidSystem(), set in ReadSystem(), used by ValidSystem() */
|
||||
static int modeok;
|
||||
static int userok;
|
||||
static int modereq;
|
||||
|
||||
int
|
||||
AllowUsers(struct cmdargs const *arg)
|
||||
@ -182,17 +185,27 @@ static struct {
|
||||
int mode;
|
||||
const char *name;
|
||||
} modes[] = {
|
||||
{ MODE_INTER, "interactive" },
|
||||
{ MODE_AUTO, "auto" },
|
||||
{ MODE_DIRECT, "direct" },
|
||||
{ MODE_DEDICATED, "dedicated" },
|
||||
{ MODE_DDIAL, "ddial" },
|
||||
{ MODE_BACKGROUND, "background" },
|
||||
{ ~0, "*" },
|
||||
{ PHYS_MANUAL, "interactive" },
|
||||
{ PHYS_DEMAND, "auto" },
|
||||
{ PHYS_STDIN, "direct" },
|
||||
{ PHYS_DEDICATED, "dedicated" },
|
||||
{ PHYS_PERM, "ddial" },
|
||||
{ PHYS_1OFF, "background" },
|
||||
{ PHYS_ALL, "*" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static int modeok;
|
||||
const char *
|
||||
mode2Nam(int mode)
|
||||
{
|
||||
int m;
|
||||
|
||||
for (m = 0; modes[m].mode; m++)
|
||||
if (modes[m].mode == mode)
|
||||
return modes[m].name;
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
int
|
||||
AllowModes(struct cmdargs const *arg)
|
||||
@ -213,7 +226,7 @@ AllowModes(struct cmdargs const *arg)
|
||||
LogPrintf(LogWARN, "allow modes: %s: Invalid mode\n", arg->argv[f]);
|
||||
}
|
||||
|
||||
modeok = (mode | allowed) == allowed ? 1 : 0;
|
||||
modeok = modereq & allowed ? 1 : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -354,7 +367,7 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file,
|
||||
}
|
||||
|
||||
int
|
||||
ValidSystem(const char *name, struct prompt *prompt)
|
||||
ValidSystem(const char *name, struct prompt *prompt, int mode)
|
||||
{
|
||||
/*
|
||||
* Note: The ReadSystem() calls only result in calls to the Allow*
|
||||
@ -364,6 +377,7 @@ ValidSystem(const char *name, struct prompt *prompt)
|
||||
return userok = modeok = 1;
|
||||
userok = 0;
|
||||
modeok = 1;
|
||||
modereq = mode;
|
||||
ReadSystem(NULL, "default", CONFFILE, 0, prompt);
|
||||
if (name != NULL)
|
||||
ReadSystem(NULL, name, CONFFILE, 0, prompt);
|
||||
@ -375,33 +389,6 @@ SelectSystem(struct bundle *bundle, const char *name, const char *file,
|
||||
struct prompt *prompt)
|
||||
{
|
||||
userok = modeok = 1;
|
||||
modereq = PHYS_ALL;
|
||||
return ReadSystem(bundle, name, file, 1, prompt);
|
||||
}
|
||||
|
||||
int
|
||||
LoadCommand(struct cmdargs const *arg)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (arg->argc > 0)
|
||||
name = *arg->argv;
|
||||
else
|
||||
name = "default";
|
||||
|
||||
if (!ValidSystem(name, arg->prompt)) {
|
||||
LogPrintf(LogERROR, "%s: Label not allowed\n", name);
|
||||
return 1;
|
||||
} else if (SelectSystem(arg->bundle, name, CONFFILE, arg->prompt) < 0) {
|
||||
LogPrintf(LogWARN, "%s: label not found.\n", name);
|
||||
return -1;
|
||||
} else
|
||||
SetLabel(arg->argc ? name : NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SaveCommand(struct cmdargs const *arg)
|
||||
{
|
||||
LogPrintf(LogWARN, "save command is not implemented (yet).\n");
|
||||
return 1;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: systems.h,v 1.10.2.2 1998/04/03 19:25:59 brian Exp $
|
||||
* $Id: systems.h,v 1.10.2.3 1998/04/07 00:54:21 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -27,10 +27,11 @@ struct cmdargs;
|
||||
|
||||
extern int SelectSystem(struct bundle *bundle, const char *, const char *,
|
||||
struct prompt *);
|
||||
extern int ValidSystem(const char *, struct prompt *);
|
||||
extern int ValidSystem(const char *, struct prompt *, int);
|
||||
extern FILE *OpenSecret(const char *);
|
||||
extern void CloseSecret(FILE *);
|
||||
extern int AllowUsers(struct cmdargs const *);
|
||||
extern int AllowModes(struct cmdargs const *);
|
||||
extern int LoadCommand(struct cmdargs const *);
|
||||
extern int SaveCommand(struct cmdargs const *);
|
||||
extern const char *mode2Nam(int);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: throughput.c,v 1.4.4.4 1998/04/06 09:12:37 brian Exp $
|
||||
* $Id: throughput.c,v 1.4.4.5 1998/04/07 00:54:21 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -49,6 +49,7 @@ throughput_init(struct pppThroughput *t)
|
||||
t->SampleOctets[f] = 0;
|
||||
t->OctetsPerSecond = t->BestOctetsPerSecond = t->nSample = 0;
|
||||
t->Timer.name = "throughput";
|
||||
t->uptime = 0;
|
||||
throughput_stop(t);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user