diff options
| author | luwenpeng <[email protected]> | 2024-11-13 14:43:38 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2024-11-13 14:43:38 +0800 |
| commit | 492a7fb8ead4d9a3f36a2e773041eb285dc34a95 (patch) | |
| tree | 1aab9bbfcc69ae5a0fc18a3f2afd61da172cbe35 /infra/packet_io | |
| parent | 8349a631e1a2542e3e7075b9c8f00e7d57337888 (diff) | |
add packet type raw and pseudo
Diffstat (limited to 'infra/packet_io')
| -rw-r--r-- | infra/packet_io/mars_io.c | 11 | ||||
| -rw-r--r-- | infra/packet_io/pcap_io.c | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/infra/packet_io/mars_io.c b/infra/packet_io/mars_io.c index 0dcec91..19fd450 100644 --- a/infra/packet_io/mars_io.c +++ b/infra/packet_io/mars_io.c @@ -147,7 +147,14 @@ static void copy_metadata_to_packet(marsio_buff_t *mbuff, struct packet *pkt) PACKET_IO_LOG_ERROR("failed to get link id"); } - packet_set_ctrl(pkt, marsio_buff_is_ctrlbuf(mbuff)); + if (marsio_buff_is_ctrlbuf(mbuff)) + { + packet_set_type(pkt, PACKET_TYPE_PSEUDO); + } + else + { + packet_set_type(pkt, PACKET_TYPE_RAW); + } enum packet_direction direction = PACKET_DIRECTION_OUTGOING; if (marsio_buff_get_metadata(mbuff, MR_BUFF_DIR, &direction, sizeof(direction)) == sizeof(direction)) @@ -201,7 +208,7 @@ static void copy_metadata_to_mbuff(struct packet *pkt, marsio_buff_t *mbuff) PACKET_IO_LOG_ERROR("failed to set link id"); } - if (packet_is_ctrl(pkt)) + if (packet_get_type(pkt) == PACKET_TYPE_PSEUDO) { marsio_buff_set_ctrlbuf(mbuff); } diff --git a/infra/packet_io/pcap_io.c b/infra/packet_io/pcap_io.c index 8d7090f..555b59a 100644 --- a/infra/packet_io/pcap_io.c +++ b/infra/packet_io/pcap_io.c @@ -488,6 +488,7 @@ int pcap_io_recv(void *handle, uint16_t thr_idx, struct packet *pkts[], int nr_p packet_parse(pkt, pcap->data, pcap->len); memset(&pkt->meta, 0, sizeof(pkt->meta)); packet_set_action(pkt, PACKET_ACTION_FORWARD); + packet_set_type(pkt, PACKET_TYPE_RAW); packet_set_timeval(pkt, &pcap->ts); packet_set_origin(pkt, &origin); |
