summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-06-27 23:48:54 +0000
committerbrian <brian@FreeBSD.org>1998-06-27 23:48:54 +0000
commitecefb9d1a210a6c86638b396ea5ece55c433bc66 (patch)
tree0a77c0e67b7da6215327359880d61c222fd24aa7
parent40b850dd415ad2adcddb88549067b23762bce91a (diff)
downloadFreeBSD-src-ecefb9d1a210a6c86638b396ea5ece55c433bc66.zip
FreeBSD-src-ecefb9d1a210a6c86638b396ea5ece55c433bc66.tar.gz
o Fix remaining sizeof problems for 64 bit machines.
o Allow ``set ....'' when we have multiple links but aren't in multilink mode. o Do a TLS when we receive a ``Open'' event in ``Closed'' state, despite the rfc state transition table. This is clearly an error in the RFC as TLS cannot have yet been called (without TLF) in the ``Closed'' state. I've posted a message to comp.protocols.ppp for confirmation.
-rw-r--r--usr.sbin/ppp/ccp.c14
-rw-r--r--usr.sbin/ppp/ccp.h6
-rw-r--r--usr.sbin/ppp/chap.c3
-rw-r--r--usr.sbin/ppp/command.c196
-rw-r--r--usr.sbin/ppp/defs.h4
-rw-r--r--usr.sbin/ppp/fsm.c25
-rw-r--r--usr.sbin/ppp/hdlc.c4
-rw-r--r--usr.sbin/ppp/id.c8
-rw-r--r--usr.sbin/ppp/ip.c8
-rw-r--r--usr.sbin/ppp/ipcp.c19
-rw-r--r--usr.sbin/ppp/iplist.c12
-rw-r--r--usr.sbin/ppp/iplist.h23
-rw-r--r--usr.sbin/ppp/lcp.c53
-rw-r--r--usr.sbin/ppp/lcp.h8
-rw-r--r--usr.sbin/ppp/link.c3
-rw-r--r--usr.sbin/ppp/lqr.c21
-rw-r--r--usr.sbin/ppp/mbuf.c5
-rw-r--r--usr.sbin/ppp/pap.c3
-rw-r--r--usr.sbin/ppp/ppp.818
-rw-r--r--usr.sbin/ppp/ppp.8.m418
-rw-r--r--usr.sbin/ppp/route.c16
-rw-r--r--usr.sbin/ppp/vjcomp.c3
22 files changed, 261 insertions, 209 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c
index 5e164c22..62f4059 100644
--- a/usr.sbin/ppp/ccp.c
+++ b/usr.sbin/ppp/ccp.c
@@ -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.34 1998/06/15 19:06:02 brian Exp $
+ * $Id: ccp.c,v 1.35 1998/06/25 22:33:12 brian Exp $
*
* TODO:
* o Support other compression protocols
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <termios.h>
#include "defs.h"
@@ -135,8 +136,7 @@ ccp_ReportStatus(struct cmdargs const *arg)
struct link *l;
struct ccp *ccp;
- if (!(l = command_ChooseLink(arg)))
- return -1;
+ l = command_ChooseLink(arg);
ccp = &l->ccp;
prompt_Printf(arg->prompt, "%s: %s [%s]\n", l->name, ccp->fsm.name,
@@ -302,7 +302,7 @@ static void
CcpLayerStart(struct fsm *fp)
{
/* We're about to start up ! */
- log_Printf(LogCCP, "%s: CcpLayerStart.\n", fp->link->name);
+ log_Printf(LogCCP, "%s: LayerStart.\n", fp->link->name);
}
static void
@@ -312,7 +312,7 @@ CcpLayerDown(struct fsm *fp)
struct ccp *ccp = fsm2ccp(fp);
struct ccp_opt *next;
- log_Printf(LogCCP, "%s: CcpLayerDown.\n", fp->link->name);
+ log_Printf(LogCCP, "%s: LayerDown.\n", fp->link->name);
if (ccp->in.state != NULL) {
(*algorithm[ccp->in.algorithm]->i.Term)(ccp->in.state);
ccp->in.state = NULL;
@@ -337,7 +337,7 @@ static void
CcpLayerFinish(struct fsm *fp)
{
/* We're now down */
- log_Printf(LogCCP, "%s: CcpLayerFinish.\n", fp->link->name);
+ log_Printf(LogCCP, "%s: LayerFinish.\n", fp->link->name);
}
/*
@@ -348,7 +348,7 @@ CcpLayerUp(struct fsm *fp)
{
/* We're now up */
struct ccp *ccp = fsm2ccp(fp);
- log_Printf(LogCCP, "%s: CcpLayerUp.\n", fp->link->name);
+ log_Printf(LogCCP, "%s: LayerUp.\n", fp->link->name);
if (ccp->in.state == NULL && ccp->in.algorithm >= 0 &&
ccp->in.algorithm < NALGORITHMS) {
ccp->in.state = (*algorithm[ccp->in.algorithm]->i.Init)(&ccp->in.opt);
diff --git a/usr.sbin/ppp/ccp.h b/usr.sbin/ppp/ccp.h
index f778885..ca4ac82 100644
--- a/usr.sbin/ppp/ccp.h
+++ b/usr.sbin/ppp/ccp.h
@@ -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.16 1998/05/23 13:38:02 brian Exp $
+ * $Id: ccp.h,v 1.17 1998/06/15 19:06:37 brian Exp $
*
* TODO:
*/
@@ -83,8 +83,8 @@ struct ccp {
u_int32_t his_reject; /* Request codes rejected by peer */
u_int32_t my_reject; /* Request codes I have rejected */
- u_long uncompout, compout;
- u_long uncompin, compin;
+ u_long uncompout, compout; /* Outgoing bytes before/after compression */
+ u_long uncompin, compin; /* Incoming bytes after/before decompression */
struct ccp_config cfg;
};
diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c
index db7f9f2..04b866e 100644
--- a/usr.sbin/ppp/chap.c
+++ b/usr.sbin/ppp/chap.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: chap.c,v 1.32 1998/05/21 22:55:02 brian Exp $
+ * $Id: chap.c,v 1.33 1998/06/27 14:18:01 brian Exp $
*
* TODO:
*/
@@ -32,6 +32,7 @@
#endif
#include <md5.h>
#include <stdlib.h>
+#include <string.h>
#include <termios.h>
#include "mbuf.h"
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index e016328..03f70fe 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -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.150 1998/06/27 14:17:24 brian Exp $
+ * $Id: command.c,v 1.151 1998/06/27 14:18:02 brian Exp $
*
*/
#include <sys/types.h>
@@ -122,7 +122,7 @@
#define NEG_DNS 50
const char Version[] = "2.0-beta";
-const char VersionDate[] = "$Date: 1998/06/27 14:17:24 $";
+const char VersionDate[] = "$Date: 1998/06/27 14:18:02 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -552,8 +552,6 @@ ShowProtocolStats(struct cmdargs const *arg)
{
struct link *l = command_ChooseLink(arg);
- if (!l)
- return -1;
prompt_Printf(arg->prompt, "%s:\n", l->name);
link_ReportProtocolStatus(l, arg->prompt);
return 0;
@@ -847,13 +845,9 @@ OpenCommand(struct cmdargs const *arg)
} else
log_Printf(LogWARN, "open lcp: You must specify a link\n");
} else if (!strcasecmp(arg->argv[arg->argn], "ccp")) {
- struct link *l;
struct fsm *fp;
- if (!(l = command_ChooseLink(arg)))
- return -1;
- fp = &l->ccp.fsm;
-
+ fp = &command_ChooseLink(arg)->ccp.fsm;
if (fp->link->lcp.fsm.state != ST_OPENED)
log_Printf(LogWARN, "open: LCP must be open before opening CCP\n");
else if (fp->state == ST_OPENED)
@@ -893,13 +887,9 @@ CloseCommand(struct cmdargs const *arg)
bundle_Close(arg->bundle, arg->cx ? arg->cx->name : NULL, CLOSE_LCP);
else if (!strcasecmp(arg->argv[arg->argn], "ccp") ||
!strcasecmp(arg->argv[arg->argn], "ccp!")) {
- struct link *l;
struct fsm *fp;
- if (!(l = command_ChooseLink(arg)))
- return -1;
- fp = &l->ccp.fsm;
-
+ fp = &command_ChooseLink(arg)->ccp.fsm;
if (fp->state == ST_OPENED) {
fsm_Close(fp);
if (arg->argv[arg->argn][3] == '!')
@@ -1038,7 +1028,7 @@ SetServer(struct cmdargs const *arg)
ptr = strstr(port, "%d");
if (ptr) {
snprintf(name, sizeof name, "%.*s%d%s",
- ptr - port, port, arg->bundle->unit, ptr + 2);
+ (int)(ptr - port), port, arg->bundle->unit, ptr + 2);
port = name;
}
res = server_LocalOpen(arg->bundle, port, imask);
@@ -1175,18 +1165,14 @@ SetInterfaceAddr(struct cmdargs const *arg)
static int
SetVariable(struct cmdargs const *arg)
{
- u_long ulong_val;
+ long long_val, param = (long)arg->cmd->args;
+ int mode, dummyint;
const char *argp;
- int param = (int)arg->cmd->args, mode;
struct datalink *cx = arg->cx; /* LOCAL_CX uses this */
const char *err = NULL;
struct link *l = command_ChooseLink(arg); /* LOCAL_CX_OPT uses this */
- int dummyint;
struct in_addr dummyaddr, *addr;
- if (!l)
- return -1;
-
if (arg->argc > arg->argn)
argp = arg->argv[arg->argn];
else
@@ -1213,6 +1199,7 @@ SetVariable(struct cmdargs const *arg)
log_Printf(LogWARN, err);
}
break;
+
case VAR_AUTHNAME:
if (bundle_Phase(arg->bundle) == PHASE_DEAD) {
strncpy(arg->bundle->cfg.auth.name, argp,
@@ -1223,6 +1210,7 @@ SetVariable(struct cmdargs const *arg)
log_Printf(LogWARN, err);
}
break;
+
case VAR_AUTOLOAD:
if (arg->argc == arg->argn + 2 || arg->argc == arg->argn + 4) {
arg->bundle->autoload.running = 1;
@@ -1240,14 +1228,17 @@ SetVariable(struct cmdargs const *arg)
log_Printf(LogWARN, err);
}
break;
+
case VAR_DIAL:
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:
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 > arg->argn) {
l->ccp.cfg.deflate.out.winsize = atoi(arg->argv[arg->argn]);
@@ -1272,19 +1263,23 @@ SetVariable(struct cmdargs const *arg)
log_Printf(LogWARN, err);
}
break;
+
case VAR_DEVICE:
physical_SetDeviceList(cx->physical, arg->argc - arg->argn,
arg->argv + arg->argn);
break;
+
case VAR_ACCMAP:
if (arg->argc > arg->argn) {
+ u_long ulong_val;
sscanf(argp, "%lx", &ulong_val);
- cx->physical->link.lcp.cfg.accmap = ulong_val;
+ cx->physical->link.lcp.cfg.accmap = (u_int32_t)ulong_val;
} else {
err = "No accmap specified\n";
log_Printf(LogWARN, err);
}
break;
+
case VAR_MODE:
mode = Nam2mode(argp);
if (mode == PHYS_NONE || mode == PHYS_ALL) {
@@ -1293,45 +1288,49 @@ SetVariable(struct cmdargs const *arg)
}
bundle_SetMode(arg->bundle, cx, mode);
break;
+
case VAR_MRRU:
- if (bundle_Phase(arg->bundle) != PHASE_DEAD)
+ if (bundle_Phase(arg->bundle) != PHASE_DEAD) {
log_Printf(LogWARN, "mrru: Only changable at phase DEAD\n");
- else {
- ulong_val = atol(argp);
- if (ulong_val && ulong_val < MIN_MRU)
- err = "Given MRRU value (%lu) is too small.\n";
- else if (ulong_val > MAX_MRU)
- err = "Given MRRU value (%lu) is too big.\n";
- else
- arg->bundle->ncp.mp.cfg.mrru = ulong_val;
- if (err)
- log_Printf(LogWARN, err, ulong_val);
+ return 1;
}
+ long_val = atol(argp);
+ if (long_val && long_val < MIN_MRU) {
+ log_Printf(LogWARN, "MRRU %ld: too small - min %d\n", long_val, MIN_MRU);
+ return 1;
+ } else if (long_val > MAX_MRU) {
+ log_Printf(LogWARN, "MRRU %ld: too big - max %d\n", long_val, MAX_MRU);
+ return 1;
+ } else
+ arg->bundle->ncp.mp.cfg.mrru = long_val;
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)
- log_Printf(LogWARN, err, ulong_val);
+ long_val = atol(argp);
+ if (long_val == 0)
+ l->lcp.cfg.mru = DEF_MRU;
+ else if (long_val < MIN_MRU) {
+ log_Printf(LogWARN, "MRU %ld: too small - min %d\n", long_val, MIN_MRU);
+ return 1;
+ } else if (long_val > MAX_MRU) {
+ log_Printf(LogWARN, "MRU %ld: too big - max %d\n", long_val, MAX_MRU);
+ return 1;
+ } else
+ l->lcp.cfg.mru = long_val;
break;
+
case VAR_MTU:
- ulong_val = atol(argp);
- if (ulong_val == 0)
- arg->bundle->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
- arg->bundle->cfg.mtu = ulong_val;
- if (err)
- log_Printf(LogWARN, err, ulong_val);
+ long_val = atol(argp);
+ if (long_val && long_val < MIN_MTU) {
+ log_Printf(LogWARN, "MTU %ld: too small - min %d\n", long_val, MIN_MTU);
+ return 1;
+ } else if (long_val > MAX_MTU) {
+ log_Printf(LogWARN, "MTU %ld: too big - max %d\n", long_val, MAX_MTU);
+ return 1;
+ } else
+ arg->bundle->cfg.mtu = long_val;
break;
+
case VAR_OPENMODE:
if (strcasecmp(argp, "active") == 0)
cx->physical->link.lcp.cfg.openmode = arg->argc > arg->argn+1 ?
@@ -1343,14 +1342,17 @@ SetVariable(struct cmdargs const *arg)
log_Printf(LogWARN, err, argp);
}
break;
+
case VAR_PHONE:
strncpy(cx->cfg.phone.list, argp, sizeof cx->cfg.phone.list - 1);
cx->cfg.phone.list[sizeof cx->cfg.phone.list - 1] = '\0';
break;
+
case VAR_HANGUP:
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 > arg->argn+1)
err = "Too many idle timeout values\n";
@@ -1359,54 +1361,67 @@ SetVariable(struct cmdargs const *arg)
if (err)
log_Printf(LogWARN, err);
break;
+
case VAR_LQRPERIOD:
- ulong_val = atol(argp);
- if (ulong_val <= 0) {
- err = "%s: Invalid lqr period\n";
- log_Printf(LogWARN, err, argp);
+ long_val = atol(argp);
+ if (long_val < MIN_LQRPERIOD) {
+ log_Printf(LogWARN, "%ld: Invalid lqr period - min %d\n",
+ long_val, MIN_LQRPERIOD);
+ return 1;
} else
- l->lcp.cfg.lqrperiod = ulong_val;
+ l->lcp.cfg.lqrperiod = long_val;
break;
+
case VAR_LCPRETRY:
- ulong_val = atol(argp);
- if (ulong_val <= 0) {
- err = "%s: Invalid LCP FSM retry period\n";
- log_Printf(LogWARN, err, argp);
+ long_val = atol(argp);
+ if (long_val < MIN_FSMRETRY) {
+ log_Printf(LogWARN, "%ld: Invalid LCP FSM retry period - min %d\n",
+ long_val, MIN_FSMRETRY);
+ return 1;
} else
- cx->physical->link.lcp.cfg.fsmretry = ulong_val;
+ cx->physical->link.lcp.cfg.fsmretry = long_val;
break;
+
case VAR_CHAPRETRY:
- ulong_val = atol(argp);
- if (ulong_val <= 0) {
- err = "%s: Invalid CHAP retry period\n";
- log_Printf(LogWARN, err, argp);
+ long_val = atol(argp);
+ if (long_val < MIN_FSMRETRY) {
+ log_Printf(LogWARN, "%ld: Invalid CHAP FSM retry period - min %d\n",
+ long_val, MIN_FSMRETRY);
+ return 1;
} else
- cx->chap.auth.cfg.fsmretry = ulong_val;
+ cx->chap.auth.cfg.fsmretry = long_val;
break;
+
case VAR_PAPRETRY:
- ulong_val = atol(argp);
- if (ulong_val <= 0) {
- err = "%s: Invalid PAP retry period\n";
- log_Printf(LogWARN, err, argp);
+ long_val = atol(argp);
+ if (long_val < MIN_FSMRETRY) {
+ log_Printf(LogWARN, "%ld: Invalid PAP FSM retry period - min %d\n",
+ long_val, MIN_FSMRETRY);
+ return 1;
} else
- cx->pap.cfg.fsmretry = ulong_val;
+ cx->pap.cfg.fsmretry = long_val;
break;
+
case VAR_CCPRETRY:
- ulong_val = atol(argp);
- if (ulong_val <= 0) {
- err = "%s: Invalid CCP FSM retry period\n";
- log_Printf(LogWARN, err, argp);
+ long_val = atol(argp);
+ if (long_val < MIN_FSMRETRY) {
+ log_Printf(LogWARN, "%ld: Invalid CCP FSM retry period - min %d\n",
+ long_val, MIN_FSMRETRY);
+ return 1;
} else
- l->ccp.cfg.fsmretry = ulong_val;
+ l->ccp.cfg.fsmretry = long_val;
break;
+
case VAR_IPCPRETRY:
- ulong_val = atol(argp);
- if (ulong_val <= 0) {
- err = "%s: Invalid IPCP FSM retry period\n";
- log_Printf(LogWARN, err, argp);
+ long_val = atol(argp);
+ if (long_val < MIN_FSMRETRY) {
+ log_Printf(LogWARN, "%ld: Invalid IPCP FSM retry period - min %d\n",
+ long_val, MIN_FSMRETRY);
+ return 1;
} else
- arg->bundle->ncp.ipcp.cfg.fsmretry = ulong_val;
+ arg->bundle->ncp.ipcp.cfg.fsmretry = long_val;
break;
+
case VAR_NBNS:
case VAR_DNS:
if (param == VAR_DNS)
@@ -1810,12 +1825,12 @@ command_ChooseLink(struct cmdargs const *arg)
{
if (arg->cx)
return &arg->cx->physical->link;
- else if (arg->bundle->ncp.mp.cfg.mrru)
- return &arg->bundle->ncp.mp.link;
- else {
+ else if (!arg->bundle->ncp.mp.cfg.mrru) {
struct datalink *dl = bundle2datalink(arg->bundle, NULL);
- return dl ? &dl->physical->link : NULL;
+ if (dl)
+ return &dl->physical->link;
}
+ return &arg->bundle->ncp.mp.link;
}
static const char *
@@ -1865,7 +1880,7 @@ ident_cmd(const char *cmd, unsigned *keep, unsigned *add)
static int
OptSet(struct cmdargs const *arg)
{
- int bit = (int)arg->cmd->args;
+ int bit = (long)arg->cmd->args ? 1 : 0;
const char *cmd;
unsigned keep; /* Keep these bits */
unsigned add; /* Add these bits */
@@ -1883,16 +1898,13 @@ OptSet(struct cmdargs const *arg)
static int
NegotiateSet(struct cmdargs const *arg)
{
- int param = (int)arg->cmd->args;
+ long param = (long)arg->cmd->args;
struct link *l = command_ChooseLink(arg); /* LOCAL_CX_OPT uses this */
struct datalink *cx = arg->cx; /* LOCAL_CX uses this */
const char *cmd;
unsigned keep; /* Keep these bits */
unsigned add; /* Add these bits */
- if (!l)
- return -1;
-
if ((cmd = ident_cmd(arg->argv[arg->argn-2], &keep, &add)) == NULL)
return 1;
diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h
index b14f5e9..80fbd1e 100644
--- a/usr.sbin/ppp/defs.h
+++ b/usr.sbin/ppp/defs.h
@@ -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.31 1998/05/28 23:17:40 brian Exp $
+ * $Id: defs.h,v 1.32 1998/05/29 18:32:11 brian Exp $
*
* TODO:
*/
@@ -48,7 +48,9 @@
#define NCP_IDLE_TIMEOUT 180 /* Drop all links */
#define LINK_MINWEIGHT 20
+#define MIN_LQRPERIOD 5 /* Minimum LQR frequency */
#define DEF_LQRPERIOD 30 /* LQR frequency */
+#define MIN_FSMRETRY 3 /* Minimum FSM retry frequency */
#define DEF_FSMRETRY 3 /* FSM retry frequency */
#define CONFFILE "ppp.conf"
diff --git a/usr.sbin/ppp/fsm.c b/usr.sbin/ppp/fsm.c
index 0ca6065..289670a 100644
--- a/usr.sbin/ppp/fsm.c
+++ b/usr.sbin/ppp/fsm.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: fsm.c,v 1.32 1998/06/20 01:55:28 brian Exp $
+ * $Id: fsm.c,v 1.33 1998/06/25 22:33:20 brian Exp $
*
* TODO:
*/
@@ -210,6 +210,21 @@ FsmOpenNow(void *v)
timer_Stop(&fp->OpenTimer);
if (fp->state <= ST_STOPPED) {
+ if (fp->state != ST_STARTING) {
+ /*
+ * In practice, we're only here in ST_STOPPED (when delaying the
+ * first config request) or ST_CLOSED (when openmode == 0).
+ *
+ * The ST_STOPPED bit is breaking the RFC already :-(
+ *
+ * According to the RFC (1661) state transition table, a TLS isn't
+ * required for an Open event when state == Closed, but the RFC
+ * must be wrong as TLS hasn't yet been called (since the last TLF)
+ * ie, Initial gets an `Up' event, Closing gets a RTA etc.
+ */
+ (*fp->fn->LayerStart)(fp);
+ (*fp->parent->LayerStart)(fp->parent->object, fp);
+ }
FsmInitRestartCounter(fp);
FsmSendConfigReq(fp);
NewState(fp, ST_REQSENT);
@@ -227,12 +242,12 @@ fsm_Open(struct fsm * fp)
break;
case ST_CLOSED:
if (fp->open_mode == OPEN_PASSIVE) {
- NewState(fp, ST_STOPPED);
+ NewState(fp, ST_STOPPED); /* XXX: This is a hack ! */
} else if (fp->open_mode > 0) {
if (fp->open_mode > 1)
log_Printf(LogPHASE, "%s: Entering STOPPED state for %d seconds\n",
fp->link->name, fp->open_mode);
- NewState(fp, ST_STOPPED);
+ NewState(fp, ST_STOPPED); /* XXX: This is a not-so-bad hack ! */
timer_Stop(&fp->OpenTimer);
fp->OpenTimer.load = fp->open_mode * SECTICKS;
fp->OpenTimer.func = FsmOpenNow;
@@ -258,7 +273,7 @@ void
fsm_Up(struct fsm * fp)
{
switch (fp->state) {
- case ST_INITIAL:
+ case ST_INITIAL:
log_Printf(fp->LogLevel, "FSM: Using \"%s\" as a transport\n",
fp->link->name);
NewState(fp, ST_CLOSED);
@@ -764,7 +779,7 @@ FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
struct physical *p = link2physical(fp->link);
u_short *sp, proto;
- sp = (u_short *) MBUF_CTOP(bp);
+ sp = (u_short *)MBUF_CTOP(bp);
proto = ntohs(*sp);
log_Printf(fp->LogLevel, "%s: -- Protocol 0x%04x (%s) was rejected!\n",
fp->link->name, proto, hdlc_Protocol2Nam(proto));
diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c
index 7fae8bd..d6f113d 100644
--- a/usr.sbin/ppp/hdlc.c
+++ b/usr.sbin/ppp/hdlc.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: hdlc.c,v 1.32 1998/06/15 19:06:09 brian Exp $
+ * $Id: hdlc.c,v 1.33 1998/06/16 19:40:37 brian Exp $
*
* TODO:
*/
@@ -62,7 +62,7 @@
#include "filter.h"
#include "bundle.h"
-static u_short const fcstab[256] = {
+static u_int16_t const fcstab[256] = {
/* 00 */ 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
/* 08 */ 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
/* 10 */ 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c
index 406c382..a602ef6 100644
--- a/usr.sbin/ppp/id.c
+++ b/usr.sbin/ppp/id.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: id.c,v 1.9 1998/05/28 23:15:36 brian Exp $
+ * $Id: id.c,v 1.10 1998/05/29 18:33:08 brian Exp $
*/
#include <sys/types.h>
@@ -153,7 +153,7 @@ ID0write(int fd, const void *data, size_t len)
ID0set0();
ret = write(fd, data, len);
- log_Printf(LogID0, "%d = write(%d, data, %d)\n", ret, fd, len);
+ log_Printf(LogID0, "%d = write(%d, data, %ld)\n", ret, fd, (long)len);
ID0setuser();
return ret;
}
@@ -236,7 +236,7 @@ ID0bind_un(int s, const struct sockaddr_un *name)
ID0set0();
result = bind(s, (const struct sockaddr *)name, sizeof *name);
log_Printf(LogID0, "%d = bind(%d, \"%s\", %d)\n",
- result, s, name->sun_path, sizeof *name);
+ result, s, name->sun_path, (int)sizeof(*name));
ID0setuser();
return result;
}
@@ -249,7 +249,7 @@ ID0connect_un(int s, const struct sockaddr_un *name)
ID0set0();
result = connect(s, (const struct sockaddr *)name, sizeof *name);
log_Printf(LogID0, "%d = connect(%d, \"%s\", %d)\n",
- result, s, name->sun_path, sizeof *name);
+ result, s, name->sun_path, (int)sizeof(*name));
ID0setuser();
return result;
}
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c
index d2c4fd3..393788b 100644
--- a/usr.sbin/ppp/ip.c
+++ b/usr.sbin/ppp/ip.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ip.c,v 1.46 1998/06/27 14:17:26 brian Exp $
+ * $Id: ip.c,v 1.47 1998/06/27 14:18:05 brian Exp $
*
* TODO:
* o Return ICMP message for filterd packet
@@ -333,8 +333,8 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter)
n++;
}
snprintf(logbuf + loglen, sizeof logbuf - loglen,
- " seq:%x ack:%x (%d/%d)",
- ntohl(th->th_seq), ntohl(th->th_ack), len, nb);
+ " seq:%lx ack:%lx (%d/%d)",
+ (u_long)ntohl(th->th_seq), (u_long)ntohl(th->th_ack), len, nb);
loglen += strlen(logbuf + loglen);
if ((th->th_flags & TH_SYN) && nb > 40) {
u_short *sp;
@@ -379,7 +379,9 @@ ip_Input(struct bundle *bundle, struct mbuf * bp)
int nb, nw;
struct tun_data tun;
struct ip *pip = (struct ip *)tun.data;
+#ifndef NOALIAS
struct ip *piip = (struct ip *)((char *)pip + (pip->ip_hl << 2));
+#endif
tun_fill_header(tun, AF_INET);
cp = tun.data;
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c
index 21e0eef..7edbd0c 100644
--- a/usr.sbin/ppp/ipcp.c
+++ b/usr.sbin/ppp/ipcp.c
@@ -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.60 1998/06/27 14:18:06 brian Exp $
+ * $Id: ipcp.c,v 1.61 1998/06/27 16:24:52 brian Exp $
*
* TODO:
* o More RFC1772 backward compatibility
@@ -438,9 +438,6 @@ ipcp_Setup(struct ipcp *ipcp)
ipcp->peer_reject = 0;
ipcp->my_reject = 0;
-
- throughput_stop(&ipcp->throughput);
- throughput_init(&ipcp->throughput);
}
static int
@@ -524,11 +521,11 @@ static struct in_addr
ChooseHisAddr(struct bundle *bundle, const struct in_addr gw)
{
struct in_addr try;
- int f;
+ u_long f;
for (f = 0; f < bundle->ncp.ipcp.cfg.peer_list.nItems; f++) {
try = iplist_next(&bundle->ncp.ipcp.cfg.peer_list);
- log_Printf(LogDEBUG, "ChooseHisAddr: Check item %d (%s)\n",
+ log_Printf(LogDEBUG, "ChooseHisAddr: Check item %ld (%s)\n",
f, inet_ntoa(try));
if (ipcp_SetIPaddress(bundle, gw, try, 1) == 0) {
log_Printf(LogIPCP, "Selected IP address %s\n", inet_ntoa(try));
@@ -572,7 +569,7 @@ IpcpSendConfigReq(struct fsm *fp)
if (ipcp->my_compproto && !REJECTED(ipcp, TY_COMPPROTO)) {
if (ipcp->heis1172) {
- *(u_short *)o->data = htons(PROTO_VJCOMP);
+ *(u_int32_t *)o->data = htons(PROTO_VJCOMP);
INC_LCP_OPT(TY_COMPPROTO, 4, o);
} else {
*(u_int32_t *)o->data = htonl(ipcp->my_compproto);
@@ -613,7 +610,7 @@ IpcpLayerStart(struct fsm *fp)
/* We're about to start up ! */
struct ipcp *ipcp = fsm2ipcp(fp);
- log_Printf(LogIPCP, "%s: IpcpLayerStart.\n", fp->link->name);
+ log_Printf(LogIPCP, "%s: LayerStart.\n", fp->link->name);
throughput_start(&ipcp->throughput, "IPCP throughput",
Enabled(fp->bundle, OPT_THROUGHPUT));
@@ -626,7 +623,7 @@ IpcpLayerFinish(struct fsm *fp)
/* We're now down */
struct ipcp *ipcp = fsm2ipcp(fp);
- log_Printf(LogIPCP, "%s: IpcpLayerFinish.\n", fp->link->name);
+ log_Printf(LogIPCP, "%s: LayerFinish.\n", fp->link->name);
throughput_stop(&ipcp->throughput);
throughput_log(&ipcp->throughput, LogIPCP, NULL);
}
@@ -678,7 +675,7 @@ IpcpLayerDown(struct fsm *fp)
const char *s;
s = inet_ntoa(ipcp->peer_ifip);
- log_Printf(LogIPCP, "%s: IpcpLayerDown: %s\n", fp->link->name, s);
+ log_Printf(LogIPCP, "%s: LayerDown: %s\n", fp->link->name, s);
/*
* XXX this stuff should really live in the FSM. Our config should
@@ -722,7 +719,7 @@ IpcpLayerUp(struct fsm *fp)
struct ipcp *ipcp = fsm2ipcp(fp);
char tbuff[100];
- log_Printf(LogIPCP, "%s: IpcpLayerUp.\n", fp->link->name);
+ log_Printf(LogIPCP, "%s: LayerUp.\n", fp->link->name);
snprintf(tbuff, sizeof tbuff, "myaddr = %s ", inet_ntoa(ipcp->my_ip));
log_Printf(LogIPCP, " %s hisaddr = %s\n", tbuff, inet_ntoa(ipcp->peer_ip));
diff --git a/usr.sbin/ppp/iplist.c b/usr.sbin/ppp/iplist.c
index 48e4b5e..2eddeeb 100644
--- a/usr.sbin/ppp/iplist.c
+++ b/usr.sbin/ppp/iplist.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: iplist.c,v 1.5 1998/05/21 21:45:53 brian Exp $
+ * $Id: iplist.c,v 1.6 1998/06/15 19:06:47 brian Exp $
*/
#include <sys/types.h>
@@ -43,7 +43,7 @@ do_inet_aton(const char *start, const char *end, struct in_addr *ip)
char ipstr[16];
if (end - start > 15) {
- log_Printf(LogWARN, "%.*s: Invalid IP address\n", end-start, start);
+ log_Printf(LogWARN, "%.*s: Invalid IP address\n", (int)(end-start), start);
return 0;
}
strncpy(ipstr, start, end-start);
@@ -110,7 +110,8 @@ iplist_nextrange(struct iplist *list)
end = ptr + strlen(ptr);
if (end == ptr)
return 0;
- log_Printf(LogWARN, "%.*s: Invalid IP range (skipping)\n", end - ptr, ptr);
+ log_Printf(LogWARN, "%.*s: Invalid IP range (skipping)\n",
+ (int)(end - ptr), ptr);
to = ptr;
do
*to = *end++;
@@ -168,7 +169,7 @@ iplist_reset(struct iplist *list)
}
struct in_addr
-iplist_setcurpos(struct iplist *list, int pos)
+iplist_setcurpos(struct iplist *list, long pos)
{
if (pos < 0 || pos >= list->nItems) {
list->cur.pos = -1;
@@ -206,7 +207,8 @@ int
iplist_ip2pos(struct iplist *list, struct in_addr ip)
{
struct iplist_cur cur;
- int f, result;
+ u_long f;
+ int result;
result = -1;
memcpy(&cur, &list->cur, sizeof cur);
diff --git a/usr.sbin/ppp/iplist.h b/usr.sbin/ppp/iplist.h
index ccc3335..ce1778d 100644
--- a/usr.sbin/ppp/iplist.h
+++ b/usr.sbin/ppp/iplist.h
@@ -23,24 +23,27 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: iplist.h,v 1.2 1997/12/21 12:11:06 brian Exp $
*/
+struct iplist_cur {
+ struct in_addr ip;
+ int pos;
+ char *srcptr;
+ u_long srcitem;
+ u_int32_t lstart;
+ u_long nItems;
+};
+
struct iplist {
- struct iplist_cur {
- struct in_addr ip;
- int pos;
- char *srcptr;
- int srcitem;
- u_long lstart, nItems;
- } cur;
- int nItems;
+ struct iplist_cur cur;
+ u_long nItems;
char src[LINE_LEN];
};
extern int iplist_setsrc(struct iplist *, const char *);
extern void iplist_reset(struct iplist *);
-extern struct in_addr iplist_setcurpos(struct iplist *, int);
+extern struct in_addr iplist_setcurpos(struct iplist *, long);
extern struct in_addr iplist_setrandpos(struct iplist *);
extern int iplist_ip2pos(struct iplist *, struct in_addr);
extern struct in_addr iplist_next(struct iplist *);
diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c
index 81d086c..897eb23 100644
--- a/usr.sbin/ppp/lcp.c
+++ b/usr.sbin/ppp/lcp.c
@@ -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.59 1998/06/15 19:06:13 brian Exp $
+ * $Id: lcp.c,v 1.60 1998/06/25 22:33:28 brian Exp $
*
* TODO:
* o Limit data field length by MRU
@@ -32,6 +32,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <termios.h>
#include <unistd.h>
@@ -68,7 +69,7 @@ struct lqrreq {
u_char type;
u_char length;
u_short proto; /* Quality protocol */
- u_long period; /* Reporting interval */
+ u_int32_t period; /* Reporting interval */
};
static int LcpLayerUp(struct fsm *);
@@ -135,8 +136,7 @@ lcp_ReportStatus(struct cmdargs const *arg)
struct link *l;
struct lcp *lcp;
- if (!(l = command_ChooseLink(arg)))
- return -1;
+ l = command_ChooseLink(arg);
lcp = &l->lcp;
prompt_Printf(arg->prompt, "%s: %s [%s]\n", l->name, lcp->fsm.name,
@@ -308,7 +308,7 @@ LcpSendConfigReq(struct fsm *fp)
}
if (!REJECTED(lcp, TY_MRU)) {
- *(u_short *)o->data = htons(lcp->want_mru);
+ *(u_int16_t *)o->data = htons(lcp->want_mru);
INC_LCP_OPT(TY_MRU, 4, o);
}
@@ -318,26 +318,26 @@ LcpSendConfigReq(struct fsm *fp)
}
if (lcp->want_lqrperiod && !REJECTED(lcp, TY_QUALPROTO)) {
- *(u_short *)o->data = htons(PROTO_LQR);
- *(u_long *)(o->data + 2) = htonl(lcp->want_lqrperiod);
+ *(u_int16_t *)o->data = htons(PROTO_LQR);
+ *(u_int32_t *)(o->data + 2) = htonl(lcp->want_lqrperiod);
INC_LCP_OPT(TY_QUALPROTO, 8, o);
}
switch (lcp->want_auth) {
case PROTO_PAP:
- *(u_short *)o->data = htons(PROTO_PAP);
+ *(u_int16_t *)o->data = htons(PROTO_PAP);
INC_LCP_OPT(TY_AUTHPROTO, 4, o);
break;
case PROTO_CHAP:
- *(u_short *)o->data = htons(PROTO_CHAP);
+ *(u_int16_t *)o->data = htons(PROTO_CHAP);
o->data[2] = 0x05;
INC_LCP_OPT(TY_AUTHPROTO, 5, o);
break;
}
if (lcp->want_mrru && !REJECTED(lcp, TY_MRRU)) {
- *(u_short *)o->data = htons(lcp->want_mrru);
+ *(u_int16_t *)o->data = htons(lcp->want_mrru);
INC_LCP_OPT(TY_MRRU, 4, o);
if (lcp->want_shortseq && !REJECTED(lcp, TY_SHORTSEQ))
@@ -380,7 +380,7 @@ LcpLayerStart(struct fsm *fp)
/* We're about to start up ! */
struct lcp *lcp = fsm2lcp(fp);
- log_Printf(LogLCP, "%s: LcpLayerStart\n", fp->link->name);
+ log_Printf(LogLCP, "%s: LayerStart\n", fp->link->name);
lcp->LcpFailedMagic = 0;
}
@@ -388,7 +388,7 @@ static void
LcpLayerFinish(struct fsm *fp)
{
/* We're now down */
- log_Printf(LogLCP, "%s: LcpLayerFinish\n", fp->link->name);
+ log_Printf(LogLCP, "%s: LayerFinish\n", fp->link->name);
}
static int
@@ -398,7 +398,7 @@ LcpLayerUp(struct fsm *fp)
struct physical *p = link2physical(fp->link);
struct lcp *lcp = fsm2lcp(fp);
- log_Printf(LogLCP, "%s: LcpLayerUp\n", fp->link->name);
+ log_Printf(LogLCP, "%s: LayerUp\n", fp->link->name);
async_SetLinkParams(&p->async, lcp);
lqr_Start(lcp);
hdlc_StartTimer(&p->hdlc);
@@ -411,7 +411,7 @@ LcpLayerDown(struct fsm *fp)
/* About to come down */
struct physical *p = link2physical(fp->link);
- log_Printf(LogLCP, "%s: LcpLayerDown\n", fp->link->name);
+ log_Printf(LogLCP, "%s: LayerDown\n", fp->link->name);
hdlc_StopTimer(&p->hdlc);
lqr_StopTimer(p);
lcp_Setup(fsm2lcp(fp), 0);
@@ -425,7 +425,8 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
struct lcp *lcp = fsm2lcp(fp);
int type, length, sz, pos;
u_int32_t magic, accmap;
- u_short mtu, mru, *sp, proto;
+ u_short mtu, mru, proto;
+ u_int16_t *sp;
struct lqrreq *req;
char request[20], desc[22];
struct mp *mp;
@@ -448,7 +449,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
switch (type) {
case TY_MRRU:
mp = &lcp->fsm.bundle->ncp.mp;
- sp = (u_short *)(cp + 2);
+ sp = (u_int16_t *)(cp + 2);
mru = htons(*sp);
log_Printf(LogLCP, "%s %u\n", request, mru);
@@ -463,7 +464,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
if (mru < MIN_MRU || mru < mtu) {
/* Push him up to MTU or MIN_MRU */
lcp->his_mrru = mru < mtu ? mtu : MIN_MRU;
- *sp = htons((u_short)lcp->his_mrru);
+ *sp = htons((u_int16_t)lcp->his_mrru);
memcpy(dec->nakend, cp, 4);
dec->nakend += 4;
} else {
@@ -498,7 +499,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
break;
case TY_MRU:
- sp = (u_short *) (cp + 2);
+ sp = (u_int16_t *) (cp + 2);
mru = htons(*sp);
log_Printf(LogLCP, "%s %d\n", request, mru);
@@ -508,7 +509,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
if (mru < MIN_MRU || (!lcp->want_mrru && mru < mtu)) {
/* Push him up to MTU or MIN_MRU */
lcp->his_mru = mru < mtu ? mtu : MIN_MRU;
- *sp = htons((u_short)lcp->his_mru);
+ *sp = htons((u_int16_t)lcp->his_mru);
memcpy(dec->nakend, cp, 4);
dec->nakend += 4;
} else {
@@ -551,7 +552,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
break;
case TY_AUTHPROTO:
- sp = (u_short *) (cp + 2);
+ sp = (u_int16_t *) (cp + 2);
proto = ntohs(*sp);
switch (proto) {
case PROTO_PAP:
@@ -653,16 +654,16 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
case TY_QUALPROTO:
req = (struct lqrreq *)cp;
- log_Printf(LogLCP, "%s proto %x, interval %ldms\n",
- request, ntohs(req->proto), (long)ntohl(req->period) * 10);
+ log_Printf(LogLCP, "%s proto %x, interval %lums\n",
+ request, ntohs(req->proto), (u_long)ntohl(req->period) * 10);
switch (mode_type) {
case MODE_REQ:
if (ntohs(req->proto) != PROTO_LQR || !IsAccepted(lcp->cfg.lqr))
goto reqreject;
else {
lcp->his_lqrperiod = ntohl(req->period);
- if (lcp->his_lqrperiod < 500)
- lcp->his_lqrperiod = 500;
+ if (lcp->his_lqrperiod < MIN_LQRPERIOD * 100)
+ lcp->his_lqrperiod = MIN_LQRPERIOD * 100;
req->period = htonl(lcp->his_lqrperiod);
memcpy(dec->ackend, cp, length);
dec->ackend += length;
@@ -829,8 +830,8 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
log_Printf(LogLCP, " ENDDISC rejected - unrecognised class %d\n",
cp[2]);
else
- log_Printf(LogLCP, " ENDDISC rejected - local max length is %d\n",
- sizeof p->dl->peer.enddisc.address - 1);
+ log_Printf(LogLCP, " ENDDISC rejected - local max length is %ld\n",
+ (long)(sizeof p->dl->peer.enddisc.address - 1));
goto reqreject;
}
break;
diff --git a/usr.sbin/ppp/lcp.h b/usr.sbin/ppp/lcp.h
index 69ef41c..03e87a4 100644
--- a/usr.sbin/ppp/lcp.h
+++ b/usr.sbin/ppp/lcp.h
@@ -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.23 1998/05/01 19:24:57 brian Exp $
+ * $Id: lcp.h,v 1.17 1998/05/21 21:46:03 brian Exp $
*
* TODO:
*/
@@ -28,7 +28,7 @@ struct lcp {
u_int16_t his_mrru; /* Peers maximum reassembled packet size (MP) */
u_int32_t his_accmap; /* Peeers async char control map */
u_int32_t his_magic; /* Peers magic number */
- u_int32_t his_lqrperiod; /* Peers LQR frequency */
+ u_int32_t his_lqrperiod; /* Peers LQR frequency (100ths of seconds) */
u_short his_auth; /* Peer wants this type of authentication */
unsigned his_shortseq : 1; /* Peer would like only 12bit seqs (MP) */
unsigned his_protocomp : 1; /* Does peer do Protocol field compression */
@@ -38,7 +38,7 @@ struct lcp {
u_short want_mrru; /* Our maximum reassembled packet size (MP) */
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 */
+ u_int32_t want_lqrperiod; /* Our LQR frequency (100ths of seconds) */
u_short want_auth; /* We want this type of authentication */
unsigned want_shortseq : 1; /* I'd like only 12bit seqs (MP) */
unsigned want_protocomp : 1; /* Do we do protocol field compression */
@@ -56,7 +56,7 @@ struct lcp {
u_short mru; /* Preferred MRU value */
u_int32_t accmap; /* Initial ACCMAP value */
int openmode; /* when to start CFG REQs */
- u_int lqrperiod; /* LQR frequency */
+ u_int32_t lqrperiod; /* LQR frequency (seconds) */
u_int fsmretry; /* FSM retry frequency */
unsigned acfcomp : 2; /* Address & Control Field Compression neg */
diff --git a/usr.sbin/ppp/link.c b/usr.sbin/ppp/link.c
index ead0e14..21be939 100644
--- a/usr.sbin/ppp/link.c
+++ b/usr.sbin/ppp/link.c
@@ -23,13 +23,14 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: link.c,v 1.1.2.20 1998/05/01 19:24:59 brian Exp $
+ * $Id: link.c,v 1.2 1998/05/21 21:46:10 brian Exp $
*
*/
#include <sys/types.h>
#include <stdio.h>
+#include <string.h>
#include <termios.h>
#include "mbuf.h"
diff --git a/usr.sbin/ppp/lqr.c b/usr.sbin/ppp/lqr.c
index 6bf1090..4970672 100644
--- a/usr.sbin/ppp/lqr.c
+++ b/usr.sbin/ppp/lqr.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: lqr.c,v 1.27 1998/06/16 19:40:38 brian Exp $
+ * $Id: lqr.c,v 1.28 1998/06/26 19:02:40 brian Exp $
*
* o LQR based on RFC1333
*
@@ -92,11 +92,11 @@ lqr_RecvEcho(struct fsm *fp, struct mbuf * bp)
seq > hdlc->lqm.echo.seq_recv))
hdlc->lqm.echo.seq_recv = seq;
} else
- log_Printf(LogWARN, "lqr_RecvEcho: Got sig 0x%08x, expecting 0x%08x !\n",
- (unsigned)ntohl(lqr->signature), (unsigned)SIGNATURE);
+ log_Printf(LogWARN, "lqr_RecvEcho: Got sig 0x%08lx, not 0x%08lx !\n",
+ (u_long)ntohl(lqr->signature), (u_long)SIGNATURE);
} else
- log_Printf(LogWARN, "lqr_RecvEcho: Got packet size %d, expecting %d !\n",
- mbuf_Length(bp), sizeof(struct echolqr));
+ log_Printf(LogWARN, "lqr_RecvEcho: Got packet size %d, expecting %ld !\n",
+ mbuf_Length(bp), (long)sizeof(struct echolqr));
}
void
@@ -166,8 +166,8 @@ lqr_Input(struct physical *physical, struct mbuf *bp)
len = mbuf_Length(bp);
if (len != sizeof(struct lqrdata))
- log_Printf(LogWARN, "lqr_Input: Got packet size %d, expecting %d !\n",
- len, sizeof(struct lqrdata));
+ log_Printf(LogWARN, "lqr_Input: Got packet size %d, expecting %ld !\n",
+ len, (long)sizeof(struct lqrdata));
else if (!IsAccepted(physical->link.lcp.cfg.lqr) &&
!(physical->hdlc.lqm.method & LQM_LQR)) {
bp->offset -= 2;
@@ -181,9 +181,10 @@ lqr_Input(struct physical *physical, struct mbuf *bp)
lqr = (struct lqrdata *)MBUF_CTOP(bp);
lcp = physical->hdlc.lqm.owner;
if (ntohl(lqr->MagicNumber) != physical->hdlc.lqm.owner->his_magic)
- log_Printf(LogWARN, "lqr_Input: magic 0x%x is wrong, expecting 0x%x\n",
- (unsigned)ntohl(lqr->MagicNumber),
- physical->hdlc.lqm.owner->his_magic);
+ log_Printf(LogWARN, "lqr_Input: magic 0x%08lx is wrong,"
+ " expecting 0x%08lx\n",
+ (u_long)ntohl(lqr->MagicNumber),
+ (u_long)physical->hdlc.lqm.owner->his_magic);
else {
/*
* Remember our PeerInLQRs, then convert byte order and save
diff --git a/usr.sbin/ppp/mbuf.c b/usr.sbin/ppp/mbuf.c
index 9dbce18..2f5df24 100644
--- a/usr.sbin/ppp/mbuf.c
+++ b/usr.sbin/ppp/mbuf.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: mbuf.c,v 1.16 1998/06/16 07:15:11 brian Exp $
+ * $Id: mbuf.c,v 1.17 1998/06/16 19:40:20 brian Exp $
*
*/
#include <sys/types.h>
@@ -63,7 +63,8 @@ mbuf_Alloc(int cnt, int type)
log_Printf(LogERROR, "Bad mbuf type %d\n", type);
bp = (struct mbuf *) malloc(sizeof(struct mbuf));
if (bp == NULL) {
- log_Printf(LogALERT, "failed to allocate memory: %u\n", sizeof(struct mbuf));
+ log_Printf(LogALERT, "failed to allocate memory: %ld\n",
+ (long)sizeof(struct mbuf));
AbortProgram(EX_OSERR);
}
memset(bp, '\0', sizeof(struct mbuf));
diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c
index 6c70274..79a89c7 100644
--- a/usr.sbin/ppp/pap.c
+++ b/usr.sbin/ppp/pap.c
@@ -18,7 +18,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pap.c,v 1.20.2.28 1998/05/01 19:25:30 brian Exp $
+ * $Id: pap.c,v 1.23 1998/05/21 21:47:18 brian Exp $
*
* TODO:
*/
@@ -28,6 +28,7 @@
#include <netinet/ip.h>
#include <sys/un.h>
+#include <string.h>
#include <termios.h>
#include "mbuf.h"
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8
index afff3e2..1a0c454 100644
--- a/usr.sbin/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp.8
@@ -1,4 +1,4 @@
-.\" $Id: ppp.8,v 1.109 1998/06/21 11:14:50 brian Exp $
+.\" $Id: ppp.8,v 1.110 1998/06/25 22:33:31 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@@ -2976,23 +2976,29 @@ Setting this option enables Multi-link PPP negotiations, also known as
Multi-link Protocol or MP. There is no default MRRU (Maximum
Reconstructed Receive Unit) value. If no argument is given, multi-link
mode is disabled.
-.It set mru Ar value
+.It set mru Op Ar value
The default MRU (Maximum Receive Unit) is 1500. If it is increased, the
other side *may* increase its mtu. There is no point in decreasing the
MRU to below the default as the
.Em PPP
-protocol *must* be able to accept packets of at least 1500 octets.
-.It set mtu Ar value
+protocol *must* be able to accept packets of at least 1500 octets. If
+no argument is given, 1500 is assumed.
+.It set mtu Op Ar value
The default MTU is 1500. At negotiation time,
.Nm
will accept whatever MRU or MRRU that the peer wants (assuming it's
not less than 296 bytes). If the MTU is set,
.Nm
-will not accept MRU/MRRU values less that the set value. When
-negotiations are complete, the MTU is assigned to the interface, even
+will not accept MRU/MRRU values less than
+.Ar value .
+When negotiations are complete, the MTU is assigned to the interface, even
if the peer requested a higher value MRU/MRRU. This can be useful for
limiting your packet size (giving better bandwidth sharing at the expense
of more header data).
+.Pp
+If no
+.Ar value
+is given, 1500, or whatever the peer asks for is used.
.It set nbns Op Ar x.x.x.x Op Ar y.y.y.y
This option allows the setting of the Microsoft NetBIOS name server
values to be returned at the peers request. If no values are given,
diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4
index afff3e2..1a0c454 100644
--- a/usr.sbin/ppp/ppp.8.m4
+++ b/usr.sbin/ppp/ppp.8.m4
@@ -1,4 +1,4 @@
-.\" $Id: ppp.8,v 1.109 1998/06/21 11:14:50 brian Exp $
+.\" $Id: ppp.8,v 1.110 1998/06/25 22:33:31 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@@ -2976,23 +2976,29 @@ Setting this option enables Multi-link PPP negotiations, also known as
Multi-link Protocol or MP. There is no default MRRU (Maximum
Reconstructed Receive Unit) value. If no argument is given, multi-link
mode is disabled.
-.It set mru Ar value
+.It set mru Op Ar value
The default MRU (Maximum Receive Unit) is 1500. If it is increased, the
other side *may* increase its mtu. There is no point in decreasing the
MRU to below the default as the
.Em PPP
-protocol *must* be able to accept packets of at least 1500 octets.
-.It set mtu Ar value
+protocol *must* be able to accept packets of at least 1500 octets. If
+no argument is given, 1500 is assumed.
+.It set mtu Op Ar value
The default MTU is 1500. At negotiation time,
.Nm
will accept whatever MRU or MRRU that the peer wants (assuming it's
not less than 296 bytes). If the MTU is set,
.Nm
-will not accept MRU/MRRU values less that the set value. When
-negotiations are complete, the MTU is assigned to the interface, even
+will not accept MRU/MRRU values less than
+.Ar value .
+When negotiations are complete, the MTU is assigned to the interface, even
if the peer requested a higher value MRU/MRRU. This can be useful for
limiting your packet size (giving better bandwidth sharing at the expense
of more header data).
+.Pp
+If no
+.Ar value
+is given, 1500, or whatever the peer asks for is used.
.It set nbns Op Ar x.x.x.x Op Ar y.y.y.y
This option allows the setting of the Microsoft NetBIOS name server
values to be returned at the peers request. If no values are given,
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c
index 644e557..5dc9061 100644
--- a/usr.sbin/ppp/route.c
+++ b/usr.sbin/ppp/route.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: route.c,v 1.49 1998/06/16 19:40:40 brian Exp $
+ * $Id: route.c,v 1.50 1998/06/27 12:03:49 brian Exp $
*
*/
@@ -80,8 +80,8 @@ p_sockaddr(struct prompt *prompt, struct sockaddr *phost,
else if (!mask)
strcpy(buf, inet_ntoa(ihost->sin_addr));
else {
- u_int msk = ntohl(mask->sin_addr.s_addr);
- u_int tst;
+ u_int32_t msk = ntohl(mask->sin_addr.s_addr);
+ u_int32_t tst;
int bits;
int len;
struct sockaddr_in net;
@@ -90,20 +90,20 @@ p_sockaddr(struct prompt *prompt, struct sockaddr *phost,
if (msk & tst)
break;
- for (tst <<=1; tst; tst <<= 1)
+ for (tst <<= 1; tst; tst <<= 1)
if (!(msk & tst))
break;
net.sin_addr.s_addr = ihost->sin_addr.s_addr & mask->sin_addr.s_addr;
strcpy(buf, inet_ntoa(net.sin_addr));
- for (len = strlen(buf); len > 3; buf[len-=2] = '\0')
- if (strcmp(buf+len-2, ".0"))
+ for (len = strlen(buf); len > 3; buf[len -= 2] = '\0')
+ if (strcmp(buf + len - 2, ".0"))
break;
if (tst) /* non-contiguous :-( */
- sprintf(buf+strlen(buf),"&0x%08x", msk);
+ sprintf(buf + strlen(buf),"&0x%08lx", (u_long)msk);
else
- sprintf(buf+strlen(buf), "/%d", bits);
+ sprintf(buf + strlen(buf), "/%d", bits);
}
break;
diff --git a/usr.sbin/ppp/vjcomp.c b/usr.sbin/ppp/vjcomp.c
index c60b434..79dca09 100644
--- a/usr.sbin/ppp/vjcomp.c
+++ b/usr.sbin/ppp/vjcomp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: vjcomp.c,v 1.19 1998/06/15 19:06:58 brian Exp $
+ * $Id: vjcomp.c,v 1.20 1998/06/16 19:40:42 brian Exp $
*
* TODO:
*/
@@ -28,6 +28,7 @@
#include <sys/un.h>
#include <stdio.h>
+#include <string.h>
#include "mbuf.h"
#include "log.h"
OpenPOWER on IntegriCloud