o Remove the global CcpInfo. It's now part of the datalink.
Struct bundle will have its own struct ccp in the future too. o The ``set stopped'' command now requires context and doesn't work on the IPCP FSM. o Check if it's time to break out of our top level loop before doing a select - otherwise, we'll select forever :-( o Remove `struct link'::ccp (a temporary hack). It turns out that IpStartOutput() calls link_Output() and link_Output() incorrectly calls StartOutput() (really modem_StartOutput) requiring the ccp knowledge so that it can call IpStartOutput()... The end result is that the whole IP output queue gets dumped into the modem output queue and a pile of physical writes are done prematurely. This makes the (original) code in main() actually work in that it would not bother selecting() on the tun descriptor when our modem queue length was 20 or greater. Instead, we now make that decision based on the overall queue length. This will need improvement later.
This commit is contained in:
parent
503a7782d8
commit
f4768038f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=33754
@ -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.14 1998/02/18 00:27:44 brian Exp $
|
||||
* $Id: bundle.c,v 1.1.2.15 1998/02/21 01:44:58 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -92,6 +92,8 @@ bundle_PhaseName(struct bundle *bundle)
|
||||
void
|
||||
bundle_NewPhase(struct bundle *bundle, struct physical *physical, u_int new)
|
||||
{
|
||||
struct datalink *dl;
|
||||
|
||||
if (new == bundle->phase)
|
||||
return;
|
||||
|
||||
@ -129,8 +131,12 @@ bundle_NewPhase(struct bundle *bundle, struct physical *physical, u_int new)
|
||||
ipcp_Setup(&IpcpInfo);
|
||||
IpcpUp();
|
||||
IpcpOpen();
|
||||
CcpUp();
|
||||
CcpOpen();
|
||||
/* XXX: The datalink should be doing this ... */
|
||||
for (dl = bundle->links; dl; dl = dl->next)
|
||||
if (dl->state == DATALINK_OPEN) {
|
||||
CcpUp(&dl->ccp);
|
||||
CcpOpen(&dl->ccp);
|
||||
}
|
||||
/* Fall through */
|
||||
|
||||
case PHASE_TERMINATE:
|
||||
@ -195,7 +201,9 @@ bundle_LayerUp(struct bundle *bundle, struct fsm *fp)
|
||||
{
|
||||
/*
|
||||
* The given fsm is now up
|
||||
* If it's an lcp, tell the datalink
|
||||
* If it's the first datalink, bring all NCPs up.
|
||||
* If it's an NCP, tell our background mode parent to go away.
|
||||
*/
|
||||
if (fp == &LcpInfo.fsm)
|
||||
bundle_NewPhase(bundle, link2physical(fp->link), PHASE_AUTHENTICATE);
|
||||
@ -595,11 +603,12 @@ bundle_LayerFinish(struct bundle *bundle, struct fsm *fp)
|
||||
* If it's the last NCP, FsmClose all LCPs and enter TERMINATE phase.
|
||||
*/
|
||||
|
||||
if (fp == &CcpInfo.fsm) {
|
||||
FsmDown(&CcpInfo.fsm);
|
||||
FsmOpen(&CcpInfo.fsm);
|
||||
if (fp->proto == PROTO_CCP) {
|
||||
FsmDown(fp);
|
||||
FsmOpen(fp);
|
||||
} else if (fp == &LcpInfo.fsm) {
|
||||
FsmDown(&CcpInfo.fsm);
|
||||
/* XXX fix me */
|
||||
FsmDown(&bundle->links->ccp.fsm);
|
||||
|
||||
FsmDown(&IpcpInfo.fsm); /* You've lost your underlings */
|
||||
FsmClose(&IpcpInfo.fsm); /* ST_INITIAL please */
|
||||
@ -661,7 +670,10 @@ bundle2physical(struct bundle *bundle, const char *name)
|
||||
struct ccp *
|
||||
bundle2ccp(struct bundle *bundle, const char *name)
|
||||
{
|
||||
return &CcpInfo;
|
||||
struct datalink *dl = bundle2datalink(bundle, name);
|
||||
if (dl)
|
||||
return &dl->ccp;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct link *
|
||||
@ -694,11 +706,12 @@ bundle_FillQueues(struct bundle *bundle)
|
||||
for (dl = bundle->links; dl; dl = dl->next) {
|
||||
packets = link_QueueLen(&dl->physical->link);
|
||||
if (packets == 0) {
|
||||
IpStartOutput(&dl->physical->link);
|
||||
IpStartOutput(&dl->physical->link, bundle);
|
||||
packets = link_QueueLen(&dl->physical->link);
|
||||
}
|
||||
total += packets;
|
||||
}
|
||||
total += ip_QueueLen();
|
||||
|
||||
return total;
|
||||
}
|
||||
|
@ -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.11 1998/02/19 19:56:53 brian Exp $
|
||||
* $Id: ccp.c,v 1.30.2.12 1998/02/21 01:45:00 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Support other compression protocols
|
||||
@ -77,8 +77,6 @@ static struct fsm_callbacks ccp_Callbacks = {
|
||||
CcpRecvResetAck
|
||||
};
|
||||
|
||||
struct ccp CcpInfo;
|
||||
|
||||
static char const *cftypes[] = {
|
||||
/* Check out the latest ``Compression Control Protocol'' rfc (rfc1962.txt) */
|
||||
"OUI", /* 0: OUI */
|
||||
@ -139,7 +137,7 @@ void
|
||||
ccp_Init(struct ccp *ccp, struct bundle *bundle, struct link *l)
|
||||
{
|
||||
/* Initialise ourselves */
|
||||
fsm_Init(&CcpInfo.fsm, "CCP", PROTO_CCP, CCP_MAXCODE, 10, LogCCP,
|
||||
fsm_Init(&ccp->fsm, "CCP", PROTO_CCP, CCP_MAXCODE, 10, LogCCP,
|
||||
bundle, l, &ccp_Callbacks);
|
||||
ccp_Setup(ccp);
|
||||
}
|
||||
@ -290,31 +288,31 @@ CcpLayerUp(struct fsm *fp)
|
||||
}
|
||||
|
||||
void
|
||||
CcpUp()
|
||||
CcpUp(struct ccp *ccp)
|
||||
{
|
||||
/* Lower layers are ready.... go */
|
||||
FsmUp(&CcpInfo.fsm);
|
||||
LogPrintf(LogCCP, "CCP Up event!!\n");
|
||||
FsmUp(&ccp->fsm);
|
||||
}
|
||||
|
||||
void
|
||||
CcpOpen()
|
||||
CcpOpen(struct ccp *ccp)
|
||||
{
|
||||
/* Start CCP please */
|
||||
int f;
|
||||
|
||||
for (f = 0; f < NALGORITHMS; f++)
|
||||
if (Enabled(algorithm[f]->Conf)) {
|
||||
CcpInfo.fsm.open_mode = 0;
|
||||
FsmOpen(&CcpInfo.fsm);
|
||||
ccp->fsm.open_mode = 0;
|
||||
FsmOpen(&ccp->fsm);
|
||||
break;
|
||||
}
|
||||
|
||||
if (f == NALGORITHMS)
|
||||
for (f = 0; f < NALGORITHMS; f++)
|
||||
if (Acceptable(algorithm[f]->Conf)) {
|
||||
CcpInfo.fsm.open_mode = OPEN_PASSIVE;
|
||||
FsmOpen(&CcpInfo.fsm);
|
||||
ccp->fsm.open_mode = OPEN_PASSIVE;
|
||||
FsmOpen(&ccp->fsm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -408,11 +406,11 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type)
|
||||
}
|
||||
|
||||
void
|
||||
CcpInput(struct bundle *bundle, struct mbuf *bp)
|
||||
CcpInput(struct ccp *ccp, struct bundle *bundle, struct mbuf *bp)
|
||||
{
|
||||
/* Got PROTO_CCP from link */
|
||||
if (bundle_Phase(bundle) == PHASE_NETWORK)
|
||||
FsmInput(&CcpInfo.fsm, bp);
|
||||
FsmInput(&ccp->fsm, bp);
|
||||
else if (bundle_Phase(bundle) < PHASE_NETWORK) {
|
||||
LogPrintf(LogCCP, "Error: Unexpected CCP in phase %s (ignored)\n",
|
||||
bundle_PhaseName(bundle));
|
||||
@ -424,24 +422,26 @@ static void
|
||||
CcpRecvResetAck(struct fsm *fp, u_char id)
|
||||
{
|
||||
/* Got a reset ACK, reset incoming dictionary */
|
||||
if (CcpInfo.reset_sent != -1) {
|
||||
if (id != CcpInfo.reset_sent) {
|
||||
struct ccp *ccp = fsm2ccp(fp);
|
||||
|
||||
if (ccp->reset_sent != -1) {
|
||||
if (id != ccp->reset_sent) {
|
||||
LogPrintf(LogWARN, "CCP: Incorrect ResetAck (id %d, not %d) ignored\n",
|
||||
id, CcpInfo.reset_sent);
|
||||
id, ccp->reset_sent);
|
||||
return;
|
||||
}
|
||||
/* Whaddaya know - a correct reset ack */
|
||||
} else if (id == CcpInfo.last_reset)
|
||||
} else if (id == ccp->last_reset)
|
||||
LogPrintf(LogCCP, "Duplicate ResetAck (resetting again)\n");
|
||||
else {
|
||||
LogPrintf(LogWARN, "CCP: Unexpected ResetAck (id %d) ignored\n", id);
|
||||
return;
|
||||
}
|
||||
|
||||
CcpInfo.last_reset = CcpInfo.reset_sent;
|
||||
CcpInfo.reset_sent = -1;
|
||||
if (CcpInfo.in_init)
|
||||
(*algorithm[CcpInfo.in_algorithm]->i.Reset)();
|
||||
ccp->last_reset = ccp->reset_sent;
|
||||
ccp->reset_sent = -1;
|
||||
if (ccp->in_init)
|
||||
(*algorithm[ccp->in_algorithm]->i.Reset)();
|
||||
}
|
||||
|
||||
int
|
||||
@ -450,7 +450,7 @@ ccp_Output(struct ccp *ccp, struct link *l, int pri, u_short proto,
|
||||
{
|
||||
/* Compress outgoing Network Layer data */
|
||||
if ((proto & 0xfff1) == 0x21 && ccp->fsm.state == ST_OPENED && ccp->out_init)
|
||||
return (*algorithm[ccp->out_algorithm]->o.Write)(l, pri, proto, m);
|
||||
return (*algorithm[ccp->out_algorithm]->o.Write)(ccp, l, pri, proto, m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -469,12 +469,12 @@ ccp_Decompress(struct ccp *ccp, u_short *proto, struct mbuf *bp)
|
||||
LogPrintf(LogCCP, "ReSendResetReq(%d)\n", ccp->reset_sent);
|
||||
FsmOutput(&ccp->fsm, CODE_RESETREQ, ccp->reset_sent, NULL, 0);
|
||||
} else if (ccp->in_init)
|
||||
return (*algorithm[ccp->in_algorithm]->i.Read)(proto, bp);
|
||||
return (*algorithm[ccp->in_algorithm]->i.Read)(ccp, proto, bp);
|
||||
pfree(bp);
|
||||
bp = NULL;
|
||||
} else if ((*proto & 0xfff1) == 0x21 && ccp->in_init)
|
||||
/* Add incoming Network Layer traffic to our dictionary */
|
||||
(*algorithm[ccp->in_algorithm]->i.DictSetup)(*proto, bp);
|
||||
(*algorithm[ccp->in_algorithm]->i.DictSetup)(ccp, *proto, bp);
|
||||
|
||||
return bp;
|
||||
}
|
||||
|
@ -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.9 1998/02/18 19:36:11 brian Exp $
|
||||
* $Id: ccp.h,v 1.14.2.10 1998/02/21 01:45:03 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -57,8 +57,6 @@ struct ccp {
|
||||
u_long uncompin, compin;
|
||||
};
|
||||
|
||||
extern struct ccp CcpInfo;
|
||||
|
||||
#define fsm2ccp(fp) (fp->proto == PROTO_CCP ? (struct ccp *)fp : NULL)
|
||||
|
||||
struct ccp_algorithm {
|
||||
@ -71,8 +69,8 @@ struct ccp_algorithm {
|
||||
int (*Init)(void);
|
||||
void (*Term)(void);
|
||||
void (*Reset)(void);
|
||||
struct mbuf *(*Read)(u_short *, struct mbuf *);
|
||||
void (*DictSetup)(u_short, struct mbuf *);
|
||||
struct mbuf *(*Read)(struct ccp *, u_short *, struct mbuf *);
|
||||
void (*DictSetup)(struct ccp *, u_short, struct mbuf *);
|
||||
} i;
|
||||
struct {
|
||||
void (*Get)(struct lcp_opt *);
|
||||
@ -80,7 +78,7 @@ struct ccp_algorithm {
|
||||
int (*Init)(void);
|
||||
void (*Term)(void);
|
||||
void (*Reset)(void);
|
||||
int (*Write)(struct link *, int, u_short, struct mbuf *);
|
||||
int (*Write)(struct ccp *, struct link *, int, u_short, struct mbuf *);
|
||||
} o;
|
||||
};
|
||||
|
||||
@ -88,9 +86,9 @@ extern void ccp_Init(struct ccp *, struct bundle *, struct link *);
|
||||
extern void ccp_Setup(struct ccp *);
|
||||
|
||||
extern void CcpSendResetReq(struct fsm *);
|
||||
extern void CcpInput(struct bundle *, struct mbuf *);
|
||||
extern void CcpUp(void);
|
||||
extern void CcpOpen(void);
|
||||
extern void CcpInput(struct ccp *, struct bundle *, struct mbuf *);
|
||||
extern void CcpUp(struct ccp *);
|
||||
extern void CcpOpen(struct ccp *);
|
||||
extern int ccp_ReportStatus(struct cmdargs const *);
|
||||
extern int ccp_Output(struct ccp *, struct link *, int, u_short, struct mbuf *);
|
||||
extern struct mbuf *ccp_Decompress(struct ccp *, u_short *, struct mbuf *);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: chat.c,v 1.44.2.9 1998/02/16 19:09:40 brian Exp $
|
||||
* $Id: chat.c,v 1.44.2.10 1998/02/18 00:28:06 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -400,7 +400,7 @@ chat_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
}
|
||||
|
||||
static void
|
||||
chat_Write(struct descriptor *d, const fd_set *fdset)
|
||||
chat_Write(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
{
|
||||
struct chat *c = descriptor2chat(d);
|
||||
|
||||
|
@ -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.27 1998/02/18 19:35:32 brian Exp $
|
||||
* $Id: command.c,v 1.131.2.28 1998/02/21 01:45:04 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -460,21 +460,14 @@ ShowStopped(struct cmdargs const *arg)
|
||||
prompt_Printf(&prompt, "Disabled");
|
||||
else
|
||||
prompt_Printf(&prompt, "%ld secs",
|
||||
LcpInfo.fsm.StoppedTimer.load / SECTICKS);
|
||||
|
||||
prompt_Printf(&prompt, ", IPCP: ");
|
||||
if (!IpcpInfo.fsm.StoppedTimer.load)
|
||||
prompt_Printf(&prompt, "Disabled");
|
||||
else
|
||||
prompt_Printf(&prompt, "%ld secs",
|
||||
IpcpInfo.fsm.StoppedTimer.load / SECTICKS);
|
||||
LcpInfo.fsm.StoppedTimer.load / SECTICKS);
|
||||
|
||||
prompt_Printf(&prompt, ", CCP: ");
|
||||
if (!CcpInfo.fsm.StoppedTimer.load)
|
||||
if (!arg->cx->ccp.fsm.StoppedTimer.load)
|
||||
prompt_Printf(&prompt, "Disabled");
|
||||
else
|
||||
prompt_Printf(&prompt, "%ld secs",
|
||||
CcpInfo.fsm.StoppedTimer.load / SECTICKS);
|
||||
arg->cx->ccp.fsm.StoppedTimer.load / SECTICKS);
|
||||
|
||||
prompt_Printf(&prompt, "\n");
|
||||
|
||||
@ -620,7 +613,7 @@ static struct cmdtab const ShowCommands[] = {
|
||||
"Show routing table", "show route"},
|
||||
{"timeout", NULL, ShowTimeout, LOCAL_AUTH,
|
||||
"Show Idle timeout", "show timeout"},
|
||||
{"stopped", NULL, ShowStopped, LOCAL_AUTH,
|
||||
{"stopped", NULL, ShowStopped, LOCAL_AUTH | LOCAL_CX,
|
||||
"Show STOPPED timeout", "show stopped"},
|
||||
{"version", NULL, ShowVersion, LOCAL_NO_AUTH | LOCAL_AUTH,
|
||||
"Show version string", "show version"},
|
||||
@ -944,16 +937,12 @@ static int
|
||||
SetStoppedTimeout(struct cmdargs const *arg)
|
||||
{
|
||||
LcpInfo.fsm.StoppedTimer.load = 0;
|
||||
IpcpInfo.fsm.StoppedTimer.load = 0;
|
||||
CcpInfo.fsm.StoppedTimer.load = 0;
|
||||
if (arg->argc <= 3) {
|
||||
arg->cx->ccp.fsm.StoppedTimer.load = 0;
|
||||
if (arg->argc <= 2) {
|
||||
if (arg->argc > 0) {
|
||||
LcpInfo.fsm.StoppedTimer.load = atoi(arg->argv[0]) * SECTICKS;
|
||||
if (arg->argc > 1) {
|
||||
IpcpInfo.fsm.StoppedTimer.load = atoi(arg->argv[1]) * SECTICKS;
|
||||
if (arg->argc > 2)
|
||||
CcpInfo.fsm.StoppedTimer.load = atoi(arg->argv[2]) * SECTICKS;
|
||||
}
|
||||
if (arg->argc > 1)
|
||||
arg->cx->ccp.fsm.StoppedTimer.load = atoi(arg->argv[1]) * SECTICKS;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1463,8 +1452,8 @@ static struct cmdtab const SetCommands[] = {
|
||||
"Set Reconnect timeout", "set reconnect value ntries"},
|
||||
{"redial", NULL, SetRedialTimeout, LOCAL_AUTH | LOCAL_CX,
|
||||
"Set Redial timeout", "set redial value|random[.value|random] [attempts]"},
|
||||
{"stopped", NULL, SetStoppedTimeout, LOCAL_AUTH, "Set STOPPED timeouts",
|
||||
"set stopped [LCPseconds [IPCPseconds [CCPseconds]]]"},
|
||||
{"stopped", NULL, SetStoppedTimeout, LOCAL_AUTH | LOCAL_CX,
|
||||
"Set STOPPED timeouts", "set stopped [LCPseconds [CCPseconds]]"},
|
||||
{"server", "socket", SetServer, LOCAL_AUTH,
|
||||
"Set server port", "set server|socket TcpPort|LocalName|none [mask]"},
|
||||
{"speed", NULL, SetModemSpeed, LOCAL_AUTH | LOCAL_CX,
|
||||
|
@ -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.11 1998/02/18 00:27:47 brian Exp $
|
||||
* $Id: datalink.c,v 1.1.2.12 1998/02/21 01:45:05 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -52,8 +52,8 @@
|
||||
#include "physical.h"
|
||||
#include "bundle.h"
|
||||
#include "chat.h"
|
||||
#include "datalink.h"
|
||||
#include "ccp.h"
|
||||
#include "datalink.h"
|
||||
#include "main.h"
|
||||
#include "modem.h"
|
||||
#include "iplist.h"
|
||||
@ -144,7 +144,7 @@ datalink_LoginDone(struct datalink *dl)
|
||||
dl->state = DATALINK_OPEN;
|
||||
|
||||
lcp_Setup(&LcpInfo, dl->state == DATALINK_READY ? 0 : VarOpenMode);
|
||||
ccp_Setup(&CcpInfo);
|
||||
ccp_Setup(&dl->ccp);
|
||||
|
||||
FsmUp(&LcpInfo.fsm);
|
||||
FsmOpen(&LcpInfo.fsm);
|
||||
@ -291,7 +291,7 @@ datalink_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
}
|
||||
|
||||
static void
|
||||
datalink_Write(struct descriptor *d, const fd_set *fdset)
|
||||
datalink_Write(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
{
|
||||
struct datalink *dl = descriptor2datalink(d);
|
||||
|
||||
@ -303,12 +303,12 @@ datalink_Write(struct descriptor *d, const fd_set *fdset)
|
||||
case DATALINK_HANGUP:
|
||||
case DATALINK_DIAL:
|
||||
case DATALINK_LOGIN:
|
||||
descriptor_Write(&dl->chat.desc, fdset);
|
||||
descriptor_Write(&dl->chat.desc, bundle, fdset);
|
||||
break;
|
||||
|
||||
case DATALINK_READY:
|
||||
case DATALINK_OPEN:
|
||||
descriptor_Write(&dl->physical->desc, fdset);
|
||||
descriptor_Write(&dl->physical->desc, bundle, fdset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -352,7 +352,7 @@ datalink_Create(const char *name, struct bundle *bundle)
|
||||
dl->cfg.reconnect_timeout = RECONNECT_TIMEOUT;
|
||||
|
||||
dl->name = strdup(name);
|
||||
if ((dl->physical = modem_Create(dl->name, &CcpInfo)) == NULL) {
|
||||
if ((dl->physical = modem_Create(dl->name)) == NULL) {
|
||||
free(dl->name);
|
||||
free(dl);
|
||||
return NULL;
|
||||
@ -361,7 +361,7 @@ datalink_Create(const char *name, struct bundle *bundle)
|
||||
|
||||
ipcp_Init(&IpcpInfo, dl->bundle, &dl->physical->link);
|
||||
lcp_Init(&LcpInfo, dl->bundle, dl->physical);
|
||||
ccp_Init(&CcpInfo, dl->bundle, &dl->physical->link);
|
||||
ccp_Init(&dl->ccp, dl->bundle, &dl->physical->link);
|
||||
|
||||
LogPrintf(LogPHASE, "%s: Created in CLOSED state\n", dl->name);
|
||||
|
||||
@ -440,7 +440,7 @@ datalink_Close(struct datalink *dl, int stay)
|
||||
{
|
||||
/* Please close */
|
||||
if (dl->state == DATALINK_OPEN) {
|
||||
FsmClose(&CcpInfo.fsm);
|
||||
FsmClose(&dl->ccp.fsm);
|
||||
FsmClose(&LcpInfo.fsm);
|
||||
if (stay) {
|
||||
dl->dial_tries = -1;
|
||||
@ -455,13 +455,13 @@ datalink_Down(struct datalink *dl, int stay)
|
||||
{
|
||||
/* Carrier is lost */
|
||||
if (dl->state == DATALINK_OPEN) {
|
||||
FsmDown(&CcpInfo.fsm);
|
||||
FsmClose(&CcpInfo.fsm);
|
||||
FsmDown(&dl->ccp.fsm);
|
||||
FsmClose(&dl->ccp.fsm);
|
||||
FsmDown(&LcpInfo.fsm);
|
||||
if (stay)
|
||||
FsmClose(&LcpInfo.fsm);
|
||||
else
|
||||
FsmOpen(&CcpInfo.fsm);
|
||||
FsmOpen(&dl->ccp.fsm);
|
||||
}
|
||||
|
||||
datalink_ComeDown(dl, stay);
|
||||
|
@ -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.6 1998/02/17 19:28:28 brian Exp $
|
||||
* $Id: datalink.h,v 1.1.2.7 1998/02/17 19:28:46 brian Exp $
|
||||
*/
|
||||
|
||||
#define DATALINK_CLOSED (0)
|
||||
@ -68,8 +68,8 @@ struct datalink {
|
||||
|
||||
#ifdef soon
|
||||
struct lcp lcp; /* Our line control FSM */
|
||||
struct ccp ccp; /* Our compression FSM */
|
||||
#endif
|
||||
struct ccp ccp; /* Our compression FSM */
|
||||
|
||||
struct bundle *bundle; /* for the moment */
|
||||
struct datalink *next; /* Next in the list */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: deflate.c,v 1.6.4.4 1998/01/31 02:48:17 brian Exp $
|
||||
* $Id: deflate.c,v 1.6.4.5 1998/02/18 19:35:35 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -74,7 +74,8 @@ DeflateResetOutput(void)
|
||||
}
|
||||
|
||||
static int
|
||||
DeflateOutput(struct link *l, int pri, u_short proto, struct mbuf *mp)
|
||||
DeflateOutput(struct ccp *ccp, struct link *l, int pri, u_short proto,
|
||||
struct mbuf *mp)
|
||||
{
|
||||
u_char *wp, *rp;
|
||||
int olen, ilen, len, res, flush;
|
||||
@ -160,8 +161,8 @@ DeflateOutput(struct link *l, int pri, u_short proto, struct mbuf *mp)
|
||||
mbfree(mi_head);
|
||||
LogPrintf(LogDEBUG, "DeflateOutput: %d => %d: Uncompressible (0x%04x)\n",
|
||||
ilen, olen, proto);
|
||||
CcpInfo.uncompout += ilen;
|
||||
CcpInfo.compout += ilen; /* We measure this stuff too */
|
||||
ccp->uncompout += ilen;
|
||||
ccp->compout += ilen; /* We measure this stuff too */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -180,8 +181,8 @@ DeflateOutput(struct link *l, int pri, u_short proto, struct mbuf *mp)
|
||||
mo->next = NULL;
|
||||
}
|
||||
|
||||
CcpInfo.uncompout += ilen;
|
||||
CcpInfo.compout += olen;
|
||||
ccp->uncompout += ilen;
|
||||
ccp->compout += olen;
|
||||
|
||||
LogPrintf(LogDEBUG, "DeflateOutput: %d => %d bytes, proto 0x%04x\n",
|
||||
ilen, olen, proto);
|
||||
@ -200,7 +201,7 @@ DeflateResetInput(void)
|
||||
}
|
||||
|
||||
static struct mbuf *
|
||||
DeflateInput(u_short *proto, struct mbuf *mi)
|
||||
DeflateInput(struct ccp *ccp, u_short *proto, struct mbuf *mi)
|
||||
{
|
||||
struct mbuf *mo, *mo_head, *mi_head;
|
||||
u_char *wp;
|
||||
@ -227,7 +228,7 @@ DeflateInput(u_short *proto, struct mbuf *mi)
|
||||
LogPrintf(LogERROR, "DeflateInput: Seq error: Got %d, expected %d\n",
|
||||
seq, InputState.seqno);
|
||||
pfree(mi_head);
|
||||
CcpSendResetReq(&CcpInfo.fsm);
|
||||
CcpSendResetReq(&ccp->fsm);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -264,7 +265,7 @@ DeflateInput(u_short *proto, struct mbuf *mi)
|
||||
res, InputState.cx.msg ? InputState.cx.msg : "");
|
||||
pfree(mo_head);
|
||||
pfree(mi);
|
||||
CcpSendResetReq(&CcpInfo.fsm);
|
||||
CcpSendResetReq(&ccp->fsm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -305,7 +306,7 @@ DeflateInput(u_short *proto, struct mbuf *mi)
|
||||
if (first) {
|
||||
LogPrintf(LogERROR, "DeflateInput: Length error\n");
|
||||
pfree(mo_head);
|
||||
CcpSendResetReq(&CcpInfo.fsm);
|
||||
CcpSendResetReq(&ccp->fsm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -316,8 +317,8 @@ DeflateInput(u_short *proto, struct mbuf *mi)
|
||||
mo_head->cnt -= 2;
|
||||
olen -= 2;
|
||||
|
||||
CcpInfo.compin += ilen;
|
||||
CcpInfo.uncompin += olen;
|
||||
ccp->compin += ilen;
|
||||
ccp->uncompin += olen;
|
||||
|
||||
LogPrintf(LogDEBUG, "DeflateInput: %d => %d bytes, proto 0x%04x\n",
|
||||
ilen, olen, *proto);
|
||||
@ -336,7 +337,7 @@ DeflateInput(u_short *proto, struct mbuf *mi)
|
||||
}
|
||||
|
||||
static void
|
||||
DeflateDictSetup(u_short proto, struct mbuf *mi)
|
||||
DeflateDictSetup(struct ccp *ccp, u_short proto, struct mbuf *mi)
|
||||
{
|
||||
int res, flush, expect_error;
|
||||
u_char *rp;
|
||||
@ -387,7 +388,7 @@ DeflateDictSetup(u_short proto, struct mbuf *mi)
|
||||
res, InputState.cx.msg ? InputState.cx.msg : "");
|
||||
LogPrintf(LogERROR, "DeflateDictSetup: avail_in %d, avail_out %d\n",
|
||||
InputState.cx.avail_in, InputState.cx.avail_out);
|
||||
CcpSendResetReq(&CcpInfo.fsm);
|
||||
CcpSendResetReq(&ccp->fsm);
|
||||
mbfree(mi_head); /* lose our allocated ``head'' buf */
|
||||
return;
|
||||
}
|
||||
@ -423,8 +424,8 @@ DeflateDictSetup(u_short proto, struct mbuf *mi)
|
||||
}
|
||||
}
|
||||
|
||||
CcpInfo.compin += len;
|
||||
CcpInfo.uncompin += len;
|
||||
ccp->compin += len;
|
||||
ccp->uncompin += len;
|
||||
|
||||
InputState.seqno++;
|
||||
InputState.uncomp_rec++;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: descriptor.h,v 1.1.2.5 1998/02/13 05:10:15 brian Exp $
|
||||
* $Id: descriptor.h,v 1.1.2.6 1998/02/16 00:00:03 brian Exp $
|
||||
*/
|
||||
|
||||
#define PHYSICAL_DESCRIPTOR (1)
|
||||
@ -39,10 +39,10 @@ struct descriptor {
|
||||
int (*UpdateSet)(struct descriptor *, fd_set *, fd_set *, fd_set *, int *);
|
||||
int (*IsSet)(struct descriptor *, fd_set *);
|
||||
void (*Read)(struct descriptor *, struct bundle *, const fd_set *);
|
||||
void (*Write)(struct descriptor *, const fd_set *);
|
||||
void (*Write)(struct descriptor *, struct bundle *, const fd_set *);
|
||||
};
|
||||
|
||||
#define descriptor_UpdateSet(d, r, w, e, n) ((*(d)->UpdateSet)(d, r, w, e, n))
|
||||
#define descriptor_IsSet(d, s) ((*(d)->IsSet)(d, s))
|
||||
#define descriptor_Read(d, b, f) ((*(d)->Read)(d, b, f))
|
||||
#define descriptor_Write(d, f) ((*(d)->Write)(d, f))
|
||||
#define descriptor_Write(d, b, f) ((*(d)->Write)(d, b, f))
|
||||
|
@ -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.27.2.12 1998/02/19 19:56:54 brian Exp $
|
||||
* $Id: fsm.c,v 1.27.2.13 1998/02/21 01:45:07 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Refer loglevel for log output
|
||||
@ -709,7 +709,7 @@ FsmRecvProtoRej(struct fsm *fp, struct fsmheader *lhp, struct mbuf *bp)
|
||||
LogPrintf(LogERROR, "FsmRecvProtoRej: Not a physical link !\n");
|
||||
break;
|
||||
case PROTO_CCP:
|
||||
fp = &CcpInfo.fsm;
|
||||
fp = &bundle2ccp(fp->bundle, fp->link->name)->fsm;
|
||||
(*fp->fn->LayerFinish)(fp);
|
||||
switch (fp->state) {
|
||||
case ST_CLOSED:
|
||||
|
@ -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.28.2.12 1998/02/18 19:36:13 brian Exp $
|
||||
* $Id: hdlc.c,v 1.28.2.13 1998/02/21 01:45:09 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -140,9 +140,6 @@ HdlcOutput(struct link *l, int pri, u_short proto, struct mbuf *bp)
|
||||
u_char *cp;
|
||||
u_short fcs;
|
||||
|
||||
if (ccp_Output(l->ccp, l, pri, proto, bp))
|
||||
return;
|
||||
|
||||
if (!p) {
|
||||
/*
|
||||
* This is where we multiplex the data over our available physical
|
||||
@ -410,7 +407,7 @@ DecodePacket(struct bundle *bundle, u_short proto, struct mbuf * bp,
|
||||
IpcpInput(bp);
|
||||
break;
|
||||
case PROTO_CCP:
|
||||
CcpInput(bundle, bp);
|
||||
CcpInput(ccp, bundle, bp);
|
||||
break;
|
||||
default:
|
||||
LogPrintf(LogPHASE, "Unknown protocol 0x%04x (%s)\n",
|
||||
|
@ -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.38.2.6 1998/02/07 20:49:38 brian Exp $
|
||||
* $Id: ip.c,v 1.38.2.7 1998/02/16 00:00:11 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Return ICMP message for filterd packet
|
||||
@ -497,25 +497,20 @@ IpEnqueue(int pri, char *ptr, int count)
|
||||
Enqueue(&IpOutputQueues[pri], bp);
|
||||
}
|
||||
|
||||
#if 0
|
||||
int
|
||||
IsIpEnqueued()
|
||||
ip_QueueLen()
|
||||
{
|
||||
struct mqueue *queue;
|
||||
int exist = 0;
|
||||
int result = 0;
|
||||
|
||||
for (queue = &IpOutputQueues[PRI_FAST]; queue >= IpOutputQueues; queue--) {
|
||||
if (queue->qlen > 0) {
|
||||
exist = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (exist);
|
||||
for (queue = &IpOutputQueues[PRI_MAX]; queue >= IpOutputQueues; queue--)
|
||||
result += queue->qlen;
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
IpStartOutput(struct link *l)
|
||||
IpStartOutput(struct link *l, struct bundle *bundle)
|
||||
{
|
||||
struct mqueue *queue;
|
||||
struct mbuf *bp;
|
||||
@ -528,7 +523,7 @@ IpStartOutput(struct link *l)
|
||||
bp = Dequeue(queue);
|
||||
if (bp) {
|
||||
cnt = plength(bp);
|
||||
SendPppFrame(l, bp);
|
||||
SendPppFrame(l, bp, bundle);
|
||||
RestartIdleTimer();
|
||||
IpcpAddOutOctets(cnt);
|
||||
break;
|
||||
|
@ -17,11 +17,11 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ip.h,v 1.8.2.2 1998/01/30 19:45:43 brian Exp $
|
||||
* $Id: ip.h,v 1.8.2.3 1998/02/02 19:32:07 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
extern void IpStartOutput(struct link *);
|
||||
extern void IpStartOutput(struct link *, struct bundle *);
|
||||
extern int PacketCheck(char *, int, int);
|
||||
extern void IpEnqueue(int, char *, int);
|
||||
extern void IpInput(struct bundle *, struct mbuf *);
|
||||
@ -29,3 +29,4 @@ extern void StartIdleTimer(void);
|
||||
extern void StopIdleTimer(void);
|
||||
extern void UpdateIdleTimer(const struct bundle *);
|
||||
extern int RemainingIdleTime(void);
|
||||
extern int ip_QueueLen(void);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: link.c,v 1.1.2.6 1998/02/16 00:00:22 brian Exp $
|
||||
* $Id: link.c,v 1.1.2.7 1998/02/18 19:35:51 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -115,9 +115,9 @@ link_Write(struct link *l, int pri, const char *ptr, int count)
|
||||
}
|
||||
|
||||
void
|
||||
link_StartOutput(struct link *l)
|
||||
link_StartOutput(struct link *l, struct bundle *bundle)
|
||||
{
|
||||
(*l->StartOutput)(l);
|
||||
(*l->StartOutput)(l, bundle);
|
||||
}
|
||||
|
||||
void
|
||||
@ -133,7 +133,6 @@ link_Output(struct link *l, int pri, struct mbuf *bp)
|
||||
wp = mballoc(len, MB_LINK);
|
||||
mbread(bp, MBUF_CTOP(wp), len);
|
||||
Enqueue(l->Queue + pri, wp);
|
||||
link_StartOutput(l);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: link.h,v 1.1.2.4 1998/02/16 00:00:25 brian Exp $
|
||||
* $Id: link.h,v 1.1.2.5 1998/02/21 01:45:18 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#define NPROTOSTAT 11
|
||||
|
||||
struct bundle;
|
||||
struct ccp;
|
||||
|
||||
struct link {
|
||||
int type; /* _LINK type */
|
||||
@ -44,13 +43,12 @@ struct link {
|
||||
struct pppThroughput throughput; /* Link throughput statistics */
|
||||
struct pppTimer Timer; /* inactivity timeout */
|
||||
struct mqueue Queue[LINK_QUEUES]; /* Our output queue of mbufs */
|
||||
struct ccp *ccp; /* Link compression */
|
||||
|
||||
u_long proto_in[NPROTOSTAT]; /* outgoing protocol stats */
|
||||
u_long proto_out[NPROTOSTAT]; /* incoming protocol stats */
|
||||
|
||||
/* Implementation routines for use by link_ routines */
|
||||
void (*StartOutput)(struct link *); /* send the queued data */
|
||||
void (*StartOutput)(struct link *, struct bundle *); /* send queued data */
|
||||
int (*IsActive)(struct link *); /* Are we active ? */
|
||||
void (*Close)(struct link *, int); /* Close the link */
|
||||
void (*Destroy)(struct link *); /* Destructor */
|
||||
@ -63,7 +61,7 @@ extern void link_SequenceQueue(struct link *);
|
||||
extern int link_QueueLen(struct link *);
|
||||
extern struct mbuf *link_Dequeue(struct link *);
|
||||
extern void link_Write(struct link *, int, const char *, int);
|
||||
extern void link_StartOutput(struct link *);
|
||||
extern void link_StartOutput(struct link *, struct bundle *);
|
||||
extern void link_Output(struct link *, int, struct mbuf *);
|
||||
|
||||
#define PROTO_IN 1 /* third arg to link_ProtocolRecord */
|
||||
|
@ -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.26 1998/02/18 00:27:49 brian Exp $
|
||||
* $Id: main.c,v 1.121.2.27 1998/02/21 01:45:19 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Add commands for traffic summary, version display, etc.
|
||||
@ -505,7 +505,6 @@ DoLoop(struct bundle *bundle)
|
||||
int pri, i, n, nfds;
|
||||
int qlen;
|
||||
struct tun_data tun;
|
||||
#define rbuff tun.data
|
||||
|
||||
if (mode & (MODE_DIRECT|MODE_DEDICATED|MODE_BACKGROUND))
|
||||
bundle_Open(bundle, NULL);
|
||||
@ -523,18 +522,6 @@ DoLoop(struct bundle *bundle)
|
||||
bundle_UpdateSet(bundle, &rfds, &wfds, &efds, &nfds);
|
||||
descriptor_UpdateSet(&server.desc, &rfds, &wfds, &efds, &nfds);
|
||||
|
||||
#ifndef SIGALRM
|
||||
/*
|
||||
* *** IMPORTANT ***
|
||||
* CPU is serviced every TICKUNIT micro seconds. This value must be chosen
|
||||
* with great care. If this values is too big, it results in loss of
|
||||
* characters from the modem and poor response. If this value is too
|
||||
* small, ppp eats too much CPU time.
|
||||
*/
|
||||
usleep(TICKUNIT);
|
||||
TimerService();
|
||||
#endif
|
||||
|
||||
/* If there are aren't many packets queued, look for some more. */
|
||||
if (qlen < 20 && bundle->tun_fd >= 0) {
|
||||
if (bundle->tun_fd + 1 > nfds)
|
||||
@ -544,6 +531,10 @@ DoLoop(struct bundle *bundle)
|
||||
|
||||
descriptor_UpdateSet(&prompt.desc, &rfds, &wfds, &efds, &nfds);
|
||||
|
||||
if (CleaningUp && bundle_Phase(SignalBundle) == PHASE_DEAD)
|
||||
/* Don't select - we'll be here forever */
|
||||
break;
|
||||
|
||||
i = select(nfds, &rfds, &wfds, &efds, NULL);
|
||||
|
||||
if (i == 0)
|
||||
@ -572,7 +563,7 @@ DoLoop(struct bundle *bundle)
|
||||
|
||||
/* XXX FIX ME ! */
|
||||
if (descriptor_IsSet(&bundle2datalink(bundle, NULL)->desc, &wfds))
|
||||
descriptor_Write(&bundle2datalink(bundle, NULL)->desc, &wfds);
|
||||
descriptor_Write(&bundle2datalink(bundle, NULL)->desc, bundle, &wfds);
|
||||
if (descriptor_IsSet(&bundle2datalink(bundle, NULL)->desc, &rfds))
|
||||
descriptor_Read(&bundle2datalink(bundle, NULL)->desc, bundle, &rfds);
|
||||
|
||||
@ -590,21 +581,21 @@ DoLoop(struct bundle *bundle)
|
||||
}
|
||||
if (!tun_check_header(tun, AF_INET))
|
||||
continue;
|
||||
if (((struct ip *) rbuff)->ip_dst.s_addr == IpcpInfo.my_ip.s_addr) {
|
||||
if (((struct ip *)tun.data)->ip_dst.s_addr == IpcpInfo.my_ip.s_addr) {
|
||||
/* we've been asked to send something addressed *to* us :( */
|
||||
if (VarLoopback) {
|
||||
pri = PacketCheck(rbuff, n, FL_IN);
|
||||
pri = PacketCheck(tun.data, n, FL_IN);
|
||||
if (pri >= 0) {
|
||||
struct mbuf *bp;
|
||||
|
||||
#ifndef NOALIAS
|
||||
if (mode & MODE_ALIAS) {
|
||||
VarPacketAliasIn(rbuff, sizeof rbuff);
|
||||
n = ntohs(((struct ip *) rbuff)->ip_len);
|
||||
VarPacketAliasIn(tun.data, sizeof tun.data);
|
||||
n = ntohs(((struct ip *)tun.data)->ip_len);
|
||||
}
|
||||
#endif
|
||||
bp = mballoc(n, MB_IPIN);
|
||||
memcpy(MBUF_CTOP(bp), rbuff, n);
|
||||
memcpy(MBUF_CTOP(bp), tun.data, n);
|
||||
IpInput(bundle, bp);
|
||||
LogPrintf(LogDEBUG, "Looped back packet addressed to myself\n");
|
||||
}
|
||||
@ -618,18 +609,18 @@ DoLoop(struct bundle *bundle)
|
||||
* device until IPCP is opened.
|
||||
*/
|
||||
if (LcpInfo.fsm.state <= ST_CLOSED && (mode & MODE_AUTO) &&
|
||||
(pri = PacketCheck(rbuff, n, FL_DIAL)) >= 0)
|
||||
(pri = PacketCheck(tun.data, n, FL_DIAL)) >= 0)
|
||||
bundle_Open(bundle, NULL);
|
||||
|
||||
pri = PacketCheck(rbuff, n, FL_OUT);
|
||||
pri = PacketCheck(tun.data, n, FL_OUT);
|
||||
if (pri >= 0) {
|
||||
#ifndef NOALIAS
|
||||
if (mode & MODE_ALIAS) {
|
||||
VarPacketAliasOut(rbuff, sizeof rbuff);
|
||||
n = ntohs(((struct ip *) rbuff)->ip_len);
|
||||
VarPacketAliasOut(tun.data, sizeof tun.data);
|
||||
n = ntohs(((struct ip *)tun.data)->ip_len);
|
||||
}
|
||||
#endif
|
||||
IpEnqueue(pri, rbuff, n);
|
||||
IpEnqueue(pri, tun.data, 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.23 1998/02/19 02:08:51 brian Exp $
|
||||
* $Id: modem.c,v 1.77.2.24 1998/02/21 01:45:21 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -65,6 +65,7 @@
|
||||
#include "physical.h"
|
||||
#include "prompt.h"
|
||||
#include "chat.h"
|
||||
#include "ccp.h"
|
||||
#include "datalink.h"
|
||||
|
||||
|
||||
@ -74,7 +75,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void modem_StartOutput(struct link *);
|
||||
static void modem_StartOutput(struct link *, struct bundle *);
|
||||
static int modem_IsActive(struct link *);
|
||||
static void modem_Hangup(struct link *, int);
|
||||
static void modem_Destroy(struct link *);
|
||||
@ -84,7 +85,7 @@ static int modem_UpdateSet(struct descriptor *, fd_set *, fd_set *, fd_set *,
|
||||
int *);
|
||||
|
||||
struct physical *
|
||||
modem_Create(const char *name, struct ccp *ccp)
|
||||
modem_Create(const char *name)
|
||||
{
|
||||
struct physical *p;
|
||||
|
||||
@ -98,7 +99,6 @@ modem_Create(const char *name, struct ccp *ccp)
|
||||
memset(&p->link.throughput, '\0', sizeof p->link.throughput);
|
||||
memset(&p->link.Timer, '\0', sizeof p->link.Timer);
|
||||
memset(p->link.Queue, '\0', sizeof p->link.Queue);
|
||||
p->link.ccp = ccp;
|
||||
memset(p->link.proto_in, '\0', sizeof p->link.proto_in);
|
||||
memset(p->link.proto_out, '\0', sizeof p->link.proto_out);
|
||||
p->link.StartOutput = modem_StartOutput;
|
||||
@ -869,14 +869,14 @@ modem_LogicalClose(struct physical *modem)
|
||||
}
|
||||
|
||||
static void
|
||||
modem_StartOutput(struct link *l)
|
||||
modem_StartOutput(struct link *l, struct bundle *bundle)
|
||||
{
|
||||
struct physical *modem = (struct physical *)l;
|
||||
int nb, nw;
|
||||
|
||||
if (modem->out == NULL) {
|
||||
if (link_QueueLen(l) == 0)
|
||||
IpStartOutput(l);
|
||||
IpStartOutput(l, bundle);
|
||||
|
||||
modem->out = link_Dequeue(l);
|
||||
}
|
||||
|
@ -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.8 1998/02/17 19:27:58 brian Exp $
|
||||
* $Id: modem.h,v 1.16.2.9 1998/02/21 01:45:23 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -24,7 +24,7 @@ struct physical;
|
||||
struct ccp;
|
||||
|
||||
extern int modem_Raw(struct physical *, struct bundle *);
|
||||
extern struct physical *modem_Create(const char *, struct ccp *);
|
||||
extern struct physical *modem_Create(const char *);
|
||||
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.10 1998/02/17 19:29:02 brian Exp $
|
||||
* $Id: physical.c,v 1.1.2.11 1998/02/18 19:35:53 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -217,10 +217,11 @@ Physical_IsSet(struct descriptor *d, fd_set *fdset)
|
||||
}
|
||||
|
||||
void
|
||||
Physical_DescriptorWrite(struct descriptor *d, const fd_set *fdset)
|
||||
Physical_DescriptorWrite(struct descriptor *d, struct bundle *bundle,
|
||||
const fd_set *fdset)
|
||||
{
|
||||
struct physical *p = descriptor2physical(d);
|
||||
|
||||
LogPrintf(LogDEBUG, "descriptor2physical; %p -> %p\n", d, p);
|
||||
link_StartOutput(&p->link);
|
||||
link_StartOutput(&p->link, bundle);
|
||||
}
|
||||
|
@ -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.10 1998/02/18 19:35:58 brian Exp $
|
||||
* $Id: physical.h,v 1.1.2.11 1998/02/21 01:45:24 brian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -94,4 +94,5 @@ int Physical_ReportProtocolStatus(struct cmdargs const *);
|
||||
int Physical_UpdateSet(struct descriptor *, fd_set *, fd_set *, fd_set *,
|
||||
int *, int);
|
||||
int Physical_IsSet(struct descriptor *, fd_set *);
|
||||
void Physical_DescriptorWrite(struct descriptor *, const fd_set *);
|
||||
void Physical_DescriptorWrite(struct descriptor *, struct bundle *,
|
||||
const fd_set *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.96 1998/01/20 22:47:46 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.97 1998/01/27 23:14:53 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -2315,22 +2315,22 @@ is taken before dialing each number. A pause of
|
||||
is taken before starting at the first number again. A value of
|
||||
.Ar random
|
||||
may be used here too.
|
||||
.It set stopped [LCPseconds [IPCPseconds [CCPseconds]]]
|
||||
.It set stopped [LCPseconds [CCPseconds]]
|
||||
If this option is set,
|
||||
.Nm
|
||||
will time out after the given FSM (Finite State Machine) has been in
|
||||
the stopped state for the given number of
|
||||
.Dq seconds .
|
||||
This option may be useful if you see
|
||||
.Nm
|
||||
failing to respond in the stopped state, or if you wish to
|
||||
This option may be useful if the peer sends a terminate request,
|
||||
but never actually closes the connection despite our sending a terminate
|
||||
acknowledgement. This is also useful if you wish to
|
||||
.Dq set openmode passive
|
||||
and time out if the peer doesn't send a Configure Request within the
|
||||
given time. Use
|
||||
.Dq set log +lcp +ipcp +ccp
|
||||
.Dq set log +lcp +ccp
|
||||
to make
|
||||
.Nm
|
||||
log all state transitions.
|
||||
log the appropriate state transitions.
|
||||
.Pp
|
||||
The default value is zero, where
|
||||
.Nm
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pred.c,v 1.20.2.2 1998/01/30 19:46:04 brian Exp $
|
||||
* $Id: pred.c,v 1.20.2.3 1998/01/31 02:48:29 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -184,7 +184,8 @@ Pred1InitOutput(void)
|
||||
}
|
||||
|
||||
static int
|
||||
Pred1Output(struct link *l, int pri, u_short proto, struct mbuf * bp)
|
||||
Pred1Output(struct ccp *ccp, struct link *l, int pri, u_short proto,
|
||||
struct mbuf *bp)
|
||||
{
|
||||
struct mbuf *mwp;
|
||||
u_char *cp, *wp, *hp;
|
||||
@ -206,15 +207,15 @@ Pred1Output(struct link *l, int pri, u_short proto, struct mbuf * bp)
|
||||
|
||||
len = compress(bufp + 2, wp, orglen);
|
||||
LogPrintf(LogDEBUG, "Pred1Output: orglen (%d) --> len (%d)\n", orglen, len);
|
||||
CcpInfo.uncompout += orglen;
|
||||
ccp->uncompout += orglen;
|
||||
if (len < orglen) {
|
||||
*hp |= 0x80;
|
||||
wp += len;
|
||||
CcpInfo.compout += len;
|
||||
ccp->compout += len;
|
||||
} else {
|
||||
memcpy(wp, bufp + 2, orglen);
|
||||
wp += orglen;
|
||||
CcpInfo.compout += orglen;
|
||||
ccp->compout += orglen;
|
||||
}
|
||||
|
||||
*wp++ = fcs & 0377;
|
||||
@ -225,7 +226,7 @@ Pred1Output(struct link *l, int pri, u_short proto, struct mbuf * bp)
|
||||
}
|
||||
|
||||
static struct mbuf *
|
||||
Pred1Input(u_short *proto, struct mbuf *bp)
|
||||
Pred1Input(struct ccp *ccp, u_short *proto, struct mbuf *bp)
|
||||
{
|
||||
u_char *cp, *pp;
|
||||
int len, olen, len1;
|
||||
@ -241,14 +242,14 @@ Pred1Input(u_short *proto, struct mbuf *bp)
|
||||
len = *cp++ << 8;
|
||||
*pp++ = *cp;
|
||||
len += *cp++;
|
||||
CcpInfo.uncompin += len & 0x7fff;
|
||||
ccp->uncompin += len & 0x7fff;
|
||||
if (len & 0x8000) {
|
||||
len1 = decompress(cp, pp, olen - 4);
|
||||
CcpInfo.compin += olen;
|
||||
ccp->compin += olen;
|
||||
len &= 0x7fff;
|
||||
if (len != len1) { /* Error is detected. Send reset request */
|
||||
LogPrintf(LogCCP, "Pred1: Length error\n");
|
||||
CcpSendResetReq(&CcpInfo.fsm);
|
||||
CcpSendResetReq(&ccp->fsm);
|
||||
pfree(bp);
|
||||
pfree(wp);
|
||||
return NULL;
|
||||
@ -256,7 +257,7 @@ Pred1Input(u_short *proto, struct mbuf *bp)
|
||||
cp += olen - 4;
|
||||
pp += len1;
|
||||
} else {
|
||||
CcpInfo.compin += len;
|
||||
ccp->compin += len;
|
||||
SyncTable(cp, pp, len);
|
||||
cp += len;
|
||||
pp += len;
|
||||
@ -285,7 +286,7 @@ Pred1Input(u_short *proto, struct mbuf *bp)
|
||||
return wp;
|
||||
} else {
|
||||
LogDumpBp(LogHDLC, "Bad FCS", wp);
|
||||
CcpSendResetReq(&CcpInfo.fsm);
|
||||
CcpSendResetReq(&ccp->fsm);
|
||||
pfree(wp);
|
||||
}
|
||||
pfree(bp);
|
||||
@ -293,7 +294,7 @@ Pred1Input(u_short *proto, struct mbuf *bp)
|
||||
}
|
||||
|
||||
static void
|
||||
Pred1DictSetup(u_short proto, struct mbuf * bp)
|
||||
Pred1DictSetup(struct ccp *ccp, u_short proto, struct mbuf * bp)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: prompt.c,v 1.1.2.6 1998/02/17 19:28:12 brian Exp $
|
||||
* $Id: prompt.c,v 1.1.2.7 1998/02/17 19:28:35 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -58,6 +58,7 @@
|
||||
#include "link.h"
|
||||
#include "physical.h"
|
||||
#include "chat.h"
|
||||
#include "ccp.h"
|
||||
#include "datalink.h"
|
||||
|
||||
static int prompt_nonewline = 1;
|
||||
@ -215,9 +216,10 @@ prompt_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
}
|
||||
|
||||
static void
|
||||
prompt_Write(struct descriptor *d, const fd_set *fdset)
|
||||
prompt_Write(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
{
|
||||
/* We don't set the write descriptor (yet) */
|
||||
/* We never want to write here ! */
|
||||
LogPrintf(LogERROR, "prompt_Write: Internal error: Bad call !\n");
|
||||
}
|
||||
|
||||
struct prompt 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.6 1998/02/16 00:01:03 brian Exp $
|
||||
* $Id: server.c,v 1.16.2.7 1998/02/18 20:39:08 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -132,7 +132,7 @@ server_Read(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
}
|
||||
|
||||
static void
|
||||
server_Write(struct descriptor *d, const fd_set *fdset)
|
||||
server_Write(struct descriptor *d, struct bundle *bundle, const fd_set *fdset)
|
||||
{
|
||||
/* We never want to write here ! */
|
||||
LogPrintf(LogERROR, "server_Write: Internal error: Bad call !\n");
|
||||
|
@ -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.16.2.3 1998/01/30 19:46:06 brian Exp $
|
||||
* $Id: vjcomp.c,v 1.16.2.4 1998/02/21 01:45:26 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -41,6 +41,10 @@
|
||||
#include "iplist.h"
|
||||
#include "throughput.h"
|
||||
#include "ipcp.h"
|
||||
#include "lcp.h"
|
||||
#include "ccp.h"
|
||||
#include "link.h"
|
||||
#include "bundle.h"
|
||||
#include "vjcomp.h"
|
||||
|
||||
#define MAX_VJHEADER 16 /* Maximum size of compressed header */
|
||||
@ -54,11 +58,12 @@ VjInit(int max_state)
|
||||
}
|
||||
|
||||
void
|
||||
SendPppFrame(struct link *l, struct mbuf * bp)
|
||||
SendPppFrame(struct link *l, struct mbuf * bp, struct bundle *bundle)
|
||||
{
|
||||
int type;
|
||||
u_short proto;
|
||||
u_short cproto = IpcpInfo.peer_compproto >> 16;
|
||||
struct ccp *ccp = bundle2ccp(bundle, l->name);
|
||||
|
||||
LogPrintf(LogDEBUG, "SendPppFrame: proto = %x\n", IpcpInfo.peer_compproto);
|
||||
if (((struct ip *) MBUF_CTOP(bp))->ip_p == IPPROTO_TCP
|
||||
@ -83,7 +88,9 @@ SendPppFrame(struct link *l, struct mbuf * bp)
|
||||
}
|
||||
} else
|
||||
proto = PROTO_IP;
|
||||
HdlcOutput(l, PRI_NORMAL, proto, bp);
|
||||
|
||||
if (!ccp_Output(ccp, l, PRI_NORMAL, proto, bp))
|
||||
HdlcOutput(l, PRI_NORMAL, proto, bp);
|
||||
}
|
||||
|
||||
static struct mbuf *
|
||||
|
@ -23,10 +23,10 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: vjcomp.h,v 1.5.4.1 1998/01/29 00:49:32 brian Exp $
|
||||
* $Id: vjcomp.h,v 1.5.4.2 1998/01/30 19:46:07 brian Exp $
|
||||
*/
|
||||
|
||||
extern void VjInit(int);
|
||||
extern void SendPppFrame(struct link *, struct mbuf *);
|
||||
extern void SendPppFrame(struct link *, struct mbuf *, struct bundle *);
|
||||
extern struct mbuf *VjCompInput(struct mbuf *, int);
|
||||
extern const char *vj2asc(u_int32_t);
|
||||
|
Loading…
Reference in New Issue
Block a user