bugfix: build packet also copy metadata from original packet
This commit is contained in:
@@ -529,19 +529,18 @@ static struct packet *ip_reassembly_defrag_fq(struct ip_reassembly *ip_reass, st
|
||||
// create a new packet
|
||||
packet_parse(pkt, ptr, total_len);
|
||||
packet_set_defraged(pkt);
|
||||
memcpy(&pkt->meta, &first->pkt->meta, sizeof(struct metadata));
|
||||
|
||||
frag = &fq->frags[IP_FIRST_FRAG_IDX];
|
||||
packet_push_frag(pkt, frag->pkt);
|
||||
frag->pkt = NULL;
|
||||
packet_push_frag(pkt, first->pkt);
|
||||
first->pkt = NULL;
|
||||
for (uint32_t i = IP_MIN_FRAG_NUM; i < fq->next_fill; i++)
|
||||
{
|
||||
frag = &fq->frags[i];
|
||||
packet_push_frag(pkt, frag->pkt);
|
||||
frag->pkt = NULL;
|
||||
}
|
||||
frag = &fq->frags[IP_LAST_FRAG_IDX];
|
||||
packet_push_frag(pkt, frag->pkt);
|
||||
frag->pkt = NULL;
|
||||
packet_push_frag(pkt, last->pkt);
|
||||
last->pkt = NULL;
|
||||
|
||||
STAT_INC(&ip_reass->stat, defrags_succeed, &fq->key)
|
||||
ip_reassembly_del_fq(ip_reass, fq);
|
||||
|
||||
@@ -303,6 +303,7 @@ struct packet *packet_build_tcp(const struct packet *origin_pkt, uint32_t tcp_se
|
||||
.args = NULL,
|
||||
.thr_idx = -1,
|
||||
};
|
||||
memcpy(&new_pkt->meta, &origin_pkt->meta, sizeof(struct metadata));
|
||||
packet_set_origin(new_pkt, &origin);
|
||||
|
||||
return new_pkt;
|
||||
@@ -352,6 +353,7 @@ struct packet *packet_build_udp(const struct packet *origin_pkt, const char *udp
|
||||
.args = NULL,
|
||||
.thr_idx = -1,
|
||||
};
|
||||
memcpy(&new_pkt->meta, &origin_pkt->meta, sizeof(struct metadata));
|
||||
packet_set_origin(new_pkt, &origin);
|
||||
|
||||
return new_pkt;
|
||||
@@ -428,6 +430,7 @@ struct packet *packet_build_l3(const struct packet *origin_pkt, uint8_t ip_proto
|
||||
.args = NULL,
|
||||
.thr_idx = -1,
|
||||
};
|
||||
memcpy(&new_pkt->meta, &origin_pkt->meta, sizeof(struct metadata));
|
||||
packet_set_origin(new_pkt, &origin);
|
||||
|
||||
return new_pkt;
|
||||
|
||||
Reference in New Issue
Block a user