o Move default MRU, MTU, ACCMAP and OPENMODE config values into

struct lcp and display them in `show lcp'.
o Remove `show mru' and `show mtu' and make the data part of
  `show lcp'.  Also merge `set m[tr]u' and `set openmode'
  implementations into the SetVariable function.
o `set timeout' only accepts the idle timer value as an argument.
o Move our lqr period into struct lcp, and create a `set lqrperiod'
  command.  Display it in `show lcp'.
o Remove VarRetryTimeout, and implement it at the LCP, PAP, CHAP,
  CCP and IPCP levels, creating individual `set XXXretry' commands
  for each.  They must be separate because they have different
  context requirements in multilink mode.
o Display default config values in `show ccp'.
o Tart the man page up a bit (wrt PPP/TCP, compression and LQR) and
  explain the new commands.
This commit is contained in:
Brian Somers 1998-04-03 19:24:07 +00:00
parent 3b0f8d2ed6
commit cd9647a100
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35010
16 changed files with 341 additions and 230 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.c,v 1.27.2.15 1998/03/16 22:53:28 brian Exp $
* $Id: auth.c,v 1.27.2.16 1998/04/03 19:21:06 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@ -254,6 +254,7 @@ void
authinfo_Init(struct authinfo *authinfo)
{
memset(authinfo, '\0', sizeof(struct authinfo));
authinfo->cfg.fsmretry = DEF_FSMRETRY;
}
void
@ -265,7 +266,7 @@ StartAuthChallenge(struct authinfo *authp, struct physical *physical,
StopTimer(&authp->authtimer);
authp->authtimer.func = AuthTimeout;
authp->authtimer.name = "auth";
authp->authtimer.load = VarRetryTimeout * SECTICKS;
authp->authtimer.load = authp->cfg.fsmretry * SECTICKS;
authp->authtimer.state = TIMER_STOPPED;
authp->authtimer.arg = (void *) authp;
authp->retry = 3;

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.h,v 1.10.2.3 1998/02/07 20:49:20 brian Exp $
* $Id: auth.h,v 1.10.2.4 1998/03/01 01:07:38 brian Exp $
*
* TODO:
*/
@ -34,6 +34,9 @@ struct authinfo {
int retry;
int id;
struct physical *physical;
struct {
u_int fsmretry;
} cfg;
};
extern void authinfo_Init(struct authinfo *);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ccp.c,v 1.30.2.28 1998/03/24 18:46:37 brian Exp $
* $Id: ccp.c,v 1.30.2.29 1998/04/03 19:21:08 brian Exp $
*
* TODO:
* o Support other compression protocols
@ -135,15 +135,22 @@ static const struct ccp_algorithm *algorithm[] = {
int
ccp_ReportStatus(struct cmdargs const *arg)
{
struct ccp *ccp = &ChooseLink(arg)->ccp;
struct link *l = ChooseLink(arg);
struct ccp *ccp = &l->ccp;
prompt_Printf(&prompt, "%s [%s]\n", ccp->fsm.name,
prompt_Printf(&prompt, "%s: %s [%s]\n", l->name, ccp->fsm.name,
State2Nam(ccp->fsm.state));
prompt_Printf(&prompt, "My protocol = %s, His protocol = %s\n",
prompt_Printf(&prompt, " My protocol = %s, His protocol = %s\n",
protoname(ccp->my_proto), protoname(ccp->his_proto));
prompt_Printf(&prompt, "Output: %ld --> %ld, Input: %ld --> %ld\n",
prompt_Printf(&prompt, " Output: %ld --> %ld, Input: %ld --> %ld\n",
ccp->uncompout, ccp->compout,
ccp->compin, ccp->uncompin);
prompt_Printf(&prompt, "\n Defaults: ");
prompt_Printf(&prompt, "deflate windows: ");
prompt_Printf(&prompt, "incoming = %d, ", ccp->cfg.deflate.in.winsize);
prompt_Printf(&prompt, "outgoing = %d\n", ccp->cfg.deflate.out.winsize);
prompt_Printf(&prompt, " FSM retry = %us\n", ccp->cfg.fsmretry);
return 0;
}
@ -157,8 +164,11 @@ ccp_Init(struct ccp *ccp, struct bundle *bundle, struct link *l,
fsm_Init(&ccp->fsm, "CCP", PROTO_CCP, 1, CCP_MAXCODE, 10, LogCCP,
bundle, l, parent, &ccp_Callbacks, timer_names);
ccp->cfg.deflate.in.winsize = 0;
ccp->cfg.deflate.out.winsize = 15;
ccp->cfg.fsmretry = DEF_FSMRETRY;
ccp_Setup(ccp);
}
@ -183,7 +193,9 @@ static void
CcpInitRestartCounter(struct fsm *fp)
{
/* Set fsm timer load */
fp->FsmTimer.load = VarRetryTimeout * SECTICKS;
struct ccp *ccp = fsm2ccp(fp);
fp->FsmTimer.load = ccp->cfg.fsmretry * SECTICKS;
fp->restart = 5;
}

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ccp.h,v 1.14.2.13 1998/03/17 22:29:03 brian Exp $
* $Id: ccp.h,v 1.14.2.14 1998/04/03 19:21:09 brian Exp $
*
* TODO:
*/
@ -41,6 +41,7 @@ struct ccp_config {
int winsize;
} in, out;
} deflate;
u_int fsmretry; /* FSM retry frequency */
};
struct ccp_opt {

View File

@ -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.43 1998/03/24 18:46:43 brian Exp $
* $Id: command.c,v 1.131.2.44 1998/04/03 19:21:13 brian Exp $
*
*/
#include <sys/param.h>
@ -437,12 +437,10 @@ ShowTimeout(struct cmdargs const *arg)
{
int remaining;
prompt_Printf(&prompt, " Idle Timer: %d secs LQR Timer: %d secs"
" Retry Timer: %d secs\n", arg->bundle->cfg.idle_timeout,
VarLqrTimeout, VarRetryTimeout);
prompt_Printf(&prompt, "Idle Timer: %ds\n", arg->bundle->cfg.idle_timeout);
remaining = bundle_RemainingIdleTime(arg->bundle);
if (remaining != -1)
prompt_Printf(&prompt, " %d secs remaining\n", remaining);
prompt_Printf(&prompt, "Remaining: %ds\n", remaining);
return 0;
}
@ -494,27 +492,13 @@ ShowVersion(struct cmdargs const *arg)
return 0;
}
static int
ShowInitialMRU(struct cmdargs const *arg)
{
prompt_Printf(&prompt, " Initial MRU: %d\n", VarMRU);
return 0;
}
static int
ShowPreferredMTU(struct cmdargs const *arg)
{
if (VarPrefMTU)
prompt_Printf(&prompt, " Preferred MTU: %d\n", VarPrefMTU);
else
prompt_Printf(&prompt, " Preferred MTU: unspecified\n");
return 0;
}
int
ShowProtocolStats(struct cmdargs const *arg)
{
link_ReportProtocolStatus(ChooseLink(arg));
struct link *l = ChooseLink(arg);
prompt_Printf(&prompt, "%s:\n", l->name);
link_ReportProtocolStatus(l);
return 0;
}
@ -599,14 +583,10 @@ static struct cmdtab const ShowCommands[] = {
"Show memory map", "show mem"},
{"modem", NULL, modem_ShowStatus, LOCAL_AUTH | LOCAL_CX,
"Show modem setups", "show modem"},
{"mru", NULL, ShowInitialMRU, LOCAL_AUTH,
"Show Initial MRU", "show mru"},
#ifndef NOMSEXT
{"msext", NULL, ShowMSExt, LOCAL_AUTH,
"Show MS PPP extentions", "show msext"},
#endif
{"mtu", NULL, ShowPreferredMTU, LOCAL_AUTH,
"Show Preferred MTU", "show mtu"},
{"proto", NULL, ShowProtocolStats, LOCAL_AUTH | LOCAL_CX_OPT,
"Show protocol summary", "show proto"},
{"reconnect", NULL, ShowReconnect, LOCAL_AUTH | LOCAL_CX,
@ -1109,71 +1089,6 @@ SetEscape(struct cmdargs const *arg)
return 0;
}
static int
SetInitialMRU(struct cmdargs const *arg)
{
long mru;
const char *err;
if (arg->argc > 0) {
mru = atol(*arg->argv);
if (mru < MIN_MRU)
err = "Given MRU value (%ld) is too small.\n";
else if (mru > MAX_MRU)
err = "Given MRU value (%ld) is too big.\n";
else {
VarMRU = mru;
return 0;
}
LogPrintf(LogWARN, err, mru);
}
return -1;
}
static int
SetPreferredMTU(struct cmdargs const *arg)
{
long mtu;
const char *err;
if (arg->argc > 0) {
mtu = atol(*arg->argv);
if (mtu == 0) {
VarPrefMTU = 0;
return 0;
} else if (mtu < MIN_MTU)
err = "Given MTU value (%ld) is too small.\n";
else if (mtu > MAX_MTU)
err = "Given MTU value (%ld) is too big.\n";
else {
VarPrefMTU = mtu;
return 0;
}
LogPrintf(LogWARN, err, mtu);
}
return -1;
}
static int
SetTimeout(struct cmdargs const *arg)
{
if (arg->argc > 0) {
bundle_SetIdleTimer(arg->bundle, atoi(arg->argv[0]));
if (arg->argc > 1) {
VarLqrTimeout = atoi(arg->argv[1]);
if (VarLqrTimeout < 1)
VarLqrTimeout = 30;
if (arg->argc > 2) {
VarRetryTimeout = atoi(arg->argv[2]);
if (VarRetryTimeout < 1 || VarRetryTimeout > 10)
VarRetryTimeout = 3;
}
}
return 0;
}
return -1;
}
static struct in_addr
GetIpAddr(const char *cp)
{
@ -1292,10 +1207,12 @@ SetNBNS(struct cmdargs const *arg)
static int
SetVariable(struct cmdargs const *arg)
{
u_long map;
u_long ulong_val;
const char *argp;
int param = (int)arg->cmd->args;
struct datalink *cx = arg->cx;
struct datalink *cx = arg->cx; /* AUTH_CX uses this */
const char *err = NULL;
struct link *l = ChooseLink(arg); /* AUTH_CX_OPT uses this */
if (arg->argc > 0)
argp = *arg->argv;
@ -1335,8 +1252,6 @@ SetVariable(struct cmdargs const *arg)
break;
case VAR_WINSIZE:
if (arg->argc > 0) {
struct link *l = ChooseLink(arg);
l->ccp.cfg.deflate.out.winsize = atoi(arg->argv[0]);
if (l->ccp.cfg.deflate.out.winsize < 8 ||
l->ccp.cfg.deflate.out.winsize > 15) {
@ -1354,14 +1269,57 @@ SetVariable(struct cmdargs const *arg)
}
} else
l->ccp.cfg.deflate.in.winsize = 0;
} else {
err = "No window size specified\n";
LogPrintf(LogWARN, err);
}
break;
case VAR_DEVICE:
Physical_SetDeviceList(cx->physical, argp);
break;
case VAR_ACCMAP:
sscanf(argp, "%lx", &map);
VarAccmap = map;
if (arg->argc > 0) {
sscanf(argp, "%lx", &ulong_val);
cx->physical->link.lcp.cfg.accmap = ulong_val;
} else {
err = "No accmap specified\n";
LogPrintf(LogWARN, err);
}
break;
case VAR_MRU:
ulong_val = atol(argp);
if (ulong_val < MIN_MRU)
err = "Given MRU value (%lu) is too small.\n";
else if (ulong_val > MAX_MRU)
err = "Given MRU value (%lu) is too big.\n";
else
l->lcp.cfg.mru = ulong_val;
if (err)
LogPrintf(LogWARN, err, ulong_val);
break;
case VAR_MTU:
ulong_val = atol(argp);
if (ulong_val == 0)
l->lcp.cfg.mtu = 0;
else if (ulong_val < MIN_MTU)
err = "Given MTU value (%lu) is too small.\n";
else if (ulong_val > MAX_MTU)
err = "Given MTU value (%lu) is too big.\n";
else
l->lcp.cfg.mtu = ulong_val;
if (err)
LogPrintf(LogWARN, err, ulong_val);
break;
case VAR_OPENMODE:
if (strcasecmp(argp, "active") == 0)
cx->physical->link.lcp.cfg.openmode = arg->argc > 1 ?
atoi(arg->argv[1]) : 1;
else if (strcasecmp(argp, "passive") == 0)
cx->physical->link.lcp.cfg.openmode = OPEN_PASSIVE;
else {
err = "%s: Invalid openmode\n";
LogPrintf(LogWARN, err, argp);
}
break;
case VAR_PHONE:
strncpy(cx->cfg.phone.list, argp, sizeof cx->cfg.phone.list - 1);
@ -1373,13 +1331,78 @@ SetVariable(struct cmdargs const *arg)
cx->cfg.script.hangup[sizeof cx->cfg.script.hangup - 1] = '\0';
}
break;
#ifdef HAVE_DES
case VAR_ENC:
VarMSChap = !strcasecmp(argp, "mschap");
break;
#ifdef HAVE_DES
if (!strcasecmp(argp, "mschap"))
VarMSChap = 1;
else
#endif
if (!strcasecmp(argp, "md5"))
VarMSChap = 0;
else {
err = "%s: Invalid CHAP encryption method\n";
LogPrintf(LogWARN, err, argp);
}
break;
case VAR_IDLETIMEOUT:
if (arg->argc > 1)
err = "Too many idle timeout values";
else if (arg->argc == 1)
bundle_SetIdleTimer(arg->bundle, atoi(argp));
if (err)
LogPrintf(LogWARN, err);
break;
case VAR_LQRPERIOD:
ulong_val = atol(argp);
if (ulong_val <= 0) {
err = "%s: Invalid lqr period\n";
LogPrintf(LogWARN, err, argp);
} else
l->lcp.cfg.lqrperiod = ulong_val;
break;
case VAR_LCPRETRY:
ulong_val = atol(argp);
if (ulong_val <= 0) {
err = "%s: Invalid LCP FSM retry period\n";
LogPrintf(LogWARN, err, argp);
} else
cx->physical->link.lcp.cfg.fsmretry = ulong_val;
break;
case VAR_CHAPRETRY:
ulong_val = atol(argp);
if (ulong_val <= 0) {
err = "%s: Invalid CHAP retry period\n";
LogPrintf(LogWARN, err, argp);
} else
cx->chap.auth.cfg.fsmretry = ulong_val;
break;
case VAR_PAPRETRY:
ulong_val = atol(argp);
if (ulong_val <= 0) {
err = "%s: Invalid PAP retry period\n";
LogPrintf(LogWARN, err, argp);
} else
cx->pap.cfg.fsmretry = ulong_val;
break;
case VAR_CCPRETRY:
ulong_val = atol(argp);
if (ulong_val <= 0) {
err = "%s: Invalid CCP FSM retry period\n";
LogPrintf(LogWARN, err, argp);
} else
l->ccp.cfg.fsmretry = ulong_val;
break;
case VAR_IPCPRETRY:
ulong_val = atol(argp);
if (ulong_val <= 0) {
err = "%s: Invalid IPCP FSM retry period\n";
LogPrintf(LogWARN, err, argp);
} else
arg->bundle->ncp.ipcp.cfg.fsmretry = ulong_val;
break;
}
return 0;
return err ? 1 : 0;
}
static int
@ -1402,31 +1425,15 @@ SetCtsRts(struct cmdargs const *arg)
return -1;
}
static int
SetOpenMode(struct cmdargs const *arg)
{
if (arg->argc > 0) {
if (strcasecmp(*arg->argv, "active") == 0)
VarOpenMode = arg->argc > 1 ? atoi(arg->argv[1]) : 1;
else if (strcasecmp(*arg->argv, "passive") == 0)
VarOpenMode = OPEN_PASSIVE;
else
return -1;
return 0;
}
return -1;
}
static struct cmdtab const SetCommands[] = {
{"accmap", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
"Set accmap value", "set accmap hex-value", (const void *) VAR_ACCMAP},
"Set accmap value", "set accmap hex-value", (const void *)VAR_ACCMAP},
{"authkey", "key", SetVariable, LOCAL_AUTH,
"Set authentication key", "set authkey|key key", (const void *) VAR_AUTHKEY},
"Set authentication key", "set authkey|key key", (const void *)VAR_AUTHKEY},
{"authname", NULL, SetVariable, LOCAL_AUTH,
"Set authentication name", "set authname name", (const void *) VAR_AUTHNAME},
"Set authentication name", "set authname name", (const void *)VAR_AUTHNAME},
{"ctsrts", NULL, SetCtsRts, LOCAL_AUTH | LOCAL_CX,
"Use CTS/RTS modem signalling", "set ctsrts [on|off]"},
"Use hardware flow control", "set ctsrts [on|off]"},
{"deflate", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set deflate window sizes", "set deflate out-winsize in-winsize",
(const void *) VAR_WINSIZE},
@ -1435,10 +1442,8 @@ static struct cmdtab const SetCommands[] = {
(const void *) VAR_DEVICE},
{"dial", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
"Set dialing script", "set dial chat-script", (const void *) VAR_DIAL},
#ifdef HAVE_DES
{"encrypt", NULL, SetVariable, LOCAL_AUTH, "Set CHAP encryption algorithm",
{"encrypt", NULL, SetVariable, LOCAL_AUTH, "Select CHAP encryption type",
"set encrypt MSChap|MD5", (const void *) VAR_ENC},
#endif
{"escape", NULL, SetEscape, LOCAL_AUTH | LOCAL_CX,
"Set escape characters", "set escape hex-digit ..."},
{"hangup", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
@ -1453,22 +1458,34 @@ static struct cmdtab const SetCommands[] = {
"Set log level", "set log [local] [+|-]value..."},
{"login", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
"Set login script", "set login chat-script", (const void *) VAR_LOGIN},
{"mru", NULL, SetInitialMRU, LOCAL_AUTH,
"Set Initial MRU value", "set mru value"},
{"mtu", NULL, SetPreferredMTU, LOCAL_AUTH,
"Set Preferred MTU value", "set mtu value"},
{"mru", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set MRU value", "set mru value", (const void *)VAR_MRU},
{"mtu", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set MTU value", "set mtu value", (const void *)VAR_MTU},
{"lqrperiod", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set LQR period", "set lqrperiod value", (const void *)VAR_LQRPERIOD},
{"lcpretry", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
"Set FSM retry period", "set lcpretry value", (const void *)VAR_LCPRETRY},
{"chapretry", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
"Set CHAP retry period", "set chapretry value", (const void *)VAR_CHAPRETRY},
{"papretry", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
"Set PAP retry period", "set papretry value", (const void *)VAR_PAPRETRY},
{"ccpretry", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set FSM retry period", "set ccpretry value", (const void *)VAR_CCPRETRY},
{"ipcpretry", NULL, SetVariable, LOCAL_AUTH,
"Set FSM retry period", "set ipcpretry value", (const void *)VAR_IPCPRETRY},
#ifndef NOMSEXT
{"nbns", NULL, SetNBNS, LOCAL_AUTH,
"Set NetBIOS NameServer", "set nbns pri-addr [sec-addr]"},
{"ns", NULL, SetNS, LOCAL_AUTH,
"Set NameServer", "set ns pri-addr [sec-addr]"},
#endif
{"openmode", NULL, SetOpenMode, LOCAL_AUTH | LOCAL_CX,
"Set open mode", "set openmode [active|passive]"},
{"openmode", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "Set open mode",
"set openmode active|passive [secs]", (const void *)VAR_OPENMODE},
{"parity", NULL, SetModemParity, LOCAL_AUTH | LOCAL_CX,
"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},
"set phone phone1[:phone2[...]]", (const void *)VAR_PHONE},
{"reconnect", NULL, SetReconnect, LOCAL_AUTH | LOCAL_CX,
"Set Reconnect timeout", "set reconnect value ntries"},
{"redial", NULL, SetRedialTimeout, LOCAL_AUTH | LOCAL_CX,
@ -1479,8 +1496,8 @@ static struct cmdtab const SetCommands[] = {
"Set server port", "set server|socket TcpPort|LocalName|none [mask]"},
{"speed", NULL, SetModemSpeed, LOCAL_AUTH | LOCAL_CX,
"Set modem speed", "set speed value"},
{"timeout", NULL, SetTimeout, LOCAL_AUTH,
"Set Idle timeout", "set timeout idle LQR FSM-resend"},
{"timeout", NULL, SetVariable, LOCAL_AUTH, "Set Idle timeout",
"set timeout idletime", (const void *)VAR_IDLETIMEOUT},
{"vj", NULL, SetInitVJ, LOCAL_AUTH,
"Set vj values", "set vj slots|slotcomp"},
{"weight", NULL, mp_SetDatalinkWeight, LOCAL_AUTH | LOCAL_CX,

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.h,v 1.12.2.5 1998/03/17 22:29:07 brian Exp $
* $Id: command.h,v 1.12.2.6 1998/04/03 19:21:15 brian Exp $
*
* TODO:
*/
@ -48,11 +48,19 @@ struct cmdtab {
#define VAR_WINSIZE 4
#define VAR_DEVICE 5
#define VAR_ACCMAP 6
#define VAR_PHONE 7
#define VAR_HANGUP 8
#ifdef HAVE_DES
#define VAR_ENC 9
#endif
#define VAR_MRU 7
#define VAR_MTU 8
#define VAR_OPENMODE 9
#define VAR_PHONE 10
#define VAR_HANGUP 11
#define VAR_ENC 12
#define VAR_IDLETIMEOUT 13
#define VAR_LQRPERIOD 14
#define VAR_LCPRETRY 15
#define VAR_CHAPRETRY 16
#define VAR_PAPRETRY 17
#define VAR_CCPRETRY 18
#define VAR_IPCPRETRY 19
extern struct in_addr ifnetmask;
extern int aft_cmd;

View File

@ -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.28 1998/03/25 00:59:33 brian Exp $
* $Id: datalink.c,v 1.1.2.29 1998/04/03 19:21:17 brian Exp $
*/
#include <sys/param.h>
@ -179,8 +179,8 @@ datalink_LoginDone(struct datalink *dl)
hdlc_Init(&dl->physical->hdlc);
async_Init(&dl->physical->async);
lcp_Setup(&dl->physical->link.lcp,
dl->state == DATALINK_READY ? 0 : VarOpenMode);
lcp_Setup(&dl->physical->link.lcp, dl->state == DATALINK_READY ?
0 : dl->physical->link.lcp.cfg.openmode);
ccp_Setup(&dl->physical->link.ccp);
LogPrintf(LogPHASE, "%s: Entering LCP state\n", dl->name);

View File

@ -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.7 1998/03/25 18:38:49 brian Exp $
* $Id: defs.h,v 1.29.2.8 1998/04/03 19:21:19 brian Exp $
*
* TODO:
*/
@ -43,6 +43,8 @@
#define NCP_IDLE_TIMEOUT 180 /* Drop all links */
#define LINK_MINWEIGHT 20
#define DEF_LQRPERIOD 30 /* LQR frequency */
#define DEF_FSMRETRY 3 /* FSM retry frequency */
#define CONFFILE "ppp.conf"
#define LINKUPFILE "ppp.linkup"

View File

@ -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.27 1998/03/24 18:47:10 brian Exp $
* $Id: ipcp.c,v 1.50.2.28 1998/04/03 19:21:28 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@ -233,10 +233,14 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l,
iplist_setsrc(&ipcp->cfg.peer_list, "");
ipcp->cfg.HaveTriggerAddress = 0;
#ifndef NOMSEXT
ipcp->cfg.ns_entries[0].s_addr = INADDR_ANY;
ipcp->cfg.ns_entries[1].s_addr = INADDR_ANY;
ipcp->cfg.nbns_entries[0].s_addr = INADDR_ANY;
ipcp->cfg.nbns_entries[1].s_addr = INADDR_ANY;
#endif
ipcp->cfg.fsmretry = DEF_FSMRETRY;
memset(&ipcp->vj, '\0', sizeof ipcp->vj);
@ -398,7 +402,9 @@ static void
IpcpInitRestartCounter(struct fsm * fp)
{
/* Set fsm timer load */
fp->FsmTimer.load = VarRetryTimeout * SECTICKS;
struct ipcp *ipcp = fsm2ipcp(fp);
fp->FsmTimer.load = ipcp->cfg.fsmretry * SECTICKS;
fp->restart = 5;
}

View File

@ -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.16 1998/03/13 21:08:04 brian Exp $
* $Id: ipcp.h,v 1.18.2.17 1998/03/16 22:53:59 brian Exp $
*
* TODO:
*/
@ -58,6 +58,7 @@ struct ipcp {
struct in_addr ns_entries[2]; /* DNS addresses offered */
struct in_addr nbns_entries[2]; /* NetBIOS NS addresses offered */
#endif
u_int fsmretry; /* FSM retry frequency */
} cfg;
struct {

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lcp.c,v 1.55.2.33 1998/03/24 18:47:17 brian Exp $
* $Id: lcp.c,v 1.55.2.34 1998/04/03 19:21:29 brian Exp $
*
* TODO:
* o Limit data field length by MRU
@ -143,9 +143,10 @@ static const char *cftypes[] = {
int
lcp_ReportStatus(struct cmdargs const *arg)
{
struct lcp *lcp = &ChooseLink(arg)->lcp;
struct link *l = ChooseLink(arg);
struct lcp *lcp = &l->lcp;
prompt_Printf(&prompt, "%s [%s]\n", lcp->fsm.name,
prompt_Printf(&prompt, "%s: %s [%s]\n", l->name, lcp->fsm.name,
State2Nam(lcp->fsm.state));
prompt_Printf(&prompt,
" his side: MRU %d, ACCMAP %08lx, PROTOCOMP %d, ACFCOMP %d,\n"
@ -159,13 +160,17 @@ lcp_ReportStatus(struct cmdargs const *arg)
lcp->want_mru, (u_long)lcp->want_accmap,
lcp->want_protocomp, lcp->want_acfcomp,
(u_long)lcp->want_magic, lcp->my_reject);
prompt_Printf(&prompt, "\nDefaults: MRU = %d, ACCMAP = %08lx\t",
VarMRU, (u_long)VarAccmap);
prompt_Printf(&prompt, "Open Mode: %s",
(VarOpenMode == OPEN_PASSIVE) ? "passive" : "active");
if (VarOpenMode > 0)
prompt_Printf(&prompt, " (delay %d)", VarOpenMode);
prompt_Printf(&prompt, "\n");
prompt_Printf(&prompt, "\n Defaults: MRU = %d, ", lcp->cfg.mru);
if (l->lcp.cfg.mtu)
prompt_Printf(&prompt, "MTU = %d, ", lcp->cfg.mtu);
prompt_Printf(&prompt, "ACCMAP = %08lx\n", (u_long)lcp->cfg.accmap);
prompt_Printf(&prompt, " LQR period = %us, ", lcp->cfg.lqrperiod);
prompt_Printf(&prompt, "Open Mode = %s",
lcp->cfg.openmode == OPEN_PASSIVE ? "passive" : "active");
if (lcp->cfg.openmode > 0)
prompt_Printf(&prompt, " (delay %ds)", lcp->cfg.openmode);
prompt_Printf(&prompt, "\n FSM retry = %us\n", lcp->cfg.fsmretry);
return 0;
}
@ -188,7 +193,15 @@ lcp_Init(struct lcp *lcp, struct bundle *bundle, struct link *l,
fsm_Init(&lcp->fsm, "LCP", PROTO_LCP, mincode, LCP_MAXCODE, 10, LogLCP,
bundle, l, parent, &lcp_Callbacks, timer_names);
lcp_Setup(lcp, 1);
lcp->cfg.mru = DEF_MRU;
lcp->cfg.mtu = DEF_MTU;
lcp->cfg.accmap = 0;
lcp->cfg.openmode = 1;
lcp->cfg.lqrperiod = DEF_LQRPERIOD;
lcp->cfg.fsmretry = DEF_FSMRETRY;
lcp_Setup(lcp, lcp->cfg.openmode);
}
void
@ -205,12 +218,12 @@ lcp_Setup(struct lcp *lcp, int openmode)
lcp->his_acfcomp = 0;
lcp->his_auth = 0;
lcp->want_mru = VarMRU;
lcp->want_accmap = VarAccmap;
lcp->want_mru = lcp->cfg.mru;
lcp->want_accmap = lcp->cfg.accmap;
lcp->want_magic = GenerateMagic();
lcp->want_auth = Enabled(ConfChap) ? PROTO_CHAP :
Enabled(ConfPap) ? PROTO_PAP : 0;
lcp->want_lqrperiod = Enabled(ConfLqr) ? VarLqrTimeout * 100 : 0;
lcp->want_lqrperiod = Enabled(ConfLqr) ? lcp->cfg.lqrperiod * 100 : 0;
lcp->want_protocomp = Enabled(ConfProtocomp) ? 1 : 0;
lcp->want_acfcomp = Enabled(ConfAcfcomp) ? 1 : 0;
@ -223,7 +236,9 @@ static void
LcpInitRestartCounter(struct fsm * fp)
{
/* Set fsm timer load */
fp->FsmTimer.load = VarRetryTimeout * SECTICKS;
struct lcp *lcp = fsm2lcp(fp);
fp->FsmTimer.load = lcp->cfg.fsmretry * SECTICKS;
fp->restart = 5;
}
@ -381,7 +396,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
switch (mode_type) {
case MODE_REQ:
mtu = VarPrefMTU;
mtu = lcp->cfg.mtu;
if (mtu == 0)
mtu = MAX_MTU;
if (mru > mtu) {

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lcp.h,v 1.16.2.15 1998/03/20 19:46:58 brian Exp $
* $Id: lcp.h,v 1.16.2.16 1998/04/03 19:21:31 brian Exp $
*
* TODO:
*/
@ -36,8 +36,8 @@ struct lcp {
u_int32_t want_accmap; /* Our async char control map */
u_int32_t want_magic; /* Our magic number */
u_int32_t want_lqrperiod; /* Our LQR frequency */
int want_protocomp : 1; /* Do we do protocol field compression */
int want_acfcomp : 1; /* Do we do addr & cntrl fld compression */
unsigned want_protocomp : 1; /* Do we do protocol field compression */
unsigned want_acfcomp : 1; /* Do we do addr & cntrl fld compression */
u_short want_auth; /* We want this type of authentication */
u_int32_t his_reject; /* Request codes rejected by peer */
@ -47,6 +47,15 @@ struct lcp {
u_short auth_ineed; /* I require that the peer authenticates */
int LcpFailedMagic; /* Number of `magic is same' errors */
struct {
u_short mru; /* Preferred MRU value */
u_short mtu; /* Preferred MTU value */
u_int32_t accmap; /* Initial ACCMAP value */
int openmode; /* when to start CFG REQs */
u_int lqrperiod; /* LQR frequency */
u_int fsmretry; /* FSM retry frequency */
} cfg;
};
#define LCP_MAXCODE CODE_DISCREQ

