version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.3, 2021/03/17 00:39:23
|
Line 58
|
Line 58
|
static void CcpRecvResetAck(Fsm fp, int id, Mbuf bp); |
static void CcpRecvResetAck(Fsm fp, int id, Mbuf bp); |
|
|
static int CcpCheckEncryption(Bund b); |
static int CcpCheckEncryption(Bund b); |
static int CcpSetCommand(Context ctx, int ac, char *av[], void *arg); | static int CcpSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static CompType CcpFindComp(int type, int *indexp); |
static CompType CcpFindComp(int type, int *indexp); |
static const char *CcpTypeName(int type, char *buf, size_t len); |
static const char *CcpTypeName(int type, char *buf, size_t len); |
|
|
Line 82
|
Line 82
|
CcpSetCommand, NULL, 2, (void *) SET_YES }, |
CcpSetCommand, NULL, 2, (void *) SET_YES }, |
{ "no [opt ...]", "Disable and deny option", |
{ "no [opt ...]", "Disable and deny option", |
CcpSetCommand, NULL, 2, (void *) SET_NO }, |
CcpSetCommand, NULL, 2, (void *) SET_NO }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
/* |
/* |
Line 129
|
Line 129
|
CcpFailure, |
CcpFailure, |
CcpRecvResetReq, |
CcpRecvResetReq, |
CcpRecvResetAck, |
CcpRecvResetAck, |
NULL, | NULL, NULL, NULL, NULL |
}; |
}; |
|
|
/* Names for different types of compression */ |
/* Names for different types of compression */ |
Line 148
|
Line 148
|
{ CCP_TY_V42BIS, "V42BIS" }, |
{ CCP_TY_V42BIS, "V42BIS" }, |
{ CCP_TY_BSD, "BSD" }, |
{ CCP_TY_BSD, "BSD" }, |
{ CCP_TY_LZS_DCP, "LZS-DCP" }, |
{ CCP_TY_LZS_DCP, "LZS-DCP" }, |
{ CCP_TY_DEFLATE24, "DEFLATE24" }, | { CCP_TY_MVRCA, "MVRCA" }, |
{ CCP_TY_DCE, "DCE" }, |
{ CCP_TY_DCE, "DCE" }, |
{ CCP_TY_DEFLATE, "DEFLATE" }, |
{ CCP_TY_DEFLATE, "DEFLATE" }, |
{ CCP_TY_V44, "V.44/LZJH" }, |
{ CCP_TY_V44, "V.44/LZJH" }, |
{ 0, NULL }, |
{ 0, NULL }, |
}; |
}; |
|
|
int gCcpCsock = -1; /* Socket node control socket */ | int gCcpCsock = -1; /* Socket node control socket */ |
int gCcpDsock = -1; /* Socket node data socket */ | int gCcpDsock = -1; /* Socket node data socket */ |
EventRef gCcpCtrlEvent; | static EventRef gCcpCtrlEvent; |
EventRef gCcpDataEvent; | static EventRef gCcpDataEvent; |
|
|
int |
int |
CcpsInit(void) |
CcpsInit(void) |
Line 211 CcpInit(Bund b)
|
Line 211 CcpInit(Bund b)
|
/* Construct options list if we haven't done so already */ |
/* Construct options list if we haven't done so already */ |
if (gConfList == NULL) { |
if (gConfList == NULL) { |
struct confinfo *ci; |
struct confinfo *ci; |
int k; | unsigned k; |
|
|
ci = Malloc(MB_COMP, (CCP_NUM_PROTOS + 1) * sizeof(*ci)); |
ci = Malloc(MB_COMP, (CCP_NUM_PROTOS + 1) * sizeof(*ci)); |
for (k = 0; k < CCP_NUM_PROTOS; k++) { |
for (k = 0; k < CCP_NUM_PROTOS; k++) { |
Line 249 CcpConfigure(Fsm fp)
|
Line 249 CcpConfigure(Fsm fp)
|
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
CcpState const ccp = &b->ccp; |
CcpState const ccp = &b->ccp; |
int k; | unsigned k; |
|
|
/* Reset state */ |
/* Reset state */ |
ccp->self_reject = 0; |
ccp->self_reject = 0; |
Line 282 CcpUnConfigure(Fsm fp)
|
Line 282 CcpUnConfigure(Fsm fp)
|
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
CcpState const ccp = &b->ccp; |
CcpState const ccp = &b->ccp; |
int k; | unsigned k; |
|
|
/* Reset state */ |
/* Reset state */ |
ccp->self_reject = 0; |
ccp->self_reject = 0; |
Line 315 CcpNgCtrlEvent(int type, void *cookie)
|
Line 315 CcpNgCtrlEvent(int type, void *cookie)
|
int i, len; |
int i, len; |
ng_ID_t id; |
ng_ID_t id; |
|
|
|
(void)cookie; |
|
(void)type; |
|
|
/* Read message */ |
/* Read message */ |
if ((len = NgRecvMsg(gCcpCsock, &u.msg, sizeof(u), raddr)) < 0) { |
if ((len = NgRecvMsg(gCcpCsock, &u.msg, sizeof(u), raddr)) < 0) { |
Perror("CcpNgCtrlEvent: can't read message"); |
Perror("CcpNgCtrlEvent: can't read message"); |
Line 376 CcpNgDataEvent(int type, void *cookie)
|
Line 379 CcpNgDataEvent(int type, void *cookie)
|
char *bundname, *rest; |
char *bundname, *rest; |
int id; |
int id; |
|
|
|
(void)cookie; |
|
(void)type; |
|
|
while (1) { |
while (1) { |
/* Protect from bundle shutdown and DoS */ |
/* Protect from bundle shutdown and DoS */ |
if (num > 100) |
if (num > 100) |
Line 397 CcpNgDataEvent(int type, void *cookie)
|
Line 403 CcpNgDataEvent(int type, void *cookie)
|
|
|
/* Debugging */ |
/* Debugging */ |
LogDumpBp(LG_FRAME, bp, |
LogDumpBp(LG_FRAME, bp, |
"CcpNgDataEvent: rec'd %d bytes frame on %s hook", MBLEN(bp), naddr.sg_data); | "CcpNgDataEvent: rec'd %zu bytes frame on %s hook", MBLEN(bp), naddr.sg_data); |
|
|
bundname = ((struct sockaddr_ng *)&naddr)->sg_data; |
bundname = ((struct sockaddr_ng *)&naddr)->sg_data; |
if (bundname[0] != 'c' && bundname[0] != 'd') { |
if (bundname[0] != 'c' && bundname[0] != 'd') { |
Line 439 CcpRecvMsg(Bund b, struct ng_mesg *msg, int len)
|
Line 445 CcpRecvMsg(Bund b, struct ng_mesg *msg, int len)
|
CcpState const ccp = &b->ccp; |
CcpState const ccp = &b->ccp; |
Fsm const fp = &ccp->fsm; |
Fsm const fp = &ccp->fsm; |
|
|
|
(void)len; |
|
|
switch (msg->header.typecookie) { |
switch (msg->header.typecookie) { |
#ifdef USE_NG_MPPC |
#ifdef USE_NG_MPPC |
case NGM_MPPC_COOKIE: |
case NGM_MPPC_COOKIE: |
Line 562 static void
|
Line 570 static void
|
CcpFailure(Fsm fp, enum fsmfail reason) |
CcpFailure(Fsm fp, enum fsmfail reason) |
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
|
|
|
(void)reason; |
CcpCheckEncryption(b); |
CcpCheckEncryption(b); |
} |
} |
|
|
Line 570 CcpFailure(Fsm fp, enum fsmfail reason)
|
Line 580 CcpFailure(Fsm fp, enum fsmfail reason)
|
*/ |
*/ |
|
|
int |
int |
CcpStat(Context ctx, int ac, char *av[], void *arg) | CcpStat(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
CcpState const ccp = &ctx->bund->ccp; |
CcpState const ccp = &ctx->bund->ccp; |
char buf[64]; |
char buf[64]; |
Line 746 CcpBuildConfigReq(Fsm fp, u_char *cp)
|
Line 756 CcpBuildConfigReq(Fsm fp, u_char *cp)
|
{ |
{ |
Bund b = (Bund)fp->arg; |
Bund b = (Bund)fp->arg; |
CcpState const ccp = &b->ccp; |
CcpState const ccp = &b->ccp; |
int type; | unsigned type; |
int ok; |
int ok; |
|
|
/* Put in all options that peer hasn't rejected in preferred order */ |
/* Put in all options that peer hasn't rejected in preferred order */ |
Line 1025 fail:
|
Line 1035 fail:
|
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); |
return(-1); |
return(-1); |
|
#else |
|
(void)b; |
#endif |
#endif |
return (0); |
return (0); |
} |
} |
Line 1034 fail:
|
Line 1046 fail:
|
*/ |
*/ |
|
|
static int |
static int |
CcpSetCommand(Context ctx, int ac, char *av[], void *arg) | CcpSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
CcpState const ccp = &ctx->bund->ccp; |
CcpState const ccp = &ctx->bund->ccp; |
|
|
Line 1078 CcpSetCommand(Context ctx, int ac, char *av[], void *a
|
Line 1090 CcpSetCommand(Context ctx, int ac, char *av[], void *a
|
static CompType |
static CompType |
CcpFindComp(int type, int *indexp) |
CcpFindComp(int type, int *indexp) |
{ |
{ |
int k; | unsigned k; |
|
|
for (k = 0; k < CCP_NUM_PROTOS; k++) { |
for (k = 0; k < CCP_NUM_PROTOS; k++) { |
if (gCompTypes[k]->type == type) { |
if (gCompTypes[k]->type == type) { |