inject TCP RST test pass
This commit is contained in:
@@ -170,7 +170,7 @@ int marsio_io_ingress(struct marsio_io *handle, uint16_t thr_idx, struct packet
|
||||
pkt = &pkts[nr_parsed];
|
||||
memset(pkt, 0, sizeof(struct packet));
|
||||
packet_parse(pkt, data, len);
|
||||
packet_set_io_ctx(pkt, mbuff);
|
||||
packet_set_origin_ctx(pkt, mbuff);
|
||||
packet_set_origin(pkt, PACKET_ORIGIN_MARSIO);
|
||||
nr_parsed++;
|
||||
|
||||
@@ -205,7 +205,7 @@ void marsio_io_egress(struct marsio_io *handle, uint16_t thr_idx, struct packet
|
||||
stat->dev_tx_pkts++;
|
||||
stat->dev_tx_bytes += len;
|
||||
|
||||
mbuff = (marsio_buff_t *)packet_get_io_ctx(pkt);
|
||||
mbuff = (marsio_buff_t *)packet_get_origin_ctx(pkt);
|
||||
assert(mbuff != NULL);
|
||||
|
||||
if (marsio_buff_is_ctrlbuf(mbuff))
|
||||
@@ -233,7 +233,7 @@ void marsio_io_drop(struct marsio_io *handle, uint16_t thr_idx, struct packet *p
|
||||
for (int i = 0; i < nr_pkts; i++)
|
||||
{
|
||||
pkt = &pkts[i];
|
||||
mbuff = (marsio_buff_t *)packet_get_io_ctx(pkt);
|
||||
mbuff = (marsio_buff_t *)packet_get_origin_ctx(pkt);
|
||||
if (mbuff)
|
||||
{
|
||||
stat->drop_pkts++;
|
||||
@@ -252,6 +252,7 @@ int marsio_io_inject(struct marsio_io *handle, uint16_t thr_idx, struct packet *
|
||||
struct packet *pkt;
|
||||
marsio_buff_t *mbuff;
|
||||
struct io_stat *stat = &handle->stat[thr_idx];
|
||||
struct inject_packet_meta *meta;
|
||||
|
||||
for (int i = 0; i < nr_pkts; i++)
|
||||
{
|
||||
@@ -277,7 +278,31 @@ int marsio_io_inject(struct marsio_io *handle, uint16_t thr_idx, struct packet *
|
||||
|
||||
ptr = marsio_buff_append(mbuff, len);
|
||||
memcpy(ptr, packet_get_data(pkt), len);
|
||||
marsio_send_burst(handle->mr_path, thr_idx, &mbuff, 1);
|
||||
meta = (struct inject_packet_meta *)packet_get_origin_ctx(pkt);
|
||||
if (meta)
|
||||
{
|
||||
if (meta->route.used && marsio_buff_set_metadata(mbuff, MR_BUFF_ROUTE_CTX, meta->route.data, meta->route.used) != 0)
|
||||
{
|
||||
PACKET_IO_LOG_ERROR("unable to set route context for inject packet");
|
||||
}
|
||||
if (meta->sids.used && marsio_buff_set_sid_list(mbuff, meta->sids.sid, meta->sids.used) != 0)
|
||||
{
|
||||
PACKET_IO_LOG_ERROR("unable to set sid list for inject packet");
|
||||
}
|
||||
if (meta->session_id && marsio_buff_set_metadata(mbuff, MR_BUFF_SESSION_ID, &meta->session_id, sizeof(meta->session_id)) != 0)
|
||||
{
|
||||
PACKET_IO_LOG_ERROR("unable to set session id for inject packet");
|
||||
}
|
||||
if (meta->link_id)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
if (meta->is_ctrl)
|
||||
{
|
||||
marsio_buff_set_ctrlbuf(mbuff);
|
||||
}
|
||||
}
|
||||
marsio_send_burst_with_options(handle->mr_path, thr_idx, &mbuff, 1, MARSIO_SEND_OPT_REHASH);
|
||||
packet_free(pkt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user