|
|
| version 1.1.1.2, 2016/11/01 09:56:12 | version 1.1.1.3, 2021/03/17 00:39:23 |
|---|---|
| Line 841 FsmRecvConfigRej(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 841 FsmRecvConfigRej(Fsm fp, FsmHeader lhp, Mbuf bp) |
| static void | static void |
| FsmRecvTermReq(Fsm fp, FsmHeader lhp, Mbuf bp) | FsmRecvTermReq(Fsm fp, FsmHeader lhp, Mbuf bp) |
| { | { |
| (void)lhp; | |
| if (fp->type->link_layer) { | if (fp->type->link_layer) { |
| RecordLinkUpDownReason(NULL, (Link)(fp->arg), 0, STR_PEER_DISC, NULL); | RecordLinkUpDownReason(NULL, (Link)(fp->arg), 0, STR_PEER_DISC, NULL); |
| } | } |
| Line 879 FsmRecvTermReq(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 880 FsmRecvTermReq(Fsm fp, FsmHeader lhp, Mbuf bp) |
| static void | static void |
| FsmRecvTermAck(Fsm fp, FsmHeader lhp, Mbuf bp) | FsmRecvTermAck(Fsm fp, FsmHeader lhp, Mbuf bp) |
| { | { |
| (void)lhp; | |
| switch (fp->state) { | switch (fp->state) { |
| case ST_CLOSING: | case ST_CLOSING: |
| FsmNewState(fp, ST_CLOSED); | FsmNewState(fp, ST_CLOSED); |
| Line 914 FsmRecvCodeRej(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 916 FsmRecvCodeRej(Fsm fp, FsmHeader lhp, Mbuf bp) |
| u_char code = 0; | u_char code = 0; |
| int fatal; | int fatal; |
| (void)lhp; | |
| /* Get code and log it */ | /* Get code and log it */ |
| bp = mbread(bp, &code, sizeof(code)); | bp = mbread(bp, &code, sizeof(code)); |
| Log(fp->log, ("[%s] %s: code %s was rejected", Pref(fp), Fsm(fp), FsmCodeName(code))); | Log(fp->log, ("[%s] %s: code %s was rejected", Pref(fp), Fsm(fp), FsmCodeName(code))); |
| Line 967 FsmRecvProtoRej(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 970 FsmRecvProtoRej(Fsm fp, FsmHeader lhp, Mbuf bp) |
| u_short proto = 0; | u_short proto = 0; |
| int fatal = FALSE; | int fatal = FALSE; |
| (void)lhp; | |
| bp = mbread(bp, &proto, sizeof(proto)); | bp = mbread(bp, &proto, sizeof(proto)); |
| proto = ntohs(proto); | proto = ntohs(proto); |
| Log(fp->log, ("[%s] %s: protocol %s was rejected", Pref(fp), Fsm(fp), ProtoName(proto))); | Log(fp->log, ("[%s] %s: protocol %s was rejected", Pref(fp), Fsm(fp), ProtoName(proto))); |
| Line 1213 FsmRecvEchoReq(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 1217 FsmRecvEchoReq(Fsm fp, FsmHeader lhp, Mbuf bp) |
| static void | static void |
| FsmRecvEchoRep(Fsm fp, FsmHeader lhp, Mbuf bp) | FsmRecvEchoRep(Fsm fp, FsmHeader lhp, Mbuf bp) |
| { | { |
| (void)lhp; | |
| bp = FsmCheckMagic(fp, bp); | bp = FsmCheckMagic(fp, bp); |
| mbfree(bp); | mbfree(bp); |
| } | } |
| Line 1224 FsmRecvEchoRep(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 1229 FsmRecvEchoRep(Fsm fp, FsmHeader lhp, Mbuf bp) |
| static void | static void |
| FsmRecvDiscReq(Fsm fp, FsmHeader lhp, Mbuf bp) | FsmRecvDiscReq(Fsm fp, FsmHeader lhp, Mbuf bp) |
| { | { |
| (void)lhp; | |
| bp = FsmCheckMagic(fp, bp); | bp = FsmCheckMagic(fp, bp); |
| if (fp->type->RecvDiscReq) | if (fp->type->RecvDiscReq) |
| (*fp->type->RecvDiscReq)(fp, bp); | (*fp->type->RecvDiscReq)(fp, bp); |
| Line 1237 FsmRecvDiscReq(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 1243 FsmRecvDiscReq(Fsm fp, FsmHeader lhp, Mbuf bp) |
| static void | static void |
| FsmRecvIdent(Fsm fp, FsmHeader lhp, Mbuf bp) | FsmRecvIdent(Fsm fp, FsmHeader lhp, Mbuf bp) |
| { | { |
| (void)lhp; | |
| bp = FsmCheckMagic(fp, bp); | bp = FsmCheckMagic(fp, bp); |
| if (bp) | if (bp) |
| ShowMesg(fp->log, Pref(fp), (char *) MBDATA(bp), MBLEN(bp)); | ShowMesg(fp->log, Pref(fp), (char *) MBDATA(bp), MBLEN(bp)); |
| Line 1252 FsmRecvIdent(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 1259 FsmRecvIdent(Fsm fp, FsmHeader lhp, Mbuf bp) |
| static void | static void |
| FsmRecvVendor(Fsm fp, FsmHeader lhp, Mbuf bp) | FsmRecvVendor(Fsm fp, FsmHeader lhp, Mbuf bp) |
| { | { |
| (void)lhp; | |
| bp = FsmCheckMagic(fp, bp); | bp = FsmCheckMagic(fp, bp); |
| if (fp->type->RecvVendor) | if (fp->type->RecvVendor) |
| (*fp->type->RecvVendor)(fp, bp); | (*fp->type->RecvVendor)(fp, bp); |
| Line 1265 FsmRecvVendor(Fsm fp, FsmHeader lhp, Mbuf bp) | Line 1273 FsmRecvVendor(Fsm fp, FsmHeader lhp, Mbuf bp) |
| static void | static void |
| FsmRecvTimeRemain(Fsm fp, FsmHeader lhp, Mbuf bp) | FsmRecvTimeRemain(Fsm fp, FsmHeader lhp, Mbuf bp) |
| { | { |
| (void)lhp; | |
| bp = FsmCheckMagic(fp, bp); | bp = FsmCheckMagic(fp, bp); |
| if (bp) { | if (bp) { |
| u_int32_t remain = 0; | u_int32_t remain = 0; |
| Line 1389 FsmEchoTimeout(void *arg) | Line 1398 FsmEchoTimeout(void *arg) |
| Fsm const fp = (Fsm) arg; | Fsm const fp = (Fsm) arg; |
| Bund b; | Bund b; |
| Link l; | Link l; |
| #ifndef NG_PPP_STATS64 | |
| struct ng_ppp_link_stat oldStats; | struct ng_ppp_link_stat oldStats; |
| #else | |
| struct ng_ppp_link_stat64 oldStats; | |
| #endif | |
| if (fp->type->link_layer) { | if (fp->type->link_layer) { |
| l = (Link)fp->arg; | l = (Link)fp->arg; |
| Line 1406 FsmEchoTimeout(void *arg) | Line 1419 FsmEchoTimeout(void *arg) |
| /* See if there was any traffic since last time */ | /* See if there was any traffic since last time */ |
| oldStats = fp->idleStats; | oldStats = fp->idleStats; |
| #ifndef NG_PPP_STATS64 | |
| NgFuncGetStats(b, l ? | NgFuncGetStats(b, l ? |
| l->bundleIndex : NG_PPP_BUNDLE_LINKNUM, &fp->idleStats); | l->bundleIndex : NG_PPP_BUNDLE_LINKNUM, &fp->idleStats); |
| #else | |
| NgFuncGetStats64(b, l ? | |
| l->bundleIndex : NG_PPP_BUNDLE_LINKNUM, &fp->idleStats); | |
| #endif | |
| if (fp->idleStats.recvFrames > oldStats.recvFrames) | if (fp->idleStats.recvFrames > oldStats.recvFrames) |
| fp->quietCount = 0; | fp->quietCount = 0; |
| else | else |
| Line 1446 FsmEchoTimeout(void *arg) | Line 1464 FsmEchoTimeout(void *arg) |
| void | void |
| FsmInput(Fsm fp, Mbuf bp) | FsmInput(Fsm fp, Mbuf bp) |
| { | { |
| int log, recd_len, length; | int log; |
| unsigned length, recd_len; | |
| struct fsmheader hdr; | struct fsmheader hdr; |
| /* Check for runt frames; discard them */ | /* Check for runt frames; discard them */ |
| if ((recd_len = MBLEN(bp)) < sizeof(hdr)) { | if ((recd_len = MBLEN(bp)) < sizeof(hdr)) { |
| Log(fp->log, ("[%s] %s: runt packet: %d bytes", Pref(fp), Fsm(fp), recd_len)); | Log(fp->log, ("[%s] %s: runt packet: %u bytes", Pref(fp), Fsm(fp), recd_len)); |
| mbfree(bp); | mbfree(bp); |
| return; | return; |
| } | } |
| Line 1462 FsmInput(Fsm fp, Mbuf bp) | Line 1481 FsmInput(Fsm fp, Mbuf bp) |
| /* Make sure length is sensible; discard otherwise */ | /* Make sure length is sensible; discard otherwise */ |
| if (length < sizeof(hdr) || length > recd_len) { | if (length < sizeof(hdr) || length > recd_len) { |
| Log(fp->log, ("[%s] %s: bad length: says %d, rec'd %d", | Log(fp->log, ("[%s] %s: bad length: says %u, rec'd %u", |
| Pref(fp), Fsm(fp), length, recd_len)); | Pref(fp), Fsm(fp), length, recd_len)); |
| mbfree(bp); | mbfree(bp); |
| return; | return; |
| Line 1505 FsmInput(Fsm fp, Mbuf bp) | Line 1524 FsmInput(Fsm fp, Mbuf bp) |
| u_char * | u_char * |
| FsmConfValue(u_char *cp, int type, int len, const void *data) | FsmConfValue(u_char *cp, int type, int len, const void *data) |
| { | { |
| u_char *bytes = (u_char *) data; | const u_char *bytes = (const u_char *) data; |
| u_int16_t sv; | u_int16_t sv; |
| u_int32_t lv; | u_int32_t lv; |
| Line 1513 FsmConfValue(u_char *cp, int type, int len, const void | Line 1532 FsmConfValue(u_char *cp, int type, int len, const void |
| switch (len) { | switch (len) { |
| case -2: | case -2: |
| len = 2; | len = 2; |
| sv = htons(*((u_int16_t *) data)); | sv = htons(*((const u_int16_t *) data)); |
| bytes = (u_char *) &sv; | bytes = (u_char *) &sv; |
| break; | break; |
| case -4: | case -4: |
| len = 4; | len = 4; |
| lv = htonl(*((u_int32_t *) data)); | lv = htonl(*((const u_int32_t *) data)); |
| bytes = (u_char *) &lv; | bytes = (u_char *) &lv; |
| break; | break; |
| default: | default: |
| Line 1647 FsmRej(Fsm fp, const struct fsmoption *opt) | Line 1666 FsmRej(Fsm fp, const struct fsmoption *opt) |
| const char * | const char * |
| FsmCodeName(int code) | FsmCodeName(int code) |
| { | { |
| if (code >= 0 && code < NUM_FSM_CODES) | if (code >= 0 && code < (int)NUM_FSM_CODES) |
| return (FsmCodes[code].name); | return (FsmCodes[code].name); |
| return ("UNKNOWN"); | return ("UNKNOWN"); |
| } | } |