version 1.1.1.2, 2016/11/01 09:56:12
|
version 1.1.1.3, 2021/03/17 00:39:23
|
Line 68
|
Line 68
|
static void EcpRecvResetReq(Fsm fp, int id, Mbuf bp); |
static void EcpRecvResetReq(Fsm fp, int id, Mbuf bp); |
static void EcpRecvResetAck(Fsm fp, int id, Mbuf bp); |
static void EcpRecvResetAck(Fsm fp, int id, Mbuf bp); |
|
|
static int EcpSetCommand(Context ctx, int ac, char *av[], void *arg); | static int EcpSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static EncType EcpFindType(int type, int *indexp); |
static EncType EcpFindType(int type, int *indexp); |
static const char *EcpTypeName(int type); |
static const char *EcpTypeName(int type); |
|
|
Line 94
|
Line 94
|
EcpSetCommand, NULL, 2, (void *) SET_YES }, |
EcpSetCommand, NULL, 2, (void *) SET_YES }, |
{ "no [opt ...]", "Disable and deny option", |
{ "no [opt ...]", "Disable and deny option", |
EcpSetCommand, NULL, 2, (void *) SET_NO }, |
EcpSetCommand, NULL, 2, (void *) SET_NO }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
/* |
/* |
Line 141
|
Line 141
|
EcpFailure, |
EcpFailure, |
EcpRecvResetReq, |
EcpRecvResetReq, |
EcpRecvResetAck, |
EcpRecvResetAck, |
|
NULL, NULL, NULL, NULL |
}; |
}; |
|
|
/* Names for different types of encryption */ |
/* Names for different types of encryption */ |
Line 161
|
Line 162
|
|
|
int gEcpCsock = -1; /* Socket node control socket */ |
int gEcpCsock = -1; /* Socket node control socket */ |
int gEcpDsock = -1; /* Socket node data socket */ |
int gEcpDsock = -1; /* Socket node data socket */ |
EventRef gEcpDataEvent; | static EventRef gEcpDataEvent; |
|
|
int |
int |
EcpsInit(void) |
EcpsInit(void) |
Line 214 EcpInit(Bund b)
|
Line 215 EcpInit(Bund b)
|
if (gConfList == NULL) |
if (gConfList == NULL) |
{ |
{ |
struct confinfo *ci; |
struct confinfo *ci; |
int k; | unsigned k; |
|
|
ci = Malloc(MB_CRYPT, (ECP_NUM_PROTOS + 1) * sizeof(*ci)); |
ci = Malloc(MB_CRYPT, (ECP_NUM_PROTOS + 1) * sizeof(*ci)); |
for (k = 0; k < ECP_NUM_PROTOS; k++) |
for (k = 0; k < ECP_NUM_PROTOS; k++) |
Line 251 EcpConfigure(Fsm fp)
|
Line 252 EcpConfigure(Fsm fp)
|
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
EcpState const ecp = &b->ecp; |
EcpState const ecp = &b->ecp; |
int k; | unsigned k; |
|
|
for (k = 0; k < ECP_NUM_PROTOS; k++) |
for (k = 0; k < ECP_NUM_PROTOS; k++) |
{ |
{ |
Line 275 EcpUnConfigure(Fsm fp)
|
Line 276 EcpUnConfigure(Fsm fp)
|
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
EcpState const ecp = &b->ecp; |
EcpState const ecp = &b->ecp; |
int k; | unsigned k; |
|
|
for (k = 0; k < ECP_NUM_PROTOS; k++) |
for (k = 0; k < ECP_NUM_PROTOS; k++) |
{ |
{ |
Line 305 EcpNgDataEvent(int type, void *cookie)
|
Line 306 EcpNgDataEvent(int type, void *cookie)
|
char *bundname, *rest, *b1; |
char *bundname, *rest, *b1; |
int id; |
int id; |
|
|
|
(void)type; |
|
(void)cookie; |
while (1) { |
while (1) { |
/* Protect from bundle shutdown and DoS */ |
/* Protect from bundle shutdown and DoS */ |
if (num > 100) |
if (num > 100) |
Line 507 static void
|
Line 510 static void
|
EcpFailure(Fsm fp, enum fsmfail reason) |
EcpFailure(Fsm fp, enum fsmfail reason) |
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
|
|
|
(void)reason; |
if (Enabled(&b->conf.options, BUND_CONF_CRYPT_REQD)) { |
if (Enabled(&b->conf.options, BUND_CONF_CRYPT_REQD)) { |
FsmFailure(&b->ipcp.fsm, FAIL_CANT_ENCRYPT); |
FsmFailure(&b->ipcp.fsm, FAIL_CANT_ENCRYPT); |
FsmFailure(&b->ipv6cp.fsm, FAIL_CANT_ENCRYPT); |
FsmFailure(&b->ipv6cp.fsm, FAIL_CANT_ENCRYPT); |
Line 518 EcpFailure(Fsm fp, enum fsmfail reason)
|
Line 523 EcpFailure(Fsm fp, enum fsmfail reason)
|
*/ |
*/ |
|
|
int |
int |
EcpStat(Context ctx, int ac, char *av[], void *arg) | EcpStat(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
EcpState const ecp = &ctx->bund->ecp; |
EcpState const ecp = &ctx->bund->ecp; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("[%s] %s [%s]\r\n", Pref(&ecp->fsm), Fsm(&ecp->fsm), FsmStateName(ecp->fsm.state)); |
Printf("[%s] %s [%s]\r\n", Pref(&ecp->fsm), Fsm(&ecp->fsm), FsmStateName(ecp->fsm.state)); |
Printf("Enabled protocols:\r\n"); |
Printf("Enabled protocols:\r\n"); |
OptStat(ctx, &ecp->options, gConfList); |
OptStat(ctx, &ecp->options, gConfList); |
Line 609 EcpBuildConfigReq(Fsm fp, u_char *cp)
|
Line 618 EcpBuildConfigReq(Fsm fp, u_char *cp)
|
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
EcpState const ecp = &b->ecp; |
EcpState const ecp = &b->ecp; |
int type; | unsigned type; |
|
|
/* Put in all options that peer hasn't rejected */ |
/* Put in all options that peer hasn't rejected */ |
|
|
Line 829 EcpSubtractBloat(Bund b, int size)
|
Line 838 EcpSubtractBloat(Bund b, int size)
|
*/ |
*/ |
|
|
static int |
static int |
EcpSetCommand(Context ctx, int ac, char *av[], void *arg) | EcpSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
EcpState const ecp = &ctx->bund->ecp; |
EcpState const ecp = &ctx->bund->ecp; |
|
|
Line 880 EcpSetCommand(Context ctx, int ac, char *av[], void *a
|
Line 889 EcpSetCommand(Context ctx, int ac, char *av[], void *a
|
static EncType |
static EncType |
EcpFindType(int type, int *indexp) |
EcpFindType(int type, int *indexp) |
{ |
{ |
int k; | unsigned k; |
|
|
for (k = 0; k < ECP_NUM_PROTOS; k++) |
for (k = 0; k < ECP_NUM_PROTOS; k++) |
if (gEncTypes[k]->type == type) |
if (gEncTypes[k]->type == type) |