bugfix: 从SF收到数据包后向其他SF转发时只封装一层g_vxlan
This commit is contained in:
@@ -41,7 +41,6 @@ yum install -y libMESA_prof_load-devel
|
|||||||
yum install -y libMESA_field_stat2-devel
|
yum install -y libMESA_field_stat2-devel
|
||||||
yum install -y librulescan-devel
|
yum install -y librulescan-devel
|
||||||
yum install -y sapp-devel # Maat_rule require MESA/stream.h
|
yum install -y sapp-devel # Maat_rule require MESA/stream.h
|
||||||
yum install -y libasan
|
|
||||||
yum install -y numactl-libs # required by mrzcpd
|
yum install -y numactl-libs # required by mrzcpd
|
||||||
yum install -y libibverbs # required by mrzcpd
|
yum install -y libibverbs # required by mrzcpd
|
||||||
|
|
||||||
|
|||||||
@@ -133,9 +133,11 @@ static enum raw_pkt_action handle_raw_packet(struct packet_io *handle, marsio_bu
|
|||||||
// return : INJT_PKT_HIT_FWD2NF
|
// 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);
|
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 + : send n bytes
|
||||||
// return -1 : error
|
// 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);
|
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 + : send n bytes
|
||||||
// return -1 : error
|
// 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);
|
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;
|
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);
|
nsend = forward_packet_to_sf(handle, rx_buff, &meta, node, thread_seq, ctx);
|
||||||
if (nsend > 0)
|
if (nsend > 0)
|
||||||
{
|
{
|
||||||
@@ -897,7 +902,11 @@ static enum inject_pkt_action handle_inject_packet(struct packet_io *handle, mar
|
|||||||
*action_bytes = raw_len;
|
*action_bytes = raw_len;
|
||||||
return INJT_PKT_ERR_DROP;
|
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);
|
nsend = forward_packet_to_sf(handle, rx_buff, &meta, node, thread_seq, ctx);
|
||||||
if (nsend > 0)
|
if (nsend > 0)
|
||||||
{
|
{
|
||||||
@@ -928,6 +937,9 @@ static enum inject_pkt_action handle_inject_packet(struct packet_io *handle, mar
|
|||||||
}
|
}
|
||||||
else
|
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);
|
int nsend = forward_packet_to_nf(handle, rx_buff, &meta, thread_seq, ctx);
|
||||||
if (nsend > 0)
|
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 + : send n bytes
|
||||||
// return -1 : error
|
// 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)
|
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 raw_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return 0 : success
|
// rx_buff : include g_vxlan header
|
||||||
|
// return + : send n bytes
|
||||||
// return -1 : error
|
// 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)
|
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 data
|
||||||
forward:
|
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);
|
int nsend = forward_packet_to_sf(handle, rx_buff, &meta, sf, thread_seq, ctx);
|
||||||
if (nsend > 0)
|
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));
|
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);
|
int nsend = forward_packet_to_nf(handle, rx_buff, &meta, thread_seq, ctx);
|
||||||
if (nsend > 0)
|
if (nsend > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1443,10 +1443,12 @@ void policy_enforce_select_chaining(struct selected_chaining *chaining, struct p
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item->sff_forward_type = sff_param->sff_forward_type;
|
item->sff_forward_type = sff_param->sff_forward_type;
|
||||||
|
LOG_DEBUG("%s: chaining policy %d -> sff_profile %d sf_profile_ids_num %d (before filter nearby and sctive)", LOG_TAG_POLICY, policy_id, item->sff_profile_id, sff_param->sf_profile_ids_num);
|
||||||
|
|
||||||
memset(&array, 0, sizeof(array));
|
memset(&array, 0, sizeof(array));
|
||||||
fixed_num_array_init(&array);
|
fixed_num_array_init(&array);
|
||||||
select_sf_by_nearby_and_active(enforcer, sff_param, &array);
|
select_sf_by_nearby_and_active(enforcer, sff_param, &array);
|
||||||
|
LOG_DEBUG("%s: chaining policy %d -> sff_profile %d sf_profile_ids_num %d (after filter nearby and sctive)", LOG_TAG_POLICY, policy_id, item->sff_profile_id, fixed_num_array_count_elem(&array));
|
||||||
if (fixed_num_array_count_elem(&array) == 0)
|
if (fixed_num_array_count_elem(&array) == 0)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("%s: chaining policy %d -> sff_profile %d, no sf available after filtering by 'nearby & active', bypass current sff !!!", LOG_TAG_POLICY, policy_id, item->sff_profile_id);
|
LOG_DEBUG("%s: chaining policy %d -> sff_profile %d, no sf available after filtering by 'nearby & active', bypass current sff !!!", LOG_TAG_POLICY, policy_id, item->sff_profile_id);
|
||||||
@@ -1459,6 +1461,7 @@ void policy_enforce_select_chaining(struct selected_chaining *chaining, struct p
|
|||||||
|
|
||||||
hash_value = raw_packet_parser_get_hash_value(parser, sff_param->sff_ldbc.method, dir_is_internal);
|
hash_value = raw_packet_parser_get_hash_value(parser, sff_param->sff_ldbc.method, dir_is_internal);
|
||||||
item->sf_action = select_sf_by_ldbc(hash_value, sff_param, &array, &(item->sf_profile_id), &(item->sf_action_reason));
|
item->sf_action = select_sf_by_ldbc(hash_value, sff_param, &array, &(item->sf_profile_id), &(item->sf_action_reason));
|
||||||
|
LOG_DEBUG("%s: chaining policy %d -> sff_profile %d sf_profile_ids_num %d (after filter ldbc)", LOG_TAG_POLICY, policy_id, item->sff_profile_id, fixed_num_array_count_elem(&array));
|
||||||
if (item->sf_action != SESSION_ACTION_FORWARD)
|
if (item->sf_action != SESSION_ACTION_FORWARD)
|
||||||
{
|
{
|
||||||
chaining->chaining_used++;
|
chaining->chaining_used++;
|
||||||
|
|||||||
Reference in New Issue
Block a user