Negotiate MRRU, SHORTSEQ and ENDDISC. ENDDISC doesn't imply

multilink ('cos I've seen my ISP REQ it without multilink).

Setting MRRU is ifdef'd out until it's debugged and we can
merge -direct links with other running programs.

Fix MTU setting.
This commit is contained in:
Brian Somers 1998-04-23 03:23:03 +00:00
parent fdf6117177
commit 49052c9523
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35397
14 changed files with 612 additions and 142 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.c,v 1.27.2.21 1998/04/16 00:25:47 brian Exp $
* $Id: auth.c,v 1.27.2.22 1998/04/19 15:24:34 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@ -114,7 +114,7 @@ AuthValidate(struct bundle *bundle, const char *fname, const char *system,
/* XXX This should be deferred - we may join an existing bundle ! */
ipcp_Setup(&bundle->ncp.ipcp);
if (n > 3)
SetLabel(vector[3]);
bundle_SetLabel(bundle, vector[3]);
return 1; /* Valid */
} else {
CloseSecret(fp);
@ -166,7 +166,7 @@ AuthGetSecret(struct bundle *bundle, const char *fname, const char *system,
else
return NULL;
if (n > 3)
SetLabel(vector[3]);
bundle_SetLabel(bundle, vector[3]);
return vector[1];
}
}

View File