View File

@ -1,10 +1,10 @@
.\" $Id: ppp.8,v 1.97.2.6 1998/03/17 22:29:11 brian Exp $
.\" $Id: ppp.8,v 1.97.2.7 1998/03/20 19:47:03 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
.Sh NAME
.Nm ppp
.Nd Point to Point Protocol (a.k.a. iijppp)
.Nd Point to Point Protocol (a.k.a. user-ppp)
.Sh SYNOPSIS
.Nm
.\" SOMEONE FIX ME ! The .Op macro can't handle enough args !
@ -123,18 +123,24 @@ to check the packet flow over the
.Em PPP
link.
.It Supports PPP over TCP capability.
.It Supports IETF draft Predictor-1 compression.
If a device name is specified as
.Em host Ns No : Ns Em port ,
.Nm
supports not only VJ-compression but also Predictor-1 compression.
will open a TCP connection for transporting data rather than using a
conventional serial device.
.It Supports IETF draft Predictor-1 and DEFLATE compression.
.Nm
supports not only VJ-compression but also Predictor-1 and DEFLATE 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.
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
modem and also increases latency. Unlike VJ-compression, Predictor-1
compression pre-compresses
modem and also increases latency. Unlike VJ-compression, Predictor-1 and
DEFLATE compression pre-compresses
.Em all
data flowing through the link, thus reducing overhead to a minimum.
network traffic flowing through the link, thus reducing overheads to a
minimum.
.It Supports Microsoft's IPCP extensions.
Name Server Addresses and NetBIOS Name Server Addresses can be negotiated
with clients using the Microsoft
@ -847,7 +853,7 @@ ui-gate:
set escape 0xff
set device ui-gate:ppp-in
set dial
set timeout 30 15 5
set timeout 30
set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun
set ifaddr 10.0.4.2 10.0.4.1
add 10.0.2.0 255.255.255.0 10.0.4.1
@ -978,34 +984,39 @@ to flush all rules.
.Pp
See
.Pa /etc/ppp/ppp.conf.example .
.Sh SETTING IDLE, LINE QUALITY REQUEST, RETRY TIMER
To check/set idle timer, use the
.Sh SETTING THE IDLE TIMER
To check/set the idle timer, use the
.Dq show timeout
and
.Dq set timeout idle [LQR [FSM-resend]]
.Dq set timeout
commands:
.Bd -literal -offset indent
ppp ON awfulhak> set timeout 600
.Ed
.Pp
The timeout period is measured in seconds, the default values for which
are timeout = 180 or 3 min, lqrtimer = 30sec and retrytimer = 3sec.
The timeout period is measured in seconds, the default value for which
is 180 seconds
.Pq or 3 min .
To disable the idle timer function, use the command
.Bd -literal -offset indent
ppp ON awfulhak> set timeout 0
.Ed
.Pp
In
.Fl ddial
and
.Fl direct
modes, the idle timeout is ignored. In
.Fl auto
mode, an idle timeout causes the
mode, when the idle timeout causes the
.Em PPP
session to be
closed, though the
closed, the
.Nm
program itself remains running. Another trigger packet will cause it to
attempt to reestablish the link.
.Sh PREDICTOR-1 and DEFLATE COMPRESSION
This version supports CCP and Predictor type 1 or deflate compression
This version supports CCP and either Predictor type 1 or deflate compression
based on the current IETF-draft specs. As a default behaviour,
.Nm
will attempt to use (or be willing to accept) both compression protocols
@ -1019,11 +1030,12 @@ and
.Dq deny
commands if you wish to disable this functionality.
.Pp
It is possible to use a different algorithm in each direction by using
only one of
It is possible to use a different compression algorithm in each direction
by using only one of
.Dq disable deflate
and
.Dq deny deflate .
.Dq deny deflate
.Pq assuming that the peer supports both algorithms .
.Sh CONTROLLING IP ADDRESS
.Nm
uses IPCP to negotiate IP addresses. Each side of the connection
@ -1564,10 +1576,32 @@ and
.Ar accept Ns No ed .
.It lqr
Default: Disabled and Accepted. This option decides if Link Quality
Requests will be sent. LQR is a protocol that allows
Requests will be sent or accepted. LQR is a protocol that allows
.Nm
to determine that the link is down without relying on the modems
carrier detect.
carrier detect. When LQR is enabled,
.Nm
sends the
.Em QUALPROTO
option (see
.Dq set lqrperiod
below) as part of the LCP request. If the peer agrees, both sides will
exchange LQR packets at the agreed frequency, allowing detailed link
quality monitoring by enabling LQM logging. If the peer doesn't agree,
ppp will send ECHO LQR requests instead. These packets pass no
information of interest, but they
.Em MUST
be replied to by the peer.
.Pp
Whether using LQR or ECHO LQR,
.Nm
will abruptly drop the connection if 5 unacknowledged packets have been
sent rather than sending a 6th. A message is logged at the
.Em PHASE
level, and any appropriate
.Dq reconnect
values are honoured as if the peer were responsible for dropping the
connection.
.It pap
Default: Disabled and Accepted. PAP stands for Password Authentication
Protocol. Only one of PAP and CHAP (above) may be negotiated. With
@ -2273,6 +2307,17 @@ argument may be overridden in the
file once the client has authenticated themself. Refer to the
.Em AUTHENTICATING INCOMING CONNECTIONS
section for details.
.It set lcpretry period
.It set chapretry period
.It set papretry period
.It set ccpretry period
.It set ipcpretry period
These commands set the number of seconds that
.Nm
will wait before resending Finite State Machine (FSM) Request packets.
The default
.Ar period
for all FSMs is 3 seconds (which should suffice in most cases).
.It set loopback on|off
When set to
.Ar on
@ -2398,6 +2443,16 @@ doesn't time out in the stopped state.
This value should not be set to less than the openmode delay (see
.Dq set openmode
above).
.It set lqrperiod frequency
This command sets the
.Ar frequency
in seconds at which
.Em LQR
or
.Em ECHO LQR
packets are sent. The default is 30 seconds. You must also use the
.Dq enable lqr
command if you wish to send LQR requests to the peer.
.It set server|socket TcpPort|LocalName|none [password] [mask]
This command tells
.Nm
@ -2443,11 +2498,11 @@ can also be used, but link encryption may be implemented in the future, so
should not be relied upon.
.It set speed value
This sets the speed of the serial device.
.It set timeout idle [LQR [FSM-resend]]
This command allows the setting of the idle timer, the LQR timer (if
enabled) and the finite state machine
.Pq FSM
retry timer.
.It set timeout idleseconds
This command allows the setting of the idle timer. Refer to the
section titled
.Dq SETTING THE IDLE TIMER
for further details.
.It set vj slots nslots
This command sets the initial number of
.Ar slots

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: tun.c,v 1.6.4.9 1998/03/20 19:48:25 brian Exp $
* $Id: tun.c,v 1.6.4.10 1998/04/03 19:21:55 brian Exp $
*/
#include <sys/param.h>
@ -71,8 +71,6 @@ tun_configure(struct bundle *bundle, int mtu, int speed)
info.type = 23;
info.mtu = mtu;
if (VarPrefMTU != 0 && VarPrefMTU < mtu)
info.mtu = VarPrefMTU;
info.baudrate = speed;
#ifdef __OpenBSD__
info.flags = IFF_UP|IFF_POINTOPOINT;

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: vars.c,v 1.45.2.17 1998/03/24 18:47:27 brian Exp $
* $Id: vars.c,v 1.45.2.18 1998/04/03 19:21:55 brian Exp $
*
*/
#include <sys/param.h>
@ -48,7 +48,7 @@
#include "prompt.h"
char VarVersion[] = "PPP Version 2.0-beta";
char VarLocalVersion[] = "$Date: 1998/03/24 18:47:27 $";
char VarLocalVersion[] = "$Date: 1998/04/03 19:21:55 $";
/*
* Order of conf option is important. See vars.h.
@ -73,7 +73,7 @@ struct confdesc pppConfs[] = {
};
struct pppvars pppVars = {
DEF_MRU, DEF_MTU, 0, 30, 3, 1, 1, LOCAL_NO_AUTH
1, LOCAL_NO_AUTH
};
int

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: vars.h,v 1.42.2.14 1998/03/20 19:47:10 brian Exp $
* $Id: vars.h,v 1.42.2.15 1998/03/24 18:47:32 brian Exp $
*
* TODO:
*/
@ -56,13 +56,7 @@ struct confdesc {
extern struct confdesc pppConfs[MAXCONFS + 1];
struct pppvars {
u_short var_mru; /* Initial MRU value */
u_short pref_mtu; /* Preferred MTU value */
int var_accmap; /* Initial ACCMAP value */
int lqr_timeout; /* LQR timeout value */
int retry_timeout; /* Retry timeout value */
int loopback; /* Turn around packets addressed to me */
int open_mode; /* Delay before first LCP REQ (-1 = passive) */
#define LOCAL_AUTH 0x01
#define LOCAL_NO_AUTH 0x02
#define LOCAL_DENY 0x03
@ -71,35 +65,24 @@ struct pppvars {
u_char lauth; /* Local Authorized status */
/* The rest are just default initialized in vars.c */
#define DIALUP_REQ 0x01
#define DIALUP_DONE 0x02
char auth_key[50]; /* PAP/CHAP key */
char auth_name[50]; /* PAP/CHAP system name */
char local_auth_key[50]; /* Local auth passwd */
int have_local_auth_key; /* Local auth passwd specified ? */
#ifdef HAVE_DES
char local_auth_key[50]; /* Local auth passwd */
int have_local_auth_key; /* Local auth passwd specified ? */
int use_MSChap; /* Use MSCHAP encryption */
#endif
char shostname[MAXHOSTNAMELEN]; /* Local short Host Name */
struct aliasHandlers handler; /* Alias function pointers */
};
#define VarAccmap pppVars.var_accmap
#define VarMRU pppVars.var_mru
#define VarPrefMTU pppVars.pref_mtu
#define VarOpenMode pppVars.open_mode
#define VarLoopback pppVars.loopback
#define VarLocalAuth pppVars.lauth
#define VarLqrTimeout pppVars.lqr_timeout
#define VarRetryTimeout pppVars.retry_timeout
#define VarAuthKey pppVars.auth_key
#define VarAuthName pppVars.auth_name
#define VarLocalAuthKey pppVars.local_auth_key
#define VarHaveLocalAuthKey pppVars.have_local_auth_key
#ifdef HAVE_DES
#define VarMSChap pppVars.use_MSChap
#endif
#define VarShortHost pppVars.shostname
#define VarLoopback pppVars.loopback
#define VarAliasHandlers pppVars.handler
#define VarPacketAliasGetFragment (*pppVars.handler.PacketAliasGetFragment)