mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
fixed one bug in icmp module.
This commit is contained in:
parent
7aad3b6f4a
commit
4b52fad552
@ -47,16 +47,18 @@ static void read_pkt(ICMP_HOST *host, ICMP_PKT *pkt_src)
|
||||
continue;
|
||||
if (chat->check_id && pkt.body.gid != chat->gid)
|
||||
{
|
||||
if (0)
|
||||
printf("seq%d,src%d,chat%d,gid%d,chat%d,\r\n",
|
||||
(int) pkt.hdr.seq, (int)pkt_src->hdr.seq,
|
||||
(int) chat->seq,
|
||||
(int) pkt.body.gid, (int) chat->gid);
|
||||
continue;
|
||||
}
|
||||
if (!(ptr = icmp_pkt_check(host, &pkt)))
|
||||
continue;
|
||||
//assert(ptr == pkt_src);
|
||||
break;
|
||||
ptr = icmp_pkt_check(host, &pkt);
|
||||
if (ptr != NULL) {
|
||||
assert(ptr == pkt_src);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gettimeofday(&end, NULL);
|
||||
@ -79,9 +81,8 @@ static void send_pkt(ICMP_HOST *host, ICMP_PKT *pkt)
|
||||
/* 指定当前包的目的主机 */
|
||||
chat->is->dest = host->dest;
|
||||
|
||||
chat->seq++;
|
||||
/* 组建发送数据包 */
|
||||
icmp_pkt_build(pkt, chat->seq);
|
||||
icmp_pkt_build(pkt, chat->seq++);
|
||||
|
||||
gettimeofday(&pkt->stamp, NULL);
|
||||
|
||||
|
@ -170,13 +170,13 @@ void icmp_pkt_save_status(ICMP_PKT* to, const ICMP_PKT* from)
|
||||
ICMP_PKT *icmp_pkt_check(const ICMP_HOST *host, const ICMP_PKT *pkt)
|
||||
{
|
||||
int seq = pkt->hdr.seq;
|
||||
if (seq < 0 || (size_t) seq > host->npkt) {
|
||||
if (seq < 0 || (size_t) seq >= host->npkt) {
|
||||
acl_msg_warn("invalid seq %d, discard!", seq);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (host->pkts[seq]->pkt_status.status == ICMP_STATUS_INIT)
|
||||
return (host->pkts[seq]);
|
||||
return host->pkts[seq];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user