@ -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.55 1998/04/19 23:08:11 brian Exp $
* $Id: bundle.c,v 1.1.2.56 1998/04/20 00:21:24 brian Exp $
*/
#include <sys/types.h>
@ -197,8 +197,8 @@ bundle_LayerUp(struct bundle *bundle, struct fsm *fp)
{
/*
* The given fsm is now up
* If it's an LCP (including MP initialisation), set our mtu
* (This routine is also called from mp_Init() with it's LCP)
* If it's an LCP set our mtu (if we're multilink, add up the link
* speeds and set the MRRU).
* If it's an NCP, tell our -background parent to go away.
* If it's the first NCP, start the idle timer.
*/
@ -211,7 +211,7 @@ bundle_LayerUp(struct bundle *bundle, struct fsm *fp)
for (dl = bundle->links, speed = 0; dl; dl = dl->next)
speed += modem_Speed(dl->physical);
if (speed)
tun_configure(bundle, bundle->ncp.mp.link.lcp.his_mru, speed);
tun_configure(bundle, bundle->ncp.mp.peer_mrru, speed);
} else
tun_configure(bundle, fsm2lcp(fp)->his_mru,
modem_Speed(link2physical(fp->link)));
@ -522,6 +522,8 @@ bundle_Create(const char *prefix, struct prompt *prompt, int type)
*bundle.cfg.auth.name = '\0';
*bundle.cfg.auth.key = '\0';
bundle.cfg.opt = OPT_IDCHECK | OPT_LOOPBACK | OPT_THROUGHPUT | OPT_UTMP;
*bundle.cfg.label = '\0';
bundle.cfg.mtu = DEF_MTU;
bundle.phys_type = type;
bundle.links = datalink_Create("default", &bundle, &bundle.fsm, type);
@ -539,7 +541,9 @@ bundle_Create(const char *prefix, struct prompt *prompt, int type)
bundle.desc.Read = bundle_DescriptorRead;
bundle.desc.Write = bundle_DescriptorWrite;
/* XXX: what's an IPCP link anyway :-( */
mp_Init(&bundle.ncp.mp, &bundle);
/* Send over the first physical link by default */
ipcp_Init(&bundle.ncp.ipcp, &bundle, &bundle.links->physical->link,
&bundle.fsm);
@ -775,6 +779,9 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
}
bundle_NewPhase(bundle, PHASE_DEAD);
bundle_DisplayPrompt(bundle);
mp_Init(&bundle->ncp.mp, bundle);
ipcp_Init(&bundle->ncp.ipcp, bundle, &bundle->links->physical->link,
&bundle->fsm);
}
}
@ -866,6 +873,7 @@ bundle_ShowStatus(struct cmdargs const *arg)
prompt_Printf(arg->prompt, "\n");
} else
prompt_Printf(arg->prompt, "disabled\n");
prompt_Printf(arg->prompt, " MTU: %d\n", arg->bundle->cfg.mtu);
prompt_Printf(arg->prompt, " ID check: %s\n",
optval(arg->bundle, OPT_IDCHECK));
@ -1068,3 +1076,18 @@ bundle_CleanDatalinks(struct bundle *bundle)
dlp = &(*dlp)->next;
bundle_GenPhysType(bundle);
}
void
bundle_SetLabel(struct bundle *bundle, const char *label)
{
if (label)
strncpy(bundle->cfg.label, label, sizeof bundle->cfg.label - 1);
else
*bundle->cfg.label = '\0';
}
const char *
bundle_GetLabel(struct bundle *bundle)
{
return *bundle->cfg.label ? bundle->cfg.label : NULL;
}

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: bundle.h,v 1.1.2.30 1998/04/17 22:04:22 brian Exp $
* $Id: bundle.h,v 1.1.2.31 1998/04/17 22:05:06 brian Exp $
*/
#define PHASE_DEAD 0 /* Link is dead */
@ -40,6 +40,8 @@
#define OPT_THROUGHPUT 0x10
#define OPT_UTMP 0x20
#define MAX_ENDDISC_CLASS 5
#define Enabled(b, o) ((b)->cfg.opt & (o))
struct datalink;
@ -71,6 +73,8 @@ struct bundle {
char key[50]; /* PAP/CHAP key */
} auth;
unsigned opt; /* Uses OPT_ bits from above */
char label[50]; /* last thing `load'ed */
u_short mtu; /* Interface mtu */
} cfg;
struct {
@ -134,3 +138,5 @@ extern void bundle_DatalinkClone(struct bundle *, struct datalink *,
const char *);
extern void bundle_DatalinkRemove(struct bundle *, struct datalink *);
extern void bundle_CleanDatalinks(struct bundle *);
extern void bundle_SetLabel(struct bundle *, const char *);
extern const char *bundle_GetLabel(struct bundle *);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.131.2.66 1998/04/19 03:40:56 brian Exp $
* $Id: command.c,v 1.131.2.67 1998/04/19 07:22:31 brian Exp $
*
*/
#include <sys/types.h>
@ -88,21 +88,22 @@
#define VAR_WINSIZE 4
#define VAR_DEVICE 5
#define VAR_ACCMAP 6
#define VAR_MRU 7
#define VAR_MTU 8
#define VAR_OPENMODE 9
#define VAR_PHONE 10
#define VAR_HANGUP 11
#define VAR_ENC 12
#define VAR_IDLETIMEOUT 13
#define VAR_LQRPERIOD 14
#define VAR_LCPRETRY 15
#define VAR_CHAPRETRY 16
#define VAR_PAPRETRY 17
#define VAR_CCPRETRY 18
#define VAR_IPCPRETRY 19
#define VAR_DNS 20
#define VAR_NBNS 21
#define VAR_MRRU 7
#define VAR_MRU 8
#define VAR_MTU 9
#define VAR_OPENMODE 10
#define VAR_PHONE 11
#define VAR_HANGUP 12
#define VAR_ENC 13
#define VAR_IDLETIMEOUT 14
#define VAR_LQRPERIOD 15
#define VAR_LCPRETRY 16
#define VAR_CHAPRETRY 17
#define VAR_PAPRETRY 18
#define VAR_CCPRETRY 19
#define VAR_IPCPRETRY 20
#define VAR_DNS 21
#define VAR_NBNS 22
/* ``accept|deny|disable|enable'' masks */
#define NEG_HISMASK (1)
@ -117,8 +118,9 @@
#define NEG_PPPDDEFLATE 45
#define NEG_PRED1 46
#define NEG_PROTOCOMP 47
#define NEG_VJCOMP 48
#define NEG_DNS 49
#define NEG_SHORTSEQ 48
#define NEG_VJCOMP 49
#define NEG_DNS 50
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@ -235,11 +237,19 @@ LoadCommand(struct cmdargs const *arg)
if (!ValidSystem(name, arg->prompt, arg->bundle->phys_type)) {
LogPrintf(LogERROR, "%s: Label not allowed\n", name);
return 1;
} else if (SelectSystem(arg->bundle, name, CONFFILE, arg->prompt) < 0) {
LogPrintf(LogWARN, "%s: label not found.\n", name);
return -1;
} else
SetLabel(arg->argc > arg->argn ? name : NULL);
} else {
/*
* Set the label before & after so that `set enddisc' works and
* we handle nested `load' commands.
*/
bundle_SetLabel(arg->bundle, arg->argc > arg->argn ? name : NULL);
if (SelectSystem(arg->bundle, name, CONFFILE, arg->prompt) < 0) {
bundle_SetLabel(arg->bundle, NULL);
LogPrintf(LogWARN, "%s: label not found.\n", name);
return -1;
}
bundle_SetLabel(arg->bundle, arg->argc > arg->argn ? name : NULL);
}
return 0;
}
@ -503,7 +513,7 @@ static int
ShowVersion(struct cmdargs const *arg)
{
static char VarVersion[] = "PPP Version 2.0-beta";
static char VarLocalVersion[] = "$Date: 1998/04/19 03:40:56 $";
static char VarLocalVersion[] = "$Date: 1998/04/19 07:22:31 $";
prompt_Printf(arg->prompt, "%s - %s \n", VarVersion, VarLocalVersion);
return 0;
@ -544,6 +554,8 @@ static struct cmdtab const ShowCommands[] = {
"Show memory map", "show mem"},
{"modem", NULL, modem_ShowStatus, LOCAL_AUTH | LOCAL_CX,
"Show modem setups", "show modem"},
{"mp", "multilink", mp_ShowStatus, LOCAL_AUTH,
"Show multilink setup", "show mp"},
{"proto", NULL, ShowProtocolStats, LOCAL_AUTH | LOCAL_CX_OPT,
"Show protocol summary", "show proto"},
{"route", NULL, ShowRoute, LOCAL_AUTH,
@ -1136,6 +1148,25 @@ SetVariable(struct cmdargs const *arg)
LogPrintf(LogWARN, err);
}
break;
case VAR_MRRU:
if (bundle_Phase(arg->bundle) != PHASE_DEAD)
LogPrintf(LogWARN, "mrru: Only changable at phase DEAD\n");
else {
#ifdef notyet
ulong_val = atol(argp);
if (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)
LogPrintf(LogWARN, err, ulong_val);
#else
LogPrintf(LogWARN, "mrru: ifdef'd out !\n");
#endif
}
break;
case VAR_MRU:
ulong_val = atol(argp);
if (ulong_val < MIN_MRU)
@ -1150,13 +1181,13 @@ SetVariable(struct cmdargs const *arg)
case VAR_MTU:
ulong_val = atol(argp);
if (ulong_val == 0)
l->lcp.cfg.mtu = 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
l->lcp.cfg.mtu = ulong_val;
arg->bundle->cfg.mtu = ulong_val;
if (err)
LogPrintf(LogWARN, err, ulong_val);
break;
@ -1303,6 +1334,8 @@ static struct cmdtab const SetCommands[] = {
{"encrypt", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
"Select CHAP encryption type", "set encrypt MSChap|MD5",
(const void *)VAR_ENC},
{"enddisc", NULL, mp_SetEnddisc, LOCAL_AUTH,
"Set Endpoint Discriminator", "set enddisc [IP|magic|label|psn value]"},
{"escape", NULL, SetEscape, LOCAL_AUTH | LOCAL_CX,
"Set escape characters", "set escape hex-digit ..."},
{"filter", NULL, SetFilter, LOCAL_AUTH,
@ -1323,10 +1356,12 @@ static struct cmdtab const SetCommands[] = {
"Set login script", "set login chat-script", (const void *) VAR_LOGIN},
{"lqrperiod", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set LQR period", "set lqrperiod value", (const void *)VAR_LQRPERIOD},
{"mrru", NULL, SetVariable, LOCAL_AUTH, "Set MRRU value (enable multilink)",
"set mrru value", (const void *)VAR_MRRU},
{"mru", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set MRU value", "set mru value", (const void *)VAR_MRU},
{"mtu", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
"Set MTU value", "set mtu value", (const void *)VAR_MTU},
{"mtu", NULL, SetVariable, LOCAL_AUTH,
"Set interface MTU value", "set mtu value", (const void *)VAR_MTU},
{"nbns", NULL, SetVariable, LOCAL_AUTH, "Set NetBIOS Name Server",
"set nbns pri-addr [sec-addr]", (const void *)VAR_NBNS},
{"openmode", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "Set open mode",
@ -1702,6 +1737,14 @@ NegotiateSet(struct cmdargs const *arg)
cx->physical->link.lcp.cfg.protocomp &= keep;
cx->physical->link.lcp.cfg.protocomp |= add;
break;
case NEG_SHORTSEQ:
if (bundle_Phase(arg->bundle) != PHASE_DEAD)
LogPrintf(LogWARN, "shortseq: Only changable at phase DEAD\n");
else {
arg->bundle->ncp.mp.cfg.shortseq &= keep;
arg->bundle->ncp.mp.cfg.shortseq |= add;
}
break;
case NEG_VJCOMP:
arg->bundle->ncp.ipcp.cfg.vj.neg &= keep;
arg->bundle->ncp.ipcp.cfg.vj.neg |= add;
@ -1753,6 +1796,9 @@ static struct cmdtab const NegotiateCommands[] = {
{"protocomp", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX,
"Protocol field compression", "accept|deny|disable|enable",
(const void *)NEG_PROTOCOMP},
{"shortseq", NULL, NegotiateSet, LOCAL_AUTH,
"MP Short Sequence Numbers", "accept|deny|disable|enable",
(const void *)NEG_SHORTSEQ},
{"vjcomp", NULL, NegotiateSet, LOCAL_AUTH,
"Van Jacobson header compression", "accept|deny|disable|enable",
(const void *)NEG_VJCOMP},

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: datalink.c,v 1.1.2.41 1998/04/18 23:17:25 brian Exp $
* $Id: datalink.c,v 1.1.2.42 1998/04/19 15:24:39 brian Exp $
*/
#include <sys/types.h>
@ -444,6 +444,21 @@ datalink_AuthOk(struct datalink *dl)
{
/* XXX: Connect to another ppp instance HERE */
if (dl->physical->link.lcp.want_mrru) {
if (!mp_Up(&dl->bundle->ncp.mp,
dl->physical->link.lcp.want_mrru,
dl->physical->link.lcp.his_mrru,
dl->physical->link.lcp.want_shortseq,
dl->physical->link.lcp.his_shortseq)) {
datalink_AuthNotOk(dl);
return;
}
} else if (bundle_Phase(dl->bundle) == PHASE_NETWORK) {
LogPrintf(LogPHASE, "%s: Already in NETWORK phase\n", dl->name);
datalink_AuthNotOk(dl);
return;
}
FsmUp(&dl->physical->link.ccp.fsm);
FsmOpen(&dl->physical->link.ccp.fsm);
dl->state = DATALINK_OPEN;

View File

@ -23,34 +23,16 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: defs.c,v 1.11.4.7 1998/04/06 09:12:26 brian Exp $
* $Id: defs.c,v 1.11.4.8 1998/04/10 13:19:07 brian Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "defs.h"
static char dstsystem[50];
void
SetLabel(const char *label)
{
if (label)
strncpy(dstsystem, label, sizeof dstsystem - 1);
else
*dstsystem = '\0';
}
const char *
GetLabel()
{
return *dstsystem ? dstsystem : NULL;
}
void
randinit()
{

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: defs.h,v 1.29.2.12 1998/04/08 18:27:22 brian Exp $
* $Id: defs.h,v 1.29.2.13 1998/04/10 13:19:07 brian Exp $
*
* TODO:
*/
@ -77,6 +77,4 @@
#define PHYS_1OFF 32 /* Dial immediately, delete when done. (-background) */
#define PHYS_ALL 63
extern void SetLabel(const char *);
extern const char *GetLabel(void);
extern void randinit(void);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ipcp.c,v 1.50.2.40 1998/04/19 23:08:24 brian Exp $
* $Id: ipcp.c,v 1.50.2.41 1998/04/21 01:02:15 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@ -668,8 +668,9 @@ IpcpLayerDown(struct fsm *fp)
* associate executable sections in files with events.
*/
if (SelectSystem(fp->bundle, s, LINKDOWNFILE, NULL) < 0)
if (GetLabel()) {
if (SelectSystem(fp->bundle, GetLabel(), LINKDOWNFILE, NULL) < 0)
if (bundle_GetLabel(fp->bundle)) {
if (SelectSystem(fp->bundle, bundle_GetLabel(fp->bundle),
LINKDOWNFILE, NULL) < 0)
SelectSystem(fp->bundle, "MYADDR", LINKDOWNFILE, NULL);
} else
SelectSystem(fp->bundle, "MYADDR", LINKDOWNFILE, NULL);
@ -708,8 +709,9 @@ IpcpLayerUp(struct fsm *fp)
* associate executable sections in files with events.
*/
if (SelectSystem(fp->bundle, inet_ntoa(ipcp->my_ifip), LINKUPFILE, NULL) < 0)
if (GetLabel()) {
if (SelectSystem(fp->bundle, GetLabel(), LINKUPFILE, NULL) < 0)
if (bundle_GetLabel(fp->bundle)) {
if (SelectSystem(fp->bundle, bundle_GetLabel(fp->bundle),
LINKUPFILE, NULL) < 0)
SelectSystem(fp->bundle, "MYADDR", LINKUPFILE, NULL);
} else
SelectSystem(fp->bundle, "MYADDR", LINKUPFILE, NULL);

View File

@ -17,12 +17,17 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lcp.c,v 1.55.2.42 1998/04/16 00:26:05 brian Exp $
* $Id: lcp.c,v 1.55.2.43 1998/04/19 23:08:30 brian Exp $
*
* TODO:
* o Limit data field length by MRU
*/
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@ -35,6 +40,7 @@
#include "defs.h"
#include "timer.h"
#include "fsm.h"
#include "iplist.h"
#include "lcp.h"
#include "throughput.h"
#include "lcpproto.h"
@ -46,6 +52,11 @@
#include "link.h"
#include "physical.h"
#include "prompt.h"
#include "slcompress.h"
#include "ipcp.h"
#include "filter.h"
#include "mp.h"
#include "bundle.h"
/* for received LQRs */
struct lqrreq {
@ -99,9 +110,9 @@ static const char *cftypes[] = {
"CONTIME", /* 14: Connect-Time */
"COMPFRAME", /* 15: Compound-Frames */
"NDE", /* 16: Nominal-Data-Encapsulation */
"MULTIMRRU", /* 17: Multilink-MRRU */
"MULTISSNH", /* 18: Multilink-Short-Sequence-Number-Header */
"MULTIED", /* 19: Multilink-Endpoint-Descriminator */
"MRRU", /* 17: Multilink-MRRU */
"SHORTSEQ", /* 18: Multilink-Short-Sequence-Number-Header */
"ENDDISC", /* 19: Multilink-Endpoint-Descriminator */
"PROPRIETRY", /* 20: Proprietary */
"DCEID", /* 21: DCE-Identifier */
"MULTIPP", /* 22: Multi-Link-Plus-Procedure */
@ -120,22 +131,22 @@ lcp_ReportStatus(struct cmdargs const *arg)
State2Nam(lcp->fsm.state));
prompt_Printf(arg->prompt,
" his side: MRU %d, ACCMAP %08lx, PROTOCOMP %s, ACFCOMP %s,\n"
" MAGIC %08lx, REJECT %04x\n",
" MAGIC %08lx, MRRU %u, SHORTSEQ %s, REJECT %04x\n",
lcp->his_mru, (u_long)lcp->his_accmap,
lcp->his_protocomp ? "on" : "off",
lcp->his_acfcomp ? "on" : "off",
(u_long)lcp->his_magic, lcp->his_reject);
(u_long)lcp->his_magic, lcp->his_mrru,
lcp->his_shortseq ? "on" : "off", lcp->his_reject);
prompt_Printf(arg->prompt,
" my side: MRU %d, ACCMAP %08lx, PROTOCOMP %s, ACFCOMP %s,\n"
" MAGIC %08lx, REJECT %04x\n",
" MAGIC %08lx, MRRU %u, SHORTSEQ %s, REJECT %04x\n",
lcp->want_mru, (u_long)lcp->want_accmap,
lcp->want_protocomp ? "on" : "off",
lcp->want_acfcomp ? "on" : "off",
(u_long)lcp->want_magic, lcp->my_reject);
(u_long)lcp->want_magic, lcp->want_mrru,
lcp->want_shortseq ? "on" : "off", lcp->my_reject);
prompt_Printf(arg->prompt, "\n Defaults: MRU = %d, ", lcp->cfg.mru);
if (l->lcp.cfg.mtu)
prompt_Printf(arg->prompt, "MTU = %d, ", lcp->cfg.mtu);
prompt_Printf(arg->prompt, "ACCMAP = %08lx\n", (u_long)lcp->cfg.accmap);
prompt_Printf(arg->prompt, " LQR period = %us, ",
lcp->cfg.lqrperiod);
@ -165,7 +176,7 @@ GenerateMagic(void)
{
/* Generate random number which will be used as magic number */
randinit();
return (random());
return random();
}
void
@ -181,7 +192,6 @@ lcp_Init(struct lcp *lcp, struct bundle *bundle, struct link *l,
bundle, l, parent, &lcp_Callbacks, timer_names);
lcp->cfg.mru = DEF_MRU;
lcp->cfg.mtu = DEF_MTU;
lcp->cfg.accmap = 0;
lcp->cfg.openmode = 1;
lcp->cfg.lqrperiod = DEF_LQRPERIOD;
@ -203,12 +213,16 @@ lcp_Setup(struct lcp *lcp, int openmode)
lcp->fsm.maxconfig = 10;
lcp->his_mru = DEF_MRU;
lcp->his_mrru = 0;
lcp->his_magic = 0;
lcp->his_lqrperiod = 0;
lcp->his_acfcomp = 0;
lcp->his_auth = 0;
lcp->his_shortseq = 0;
lcp->want_mru = lcp->cfg.mru;
lcp->want_mrru = lcp->fsm.bundle->ncp.mp.cfg.mrru;
lcp->want_shortseq = IsEnabled(lcp->fsm.bundle->ncp.mp.cfg.shortseq) ? 1 : 0;
lcp->want_acfcomp = IsEnabled(lcp->cfg.acfcomp) ? 1 : 0;
if (lcp->fsm.parent) {
@ -250,8 +264,9 @@ LcpSendConfigReq(struct fsm *fp)
/* Send config REQ please */
struct physical *p = link2physical(fp->link);
struct lcp *lcp = fsm2lcp(fp);
u_char buff[100];
u_char buff[200];
struct lcp_opt *o;
struct mp *mp;
if (!p) {
LogPrintf(LogERROR, "LcpSendConfigReq: Not a physical link !\n");
@ -300,6 +315,22 @@ LcpSendConfigReq(struct fsm *fp)
INC_LCP_OPT(TY_AUTHPROTO, 5, o);
break;
}
if (lcp->want_mrru && !REJECTED(lcp, TY_MRRU)) {
*(u_short *)o->data = htons(lcp->want_mrru);
INC_LCP_OPT(TY_MRRU, 4, o);
if (lcp->want_shortseq && !REJECTED(lcp, TY_SHORTSEQ))
INC_LCP_OPT(TY_SHORTSEQ, 2, o);
}
mp = &lcp->fsm.bundle->ncp.mp;
if (mp->cfg.enddisc.class != 0 && !REJECTED(lcp, TY_ENDDISC)) {
*o->data = mp->cfg.enddisc.class;
memcpy(o->data+1, mp->cfg.enddisc.address, mp->cfg.enddisc.len);
INC_LCP_OPT(TY_ENDDISC, mp->cfg.enddisc.len + 3, o);
}
FsmOutput(fp, CODE_CONFIGREQ, fp->reqid, buff, (u_char *)o - buff);
}
@ -375,6 +406,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
u_short mtu, mru, *sp, proto;
struct lqrreq *req;
char request[20], desc[22];
struct mp *mp;
while (plen >= sizeof(struct fsmconfig)) {
type = *cp;
@ -386,6 +418,56 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
snprintf(request, sizeof request, " %s[%d]", cftypes[type], length);
switch (type) {
case TY_MRRU:
mp = &lcp->fsm.bundle->ncp.mp;
sp = (u_short *)(cp + 2);
mru = htons(*sp);
LogPrintf(LogLCP, "%s %u\n", request, mru);
switch (mode_type) {
case MODE_REQ:
if (mp->cfg.mrru) {
if (REJECTED(lcp, TY_MRRU))
/* Ignore his previous reject so that we REQ next time */
lcp->his_reject &= ~(1 << type);
mtu = lcp->fsm.bundle->cfg.mtu;
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);
memcpy(dec->nakend, cp, 4);
dec->nakend += 4;
} else {
lcp->his_mrru = mtu ? mtu : mru;
memcpy(dec->ackend, cp, 4);
dec->ackend += 4;
}
break;
} else
goto reqreject;
break;
case MODE_NAK:
if (mp->cfg.mrru) {
if (REJECTED(lcp, TY_MRRU))
/* Must have changed his mind ! */
lcp->his_reject &= ~(1 << type);
if (mru > MAX_MRU)
lcp->want_mrru = MAX_MRU;
else if (mru < MIN_MRU)
lcp->want_mrru = MIN_MRU;
else
lcp->want_mrru = mru;
}
/* else we honour our config and don't send the suggested REQ */
break;
case MODE_REJ:
lcp->his_reject |= (1 << type);
break;
}
break;
case TY_MRU:
sp = (u_short *) (cp + 2);
mru = htons(*sp);
@ -393,26 +475,26 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
switch (mode_type) {
case MODE_REQ:
mtu = lcp->cfg.mtu;
if (mtu == 0)
mtu = MAX_MTU;
if (mru > mtu) {
*sp = htons(mtu);
memcpy(dec->nakend, cp, 4);
dec->nakend += 4;
} else if (mru < MIN_MRU) {
*sp = htons(MIN_MRU);
memcpy(dec->nakend, cp, 4);
dec->nakend += 4;
} else {
lcp->his_mru = mru;
memcpy(dec->ackend, cp, 4);
dec->ackend += 4;
}
mtu = lcp->fsm.bundle->cfg.mtu;
if (mru < MIN_MRU || 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);
memcpy(dec->nakend, cp, 4);
dec->nakend += 4;
} else {
lcp->his_mru = mtu ? mtu : mru;
memcpy(dec->ackend, cp, 4);
dec->ackend += 4;
}
break;
case MODE_NAK:
if (mru >= MIN_MRU || mru <= MAX_MRU)
lcp->want_mru = mru;
if (mru > MAX_MRU)
lcp->want_mru = MAX_MRU;
else if (mru < MIN_MRU)
lcp->want_mru = MIN_MRU;
else
lcp->want_mru = mru;
break;
case MODE_REJ:
lcp->his_reject |= (1 << type);
@ -588,7 +670,6 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
lcp->LcpFailedMagic = 0;
}
} else {
lcp->my_reject |= (1 << type);
goto reqreject;
}
break;
@ -621,9 +702,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
memcpy(dec->nakend, cp, 2);
dec->nakend += 2;
#else
memcpy(dec->rejend, cp, 2);
dec->rejend += 2;
lcp->my_reject |= (1 << type);
goto reqreject;
#endif
}
break;
@ -651,9 +730,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
memcpy(dec->nakend, cp, 2);
dec->nakend += 2;
#else
memcpy(dec->rejend, cp, 2);
dec->rejend += 2;
lcp->my_reject |= (1 << type);
goto reqreject;
#endif
}
break;
@ -675,6 +752,62 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
}
break;
case TY_SHORTSEQ:
mp = &lcp->fsm.bundle->ncp.mp;
LogPrintf(LogLCP, "%s\n", request);
switch (mode_type) {
case MODE_REQ:
if (IsAccepted(mp->cfg.shortseq)) {
lcp->his_shortseq = 1;
memcpy(dec->ackend, cp, length);
dec->ackend += length;
} else
goto reqreject;
break;
case MODE_NAK:
/*
* He's trying to get us to ask for short sequence numbers.
* We ignore the NAK and honour our configuration file instead.
*/
break;
case MODE_REJ:
lcp->his_reject |= (1 << type);
break;
}
break;
case TY_ENDDISC:
LogPrintf(LogLCP, "%s %s\n", request,
mp_Enddisc(cp[2], cp + 3, length - 3));
switch (mode_type) {
case MODE_REQ:
if (length-3 < sizeof lcp->fsm.bundle->ncp.mp.peer_enddisc.address &&
cp[2] <= MAX_ENDDISC_CLASS) {
lcp->fsm.bundle->ncp.mp.peer_enddisc.class = cp[2];
lcp->fsm.bundle->ncp.mp.peer_enddisc.len = length-3;
memcpy(lcp->fsm.bundle->ncp.mp.peer_enddisc.address, cp+3, length-3);
lcp->fsm.bundle->ncp.mp.peer_enddisc.address[length-3] = '\0';
memcpy(dec->ackend, cp, length);
dec->ackend += length;
} else {
if (cp[2] > MAX_ENDDISC_CLASS)
LogPrintf(LogLCP, " ENDDISC rejected - unrecognised class %d\n",
cp[2]);
else
LogPrintf(LogLCP, " ENDDISC rejected - local max length is %d\n",
sizeof lcp->fsm.bundle->ncp.mp.peer_enddisc.address - 1);
goto reqreject;
}
break;
case MODE_NAK: /* Treat this as a REJ, we don't vary or disc */
case MODE_REJ:
lcp->his_reject |= (1 << type);
break;
}
break;
default:
sz = (sizeof desc - 2) / 2;
if (sz > length - 2)
@ -697,7 +830,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
dec->rejend += length;
lcp->my_reject |= (1 << type);
if (length != cp[1])
return;
length = 0; /* force our way out of the loop */
}
break;
}

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lcp.h,v 1.16.2.19 1998/04/07 00:53:56 brian Exp $
* $Id: lcp.h,v 1.16.2.20 1998/04/16 00:26:06 brian Exp $
*
* TODO:
*/
@ -25,20 +25,24 @@
struct lcp {
struct fsm fsm; /* The finite state machine */
u_int16_t his_mru; /* Peers maximum packet size */
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_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 */
unsigned his_acfcomp : 1; /* Does peer do addr & cntrl fld compression */
u_short his_auth; /* Peer wants this type of authentication */
u_short want_mru; /* Our maximum packet size */
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_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 */
unsigned want_acfcomp : 1; /* Do we do addr & cntrl fld compression */
u_short want_auth; /* We want this type of authentication */
u_int32_t his_reject; /* Request codes rejected by peer */
u_int32_t my_reject; /* Request codes I have rejected */
@ -50,7 +54,6 @@ struct lcp {
struct {
u_short mru; /* Preferred MRU value */
u_short mtu; /* Preferred MTU value */
u_int32_t accmap; /* Initial ACCMAP value */
int openmode; /* when to start CFG REQs */
u_int lqrperiod; /* LQR frequency */
@ -77,6 +80,9 @@ struct lcp {
#define TY_ACFCOMP 8 /* Address-and-Control-Field-Compression */
#define TY_FCSALT 9 /* FCS-Alternatives */
#define TY_SDP 10 /* Self-Describing-Padding */
#define TY_MRRU 17 /* Max Reconstructed Receive Unit (MP) */
#define TY_SHORTSEQ 18 /* Want short seqs (12bit) please (see mp.h) */
#define TY_ENDDISC 19 /* Endpoint discriminator */
#define MAX_LCP_OPT_LEN 10
struct lcp_opt {

View File

@ -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.48 1998/04/10 13:19:11 brian Exp $
* $Id: main.c,v 1.121.2.49 1998/04/16 00:26:08 brian Exp $
*
* TODO:
*/
@ -370,15 +370,18 @@ main(int argc, char **argv)
pending_signal(SIGUSR2, BringDownServer);
if (label) {
/*
* Set label both before and after SelectSystem !
* This way, "set enddisc label" works during SelectSystem, and we
* also end up with the correct label if we have embedded load
* commands.
*/
bundle_SetLabel(bundle, label);
if (SelectSystem(bundle, label, CONFFILE, prompt) < 0) {
prompt_Printf(prompt, "Destination system (%s) not found.\n", label);
AbortProgram(EX_START);
}
/*
* We don't SetLabel() 'till now in case SelectSystem() has an
* embeded load "otherlabel" command.
*/
SetLabel(label);
bundle_SetLabel(bundle, label);
if (mode == PHYS_DEMAND &&
bundle->ncp.ipcp.cfg.peer_range.ipaddr.s_addr == INADDR_ANY) {
prompt_Printf(prompt, "You must \"set ifaddr\" with a peer address "

View File

@ -23,15 +23,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp.c,v 1.1.2.5 1998/04/18 01:01:26 brian Exp $
* $Id: mp.c,v 1.1.2.6 1998/04/20 00:20:40 brian Exp $
*/
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
@ -62,12 +64,13 @@
#include "datalink.h"
#include "bundle.h"
#include "ip.h"
#include "prompt.h"
static u_int32_t
inc_seq(struct mp *mp, u_int32_t seq)
{
seq++;
if (mp->is12bit) {
if (mp->peer_is12bit) {
if (seq & 0xfffff000)
seq = 0;
} else if (seq & 0xff000000)
@ -78,7 +81,7 @@ inc_seq(struct mp *mp, u_int32_t seq)
static int
mp_ReadHeader(struct mp *mp, struct mbuf *m, struct mp_header *header)
{
if (mp->is12bit) {
if (mp->local_is12bit) {
header->seq = *(u_int16_t *)MBUF_CTOP(m);
if (header->seq & 0x3000) {
LogPrintf(LogWARN, "Oops - MP header without required zero bits\n");
@ -104,31 +107,35 @@ mp_ReadHeader(struct mp *mp, struct mbuf *m, struct mp_header *header)
static void
mp_LayerStart(void *v, struct fsm *fp)
{
/* The given FSM is about to start up ! */
/* The given FSM (ccp) is about to start up ! */
}
static void
mp_LayerUp(void *v, struct fsm *fp)
{
/* The given fsm is now up */
/* The given fsm (ccp) is now up */
}
static void
mp_LayerDown(void *v, struct fsm *fp)
{
/* The given FSM has been told to come down */
/* The given FSM (ccp) has been told to come down */
}
static void
mp_LayerFinish(void *v, struct fsm *fp)
{
/* The given fsm is now down */
/* The given fsm (ccp) is now down */
}
void
mp_Init(struct mp *mp, struct bundle *bundle)
{
mp->is12bit = 0;
mp->peer_is12bit = mp->local_is12bit = 0;
mp->peer_mrru = mp->local_mrru = 0;
mp->peer_enddisc.class = 0;
*mp->peer_enddisc.address = '\0';
mp->peer_enddisc.len = 0;
mp->seq.out = 0;
mp->seq.min_in = 0;
mp->seq.next_in = 0;
@ -149,16 +156,48 @@ mp_Init(struct mp *mp, struct bundle *bundle)
mp->fsmp.LayerFinish = mp_LayerFinish;
mp->fsmp.object = mp;
mp->cfg.mrru = 0;
mp->cfg.shortseq = NEG_ENABLED|NEG_ACCEPTED;
mp->cfg.enddisc.class = 0;
*mp->cfg.enddisc.address = '\0';
mp->cfg.enddisc.len = 0;
lcp_Init(&mp->link.lcp, mp->bundle, &mp->link, NULL);
ccp_Init(&mp->link.ccp, mp->bundle, &mp->link, &mp->fsmp);
}
/* Our lcp's already up 'cos of the NULL parent */
FsmUp(&mp->link.ccp.fsm);
FsmOpen(&mp->link.ccp.fsm);
int
mp_Up(struct mp *mp, u_short local_mrru, u_short peer_mrru,
int local_shortseq, int peer_shortseq)
{
if (mp->active) {
/* We're adding a link - do a last validation on our parameters */
if (mp->local_mrru != local_mrru ||
mp->peer_mrru != peer_mrru ||
mp->local_is12bit != local_shortseq ||
mp->peer_is12bit != peer_shortseq) {
LogPrintf(LogPHASE, "Invalid MRRU/SHORTSEQ MP parameters !\n");
return 0;
}
} else {
/* First link in multilink mode */
mp->active = 1;
mp->local_mrru = local_mrru;
mp->peer_mrru = peer_mrru;
mp->local_is12bit = local_shortseq;
mp->peer_is12bit = peer_shortseq;
bundle_LayerUp(mp->bundle, &mp->link.lcp.fsm);
/* Re-point our IPCP layer at our MP link */
ipcp_Init(&mp->bundle->ncp.ipcp, mp->bundle, &mp->link, &mp->bundle->fsm);
/* Our lcp's already up 'cos of the NULL parent */
FsmUp(&mp->link.ccp.fsm);
FsmOpen(&mp->link.ccp.fsm);
mp->active = 1;
}
return 1;
}
void
@ -358,7 +397,7 @@ mp_Output(struct mp *mp, struct link *l, struct mbuf *m, int begin, int end)
seq16 = (u_int16_t *)cp;
*seq32 = 0;
*cp = (begin << 7) | (end << 6);
if (mp->is12bit) {
if (mp->peer_is12bit) {
*seq16 |= (u_int16_t)mp->seq.out;
mo->cnt = 2;
} else {
@ -448,3 +487,152 @@ mp_SetDatalinkWeight(struct cmdargs const *arg)
arg->cx->mp.weight = val;
return 0;
}
int
mp_ShowStatus(struct cmdargs const *arg)
{
struct mp *mp = &arg->bundle->ncp.mp;
prompt_Printf(arg->prompt, "Multilink is %sactive\n", mp->active ? "" : "in");
prompt_Printf(arg->prompt, "\nMy Side:\n");
if (mp->active) {
prompt_Printf(arg->prompt, " MRRU: %u\n", mp->local_mrru);
prompt_Printf(arg->prompt, " Short Seq: %s\n",
mp->local_is12bit ? "on" : "off");
}
prompt_Printf(arg->prompt, " End Disc: %s\n",
mp_Enddisc(mp->cfg.enddisc.class, mp->cfg.enddisc.address,
mp->cfg.enddisc.len));
prompt_Printf(arg->prompt, "\nHis Side:\n");
if (mp->active) {
prompt_Printf(arg->prompt, " Next SEQ: %u\n", mp->seq.out);
prompt_Printf(arg->prompt, " MRRU: %u\n", mp->peer_mrru);
prompt_Printf(arg->prompt, " Short Seq: %s\n",
mp->peer_is12bit ? "on" : "off");
}
prompt_Printf(arg->prompt, " End Disc: %s\n",
mp_Enddisc(mp->peer_enddisc.class, mp->peer_enddisc.address,
mp->peer_enddisc.len));
prompt_Printf(arg->prompt, "\nDefaults:\n");
prompt_Printf(arg->prompt, " MRRU: ");
if (mp->cfg.mrru)
prompt_Printf(arg->prompt, "%d (multilink enabled)\n", mp->cfg.mrru);
else
prompt_Printf(arg->prompt, "disabled\n");
prompt_Printf(arg->prompt, " Short Seq: %s\n",
command_ShowNegval(mp->cfg.shortseq));
return 0;
}
const char *
mp_Enddisc(u_char c, const char *address, int len)
{
static char result[100];
int f, header;
switch (c) {
case 0:
sprintf(result, "Null Class");
break;
case 1:
snprintf(result, sizeof result, "Local Addr: %.*s", len, address);
break;
case 2:
if (len == 4)
snprintf(result, sizeof result, "IP %s",
inet_ntoa(*(const struct in_addr *)address));
else
sprintf(result, "IP[%d] ???", len);
break;
case 3:
if (len == 6) {
const u_char *m = (const u_char *)address;
snprintf(result, sizeof result, "MAC %02x:%02x:%02x:%02x:%02x:%02x",
m[0], m[1], m[2], m[3], m[4], m[5]);
} else
sprintf(result, "MAC[%d] ???", len);
break;
case 4:
sprintf(result, "Magic: 0x");
header = strlen(result);
if (len > sizeof result - header - 1)
len = sizeof result - header - 1;
for (f = 0; f < len; f++)
sprintf(result + header + 2 * f, "%02x", address[f]);
break;
case 5:
snprintf(result, sizeof result, "PSN: %.*s", len, address);
break;
default:
sprintf(result, "%d: ", (int)c);
header = strlen(result);
if (len > sizeof result - header - 1)
len = sizeof result - header - 1;
for (f = 0; f < len; f++)
sprintf(result + header + 2 * f, "%02x", address[f]);
break;
}
return result;
}
int
mp_SetEnddisc(struct cmdargs const *arg)
{
struct mp *mp = &arg->bundle->ncp.mp;
if (bundle_Phase(arg->bundle) != PHASE_DEAD) {
LogPrintf(LogWARN, "set enddisc: Only available at phase DEAD\n");
return 1;
}
if (arg->argc == arg->argn) {
mp->cfg.enddisc.class = 0;
*mp->cfg.enddisc.address = '\0';
mp->cfg.enddisc.len = 0;
} else if (arg->argc > arg->argn)
if (!strcasecmp(arg->argv[arg->argn], "ip")) {
memcpy(mp->cfg.enddisc.address,
&arg->bundle->ncp.ipcp.my_ip.s_addr,
sizeof arg->bundle->ncp.ipcp.my_ip.s_addr);
mp->cfg.enddisc.class = 2;
mp->cfg.enddisc.len = sizeof arg->bundle->ncp.ipcp.my_ip.s_addr;
} else if (!strcasecmp(arg->argv[arg->argn], "magic")) {
int f;
randinit();
for (f = 0; f < 20; f += sizeof(long))
*(long *)(mp->cfg.enddisc.address + f) = random();
mp->cfg.enddisc.class = 4;
mp->cfg.enddisc.len = 20;
} else if (!strcasecmp(arg->argv[arg->argn], "label")) {
mp->cfg.enddisc.class = 1;
strcpy(mp->cfg.enddisc.address, arg->bundle->cfg.label);
mp->cfg.enddisc.len = strlen(mp->cfg.enddisc.address);
} else if (!strcasecmp(arg->argv[arg->argn], "psn")) {
if (arg->argc > arg->argn+1) {
mp->cfg.enddisc.class = 5;
strcpy(mp->cfg.enddisc.address, arg->argv[arg->argn+1]);
mp->cfg.enddisc.len = strlen(mp->cfg.enddisc.address);
} else {
LogPrintf(LogWARN, "PSN endpoint requires additional data\n");
return 2;
}
} else {
LogPrintf(LogWARN, "%s: Unrecognised endpoint type\n",
arg->argv[arg->argn]);
return 3;
}
return 0;
}

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp.h,v 1.1.2.1 1998/04/03 19:21:46 brian Exp $
* $Id: mp.h,v 1.1.2.2 1998/04/07 00:54:11 brian Exp $
*/
struct mbuf;
@ -35,18 +35,36 @@ struct mp {
struct link link;
unsigned active : 1;
unsigned is12bit : 1; /* 12 / 24bit seq nos */
unsigned peer_is12bit : 1; /* 12 / 24bit seq nos */
unsigned local_is12bit : 1;
u_short peer_mrru;
u_short local_mrru;
struct {
u_char class;
char address[50];
int len;
} peer_enddisc; /* peers endpoint discriminator */
struct {
u_int32_t out; /* next outgoing seq */
u_int32_t min_in; /* minimum received incoming seq */
u_int32_t next_in; /* next incoming seq to process */
} seq;
struct {
u_short mrru; /* Max Reconstructed Receive Unit */
unsigned shortseq : 2; /* I want short Sequence Numbers */
struct {
u_char class;
char address[50];
int len;
} enddisc; /* endpoint discriminator */
} cfg;
struct mbuf *inbufs; /* Received fragments */
struct fsm_parent fsmp; /* Our callback functions */
struct bundle *bundle;
struct bundle *bundle; /* Parent */
};
struct mp_link {
@ -62,6 +80,10 @@ struct mp_header {
extern void mp_Init(struct mp *, struct bundle *);
extern void mp_linkInit(struct mp_link *);
extern int mp_Up(struct mp *, u_short, u_short, int, int);
extern void mp_Input(struct mp *, struct mbuf *, struct physical *);
extern int mp_FillQueues(struct bundle *);
extern int mp_SetDatalinkWeight(struct cmdargs const *);
extern int mp_ShowStatus(struct cmdargs const *);
extern const char *mp_Enddisc(u_char, const char *, int);
extern int mp_SetEnddisc(struct cmdargs const *);

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.97.2.18 1998/04/17 22:05:37 brian Exp $
.\" $Id: ppp.8,v 1.97.2.19 1998/04/19 02:23:21 brian Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -1816,8 +1816,15 @@ compression will be used by the Compression Control Protocol (CCP).
Default: Enabled and Accepted. This option is used to negotiate
PFC (Protocol Field Compression), a mechanism where the protocol
field number is reduced to one octet rather than two.
.It shortseq
Default: Enabled and Accepted. This option determines if
.Nm
will request and accept requests for short
.Pq 12 bit
sequence numbers when negotiating multilink mode. This is only
applicable if our MRRU is set (thus enabling multilink).
.It vjcomp
Default: Enabled and Accepted. This option decides if Van Jacobson
Default: Enabled and Accepted. This option determines if Van Jacobson
header compression will be used.
.El
.Pp
@ -2425,6 +2432,32 @@ This, of course means that it is possible to execute an entirely external
command rather than using the internal one. See
.Xr chat 8
for a good alternative.
.It set enddisc Op IP|magic|label|psn value
This command sets our local endpoint discriminator. If set prior to
LCP negotiation,
.Nm
will send the information to the peer using the LCP endpoint discriminator
option. The following discriminators may be set:
.Bd -literal -offset indent
.It IP
Our local IP number is used. As LCP is negotiated prior to IPCP, it is
possible that the IPCP layer will subsequently change this value. If
it does, the endpoint descriminator stays at the old value unless manually
reset.
.It magic
A 20 digit random number is used.
.It label
The current label is used.
.It psn Ar value
The given
.Ar value
is used.
.Ar Value
should be set to an absolute public switched network number with the
country code first.
.Ed
.Pp
If no arguments are given, the endpoint discriminator is reset.
.It set escape Ar value...
This option is similar to the
.Dq set accmap
@ -2591,18 +2624,31 @@ or
packets are sent. The default is 30 seconds. You must also use the
.Dq enable lqr
command if you wish to send LQR requests to the peer.
.It set mrru Ar value
Setting this option enables Multilink PPP negotiations, also know as
Multilink Protocol or MP. There is no default MRRU (Maximum
Reconstructed Receive Unit) value.
.Em PPP
protocol *must* be able to accept packets of at
least 1500 octets.
.It set mru Ar value
The default MRU is 1500. If it is increased, the other side *may*
increase its mtu. There is no use decreasing the MRU to below the
default as the
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
The default MTU is 1500. This may be increased by the MRU specified
by the peer. It may only be subsequently decreased by this option.
Increasing it is not valid as the peer is not necessarily able to
receive the increased packet size.
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
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).
.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,