bugfix: 从SF收到数据包后向其他SF转发时只封装一层g_vxlan

This commit is contained in:
luwenpeng
2023-02-22 19:55:05 +08:00
parent 823490bcd1
commit ecb9241ce9
3 changed files with 24 additions and 3 deletions

View File

@@ -133,9 +133,11 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
// return : INJT_PKT_HIT_FWD2NF
static enum inject_pkt_action handle_inject_packet(struct packet_io *handle, marsio_buff_t *rx_buff, int thread_seq, void *ctx, int *action_bytes);
// rx_buff : not include g_vxlan header
// return + : send n bytes
// return -1 : error
static int forward_packet_to_sf(struct packet_io *handle, marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, int thread_seq, void *ctx);
// rx_buff : include g_vxlan header
// return + : send n bytes
// return -1 : error
static int forward_packet_to_nf(struct packet_io *handle, marsio_buff_t *rx_buff, struct metadata *meta, int thread_seq, void *ct);
@@ -765,6 +767,9 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
return RAW_PKT_ERR_BYPASS;
}
// rx_buff : not include g_vxlan header
// return + : send n bytes
// return -1 : error
nsend = forward_packet_to_sf(handle, rx_buff, &meta, node, thread_seq, ctx);
if (nsend > 0)
{
@@ -897,7 +902,11 @@ static enum inject_pkt_action handle_inject_packet(struct packet_io *handle, mar
*action_bytes = raw_len;
return INJT_PKT_ERR_DROP;
}
marsio_buff_adj(rx_buff, raw_len - meta.raw_len);
// rx_buff : not include g_vxlan header
// return + : send n bytes
// return -1 : error
nsend = forward_packet_to_sf(handle, rx_buff, &meta, node, thread_seq, ctx);
if (nsend > 0)
{
@@ -928,6 +937,9 @@ static enum inject_pkt_action handle_inject_packet(struct packet_io *handle, mar
}
else
{
// rx_buff : include g_vxlan header
// return + : send n bytes
// return -1 : error
int nsend = forward_packet_to_nf(handle, rx_buff, &meta, thread_seq, ctx);
if (nsend > 0)
{
@@ -944,6 +956,7 @@ static enum inject_pkt_action handle_inject_packet(struct packet_io *handle, mar
}
}
// rx_buff : not include g_vxlan header
// return + : send n bytes
// return -1 : error
static int forward_packet_to_sf(struct packet_io *handle, marsio_buff_t *rx_buff, struct metadata *meta, struct selected_sf *sf, int thread_seq, void *ctx)
@@ -976,7 +989,8 @@ static int forward_packet_to_sf(struct packet_io *handle, marsio_buff_t *rx_buff
return raw_len;
}
// return 0 : success
// rx_buff : include g_vxlan header
// return + : send n bytes
// return -1 : error
static int forward_packet_to_nf(struct packet_io *handle, marsio_buff_t *rx_buff, struct metadata *meta, int thread_seq, void *ct)
{
@@ -1066,6 +1080,9 @@ static int forward_all_nf_packet_to_sf(struct packet_io *handle, marsio_buff_t *
// forward data
forward:
// rx_buff : not include g_vxlan header
// return + : send n bytes
// return -1 : error
int nsend = forward_packet_to_sf(handle, rx_buff, &meta, sf, thread_seq, ctx);
if (nsend > 0)
{
@@ -1138,7 +1155,9 @@ static int forward_all_sf_packet_to_nf(struct packet_io *handle, marsio_buff_t *
memcpy(meta.route_ctx, s_ctx->raw_pkt_i2e_route_ctx, sizeof(s_ctx->raw_pkt_i2e_route_ctx));
}
// sendto nf
// rx_buff : include g_vxlan header
// return + : send n bytes
// return -1 : error
int nsend = forward_packet_to_nf(handle, rx_buff, &meta, thread_seq, ctx);
if (nsend > 0)
{