forked from Mirrors/sngrep
capture: use IP header payload length for reassembly #142
This commit is contained in:
parent
f02a242f67
commit
2214d279e2
|
@ -482,7 +482,7 @@ capture_packet_reasm_ip(capture_info_t *capinfo, const struct pcap_pkthdr *heade
|
||||||
it = vector_iterator(pkt->frames);
|
it = vector_iterator(pkt->frames);
|
||||||
while ((frame = vector_iterator_next(&it))) {
|
while ((frame = vector_iterator_next(&it))) {
|
||||||
struct ip *frame_ip = (struct ip *) (frame->data + link_hl);
|
struct ip *frame_ip = (struct ip *) (frame->data + link_hl);
|
||||||
len_data += frame->header->caplen - link_hl - frame_ip->ip_hl * 4;
|
len_data += ntohs(frame_ip->ip_len) - frame_ip->ip_hl * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check packet content length
|
// Check packet content length
|
||||||
|
@ -498,7 +498,7 @@ capture_packet_reasm_ip(capture_info_t *capinfo, const struct pcap_pkthdr *heade
|
||||||
struct ip *frame_ip = (struct ip *) (frame->data + link_hl);
|
struct ip *frame_ip = (struct ip *) (frame->data + link_hl);
|
||||||
memcpy(packet + link_hl + ip_hl + (ntohs(frame_ip->ip_off) & IP_OFFMASK) * 8,
|
memcpy(packet + link_hl + ip_hl + (ntohs(frame_ip->ip_off) & IP_OFFMASK) * 8,
|
||||||
frame->data + link_hl + frame_ip->ip_hl * 4,
|
frame->data + link_hl + frame_ip->ip_hl * 4,
|
||||||
frame->header->caplen - link_hl - frame_ip->ip_hl * 4);
|
ntohs(frame_ip->ip_len) - frame_ip->ip_hl * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
*caplen = link_hl + ip_hl + len_data;
|
*caplen = link_hl + ip_hl + len_data;
|
||||||
|
|
Loading…
Reference in New Issue