Changeset 263
- Timestamp:
- 04/14/11 21:04:16 (13 months ago)
- Files:
-
- 1 modified
-
ap51-flash-ng/proto.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ap51-flash-ng/proto.c
r262 r263 551 551 { 552 552 struct tcphdr *tcphdr; 553 unsigned int data_len; 553 554 char *buff; 554 555 … … 567 568 if (tcphdr->ack != 1) 568 569 goto out; 570 571 data_len = packet_buff_len - (tcphdr->doff * 4); 569 572 570 573 switch (node->tcp_state.status) { … … 585 588 buff = (char *)(tcphdr + 1); 586 589 node->tcp_state.status = TCP_STATUS_TELNET_READY; 587 node->tcp_state.my_ack_seq += packet_buff_len - (int)sizeof(struct tcphdr);590 node->tcp_state.my_ack_seq += data_len; 588 591 589 592 /* send CTRL + C */ … … 599 602 if ((tcphdr->seq == node->tcp_state.his_seq) && 600 603 (tcphdr->ack_seq == node->tcp_state.his_ack_seq) && 601 ( strlen((char *)(tcphdr + 1))== node->tcp_state.his_last_len)) {604 (data_len == node->tcp_state.his_last_len)) { 602 605 /* printf("retransmission received: seq = %u, ack_seq: %u, len: %u\n", 603 ntohl(tcphdr->seq), ntohl(tcphdr->ack_seq), 604 (unsigned int)strlen((char *)(tcphdr + 1))); */ 606 ntohl(tcphdr->seq), ntohl(tcphdr->ack_seq), data_len); */ 605 607 tcp_resend_data(node); 606 608 goto out; … … 609 611 node->tcp_state.his_seq = tcphdr->seq; 610 612 node->tcp_state.his_ack_seq = tcphdr->ack_seq; 611 node->tcp_state.his_last_len = strlen((char *)(tcphdr + 1));613 node->tcp_state.his_last_len = data_len; 612 614 613 615 if (node->tcp_state.his_last_len == 0) { … … 617 619 } 618 620 619 node->tcp_state.my_ack_seq += packet_buff_len - (int)sizeof(struct tcphdr);621 node->tcp_state.my_ack_seq += data_len; 620 622 if (ntohl(tcphdr->ack_seq) > node->tcp_state.my_seq) 621 623 node->tcp_state.my_seq = ntohl(tcphdr->ack_seq); … … 634 636 { 635 637 struct iphdr *iphdr; 638 int length; 636 639 637 640 if (!len_check(packet_buff_len, sizeof(struct iphdr), "IPv4")) … … 671 674 break; 672 675 676 length = packet_buff_len; 677 if (length > ntohs(iphdr->tot_len)) 678 length = ntohs(iphdr->tot_len); 679 673 680 handle_tcp_packet(packet_buff + (iphdr->ihl * 4), 674 packet_buff_len - (iphdr->ihl * 4), 675 node); 681 length - (iphdr->ihl * 4), node); 676 682 break; 677 683 } … … 709 715 if (!node) 710 716 return; 717 711 718 handle_ip_packet(packet_buff + ETH_HLEN, 712 719 packet_buff_len - ETH_HLEN,
