version 1.1.1.2, 2016/11/01 09:56:12
|
version 1.1.1.3, 2021/03/17 00:39:23
|
Line 100
|
Line 100
|
{ "MULTILINKHEADERFMT", TY_MULTILINKHEADERFMT, 0, 0, FALSE }, |
{ "MULTILINKHEADERFMT", TY_MULTILINKHEADERFMT, 0, 0, FALSE }, |
{ "INTERNAT", TY_INTERNAT, 0, 0, FALSE }, |
{ "INTERNAT", TY_INTERNAT, 0, 0, FALSE }, |
{ "SDATALINKSONET", TY_SDATALINKSONET, 0, 0, FALSE }, |
{ "SDATALINKSONET", TY_SDATALINKSONET, 0, 0, FALSE }, |
{ NULL } | { NULL, 0, 0, 0, 0 } |
}; |
}; |
|
|
static struct fsmtype gLcpFsmType = { |
static struct fsmtype gLcpFsmType = { |
Line 126
|
Line 126
|
NULL, |
NULL, |
NULL, |
NULL, |
LcpRecvIdent, |
LcpRecvIdent, |
|
NULL, NULL, NULL |
}; |
}; |
|
|
/* List of possible Authentication Protocols */ |
/* List of possible Authentication Protocols */ |
Line 224 LcpConfigure(Fsm fp)
|
Line 225 LcpConfigure(Fsm fp)
|
lcp->fsm.conf.check_magic = |
lcp->fsm.conf.check_magic = |
Enabled(&l->conf.options, LINK_CONF_CHECK_MAGIC); |
Enabled(&l->conf.options, LINK_CONF_CHECK_MAGIC); |
lcp->peer_reject = 0; |
lcp->peer_reject = 0; |
|
lcp->need_reset = 0; |
|
|
/* Initialize normal LCP stuff */ |
/* Initialize normal LCP stuff */ |
lcp->peer_mru = PhysGetMtu(l, 1); |
lcp->peer_mru = PhysGetMtu(l, 1); |
Line 526 LcpAuthResult(Link l, int success)
|
Line 528 LcpAuthResult(Link l, int success)
|
*/ |
*/ |
|
|
int |
int |
LcpStat(Context ctx, int ac, char *av[], void *arg) | LcpStat(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
Link const l = ctx->lnk; |
Link const l = ctx->lnk; |
LcpState const lcp = &l->lcp; |
LcpState const lcp = &l->lcp; |
char buf[64]; |
char buf[64]; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("%s [%s]\r\n", lcp->fsm.type->name, FsmStateName(lcp->fsm.state)); |
Printf("%s [%s]\r\n", lcp->fsm.type->name, FsmStateName(lcp->fsm.state)); |
|
|
Printf("Self:\r\n"); |
Printf("Self:\r\n"); |
Line 681 static void
|
Line 687 static void
|
LcpLayerDown(Fsm fp) |
LcpLayerDown(Fsm fp) |
{ |
{ |
Link l = (Link)fp->arg; |
Link l = (Link)fp->arg; |
|
LcpState const lcp = &l->lcp; |
|
|
LcpStopActivity(l); |
LcpStopActivity(l); |
|
if (lcp->phase == PHASE_AUTHENTICATE || lcp->phase == PHASE_NETWORK) |
|
lcp->need_reset = 1; |
} |
} |
|
|
void LcpOpen(Link l) |
void LcpOpen(Link l) |
Line 711 void LcpDown(Link l)
|
Line 721 void LcpDown(Link l)
|
static int |
static int |
LcpRecvProtoRej(Fsm fp, int proto, Mbuf bp) |
LcpRecvProtoRej(Fsm fp, int proto, Mbuf bp) |
{ |
{ |
Link l = (Link)fp->arg; | Link l = (Link)fp->arg; |
int fatal = FALSE; |
int fatal = FALSE; |
Fsm rej = NULL; |
Fsm rej = NULL; |
|
|
|
(void)bp; |
|
|
/* Which protocol? */ |
/* Which protocol? */ |
switch (proto) { |
switch (proto) { |
case PROTO_CCP: |
case PROTO_CCP: |
Line 749 static void
|
Line 761 static void
|
LcpRecvIdent(Fsm fp, Mbuf bp) |
LcpRecvIdent(Fsm fp, Mbuf bp) |
{ |
{ |
Link l = (Link)fp->arg; |
Link l = (Link)fp->arg; |
int len, clen; | unsigned len, clen; |
|
|
if (bp == NULL) |
if (bp == NULL) |
return; |
return; |
Line 793 LcpDecodeConfig(Fsm fp, FsmOption list, int num, int m
|
Line 805 LcpDecodeConfig(Fsm fp, FsmOption list, int num, int m
|
|
|
/* If we have got request, forget the previous values */ |
/* If we have got request, forget the previous values */ |
if (mode == MODE_REQ) { |
if (mode == MODE_REQ) { |
|
if (lcp->need_reset) /* perform complete reset when going back */ |
|
LcpConfigure(fp); /* from PHASE_AUTHENTICATE or PHASE_NETWORK */ |
|
else { |
lcp->peer_mru = PhysGetMtu(l, 1); |
lcp->peer_mru = PhysGetMtu(l, 1); |
lcp->peer_accmap = 0xffffffff; |
lcp->peer_accmap = 0xffffffff; |
lcp->peer_acfcomp = FALSE; |
lcp->peer_acfcomp = FALSE; |
Line 802 LcpDecodeConfig(Fsm fp, FsmOption list, int num, int m
|
Line 817 LcpDecodeConfig(Fsm fp, FsmOption list, int num, int m
|
lcp->peer_alg = 0; |
lcp->peer_alg = 0; |
lcp->peer_mrru = 0; |
lcp->peer_mrru = 0; |
lcp->peer_shortseq = FALSE; |
lcp->peer_shortseq = FALSE; |
|
} |
} |
} |
|
|
/* Decode each config option */ |
/* Decode each config option */ |
Line 1245 LcpInput(Link l, Mbuf bp)
|
Line 1261 LcpInput(Link l, Mbuf bp)
|
static const struct fsmoption * |
static const struct fsmoption * |
LcpAuthProtoNak(ushort proto, u_char alg) |
LcpAuthProtoNak(ushort proto, u_char alg) |
{ |
{ |
static const u_char chapmd5cf[] = | static u_char chapmd5cf[] = |
{ PROTO_CHAP >> 8, PROTO_CHAP & 0xff, CHAP_ALG_MD5 }; |
{ PROTO_CHAP >> 8, PROTO_CHAP & 0xff, CHAP_ALG_MD5 }; |
static const struct fsmoption chapmd5Nak = |
static const struct fsmoption chapmd5Nak = |
{ TY_AUTHPROTO, 2 + sizeof(chapmd5cf), (u_char *) chapmd5cf }; |
{ TY_AUTHPROTO, 2 + sizeof(chapmd5cf), (u_char *) chapmd5cf }; |
|
|
static const u_char chapmsv1cf[] = | static u_char chapmsv1cf[] = |
{ PROTO_CHAP >> 8, PROTO_CHAP & 0xff, CHAP_ALG_MSOFT }; |
{ PROTO_CHAP >> 8, PROTO_CHAP & 0xff, CHAP_ALG_MSOFT }; |
static const struct fsmoption chapmsv1Nak = |
static const struct fsmoption chapmsv1Nak = |
{ TY_AUTHPROTO, 2 + sizeof(chapmsv1cf), (u_char *) chapmsv1cf }; |
{ TY_AUTHPROTO, 2 + sizeof(chapmsv1cf), (u_char *) chapmsv1cf }; |
|
|
static const u_char chapmsv2cf[] = | static u_char chapmsv2cf[] = |
{ PROTO_CHAP >> 8, PROTO_CHAP & 0xff, CHAP_ALG_MSOFTv2 }; |
{ PROTO_CHAP >> 8, PROTO_CHAP & 0xff, CHAP_ALG_MSOFTv2 }; |
static const struct fsmoption chapmsv2Nak = | static struct fsmoption chapmsv2Nak = |
{ TY_AUTHPROTO, 2 + sizeof(chapmsv2cf), (u_char *) chapmsv2cf }; |
{ TY_AUTHPROTO, 2 + sizeof(chapmsv2cf), (u_char *) chapmsv2cf }; |
|
|
static const u_char papcf[] = | static u_char papcf[] = |
{ PROTO_PAP >> 8, PROTO_PAP & 0xff }; |
{ PROTO_PAP >> 8, PROTO_PAP & 0xff }; |
static const struct fsmoption papNak = | static struct fsmoption papNak = |
{ TY_AUTHPROTO, 2 + sizeof(papcf), (u_char *) papcf }; |
{ TY_AUTHPROTO, 2 + sizeof(papcf), (u_char *) papcf }; |
|
|
static const u_char eapcf[] = | static u_char eapcf[] = |
{ PROTO_EAP >> 8, PROTO_EAP & 0xff }; |
{ PROTO_EAP >> 8, PROTO_EAP & 0xff }; |
static const struct fsmoption eapNak = | static struct fsmoption eapNak = |
{ TY_AUTHPROTO, 2 + sizeof(eapcf), (u_char *) eapcf }; |
{ TY_AUTHPROTO, 2 + sizeof(eapcf), (u_char *) eapcf }; |
|
|
if (proto == PROTO_PAP) { |
if (proto == PROTO_PAP) { |