summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsongyanchao <[email protected]>2022-09-15 13:00:36 +0000
committer宋延超 <[email protected]>2022-09-15 13:02:40 +0000
commit34ea49b483e3eae5fa6ba9c6a476fc26a94e590c (patch)
tree211d49c649facb74fc32a933fc489b13757e3420
parentb4143705f3726978d12dd6c1b400007d0810dcc8 (diff)
🐞 fix(TSG-11971): 修改VNI填充错误导致构造的报文注入到错误的方向v4.6.3-20220915
修改VNI填充错误导致构造的报文注入到错误的方向
-rw-r--r--service/src/node_etherfabric.c10
-rw-r--r--service/src/node_shmdev.c5
2 files changed, 11 insertions, 4 deletions
diff --git a/service/src/node_etherfabric.c b/service/src/node_etherfabric.c
index 7a95c2e..06af657 100644
--- a/service/src/node_etherfabric.c
+++ b/service/src/node_etherfabric.c
@@ -591,6 +591,7 @@ static __rte_always_inline uint16_t etherfabric_ingress_node_process(struct rte_
}
/* Fill Etherfabric Tag,And Save The Etherfabric Tag Ctrlzone,Current Not Support IPv6 */
+ private_ctrlzone->tag.etherfabric.dir = pkt_head_info_item._g_vxlan_hdr->dir;
private_ctrlzone->service_type = MR_NODE_COMMON_ETHERFABRIC_SERVICE;
pkt_parser_ptr->layer_offset += MR_ETHERFABRIC_LAYER_OFFSET_V4;
@@ -703,15 +704,16 @@ void fill_ipv4_pkt_for_constructed_packet(struct sc_main * sc, struct rte_mbuf *
ip_hdr->next_proto_id = IPPROTO_UDP;
ip_hdr->src_addr = etherfabric_service_item->listen_ip_v4;
ip_hdr->dst_addr = etherfabric_fwd_item->etherfabric_ip_v4;
- ip_hdr->total_length = ip_hdr_inner->total_length + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) +
- sizeof(struct g_vxlan_hdr) + sizeof(struct rte_ether_hdr);
+ ip_hdr->total_length =
+ htons(ntohs(ip_hdr_inner->total_length) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) +
+ sizeof(struct g_vxlan_hdr) + sizeof(struct rte_ether_hdr));
ip_hdr->hdr_checksum = rte_ipv4_cksum(ip_hdr);
/* Fill udp_hdr */
udp_hdr->src_port = 0xb512;
udp_hdr->dst_port = 0xb512;
- udp_hdr->dgram_len = ip_hdr_inner->total_length + sizeof(struct rte_udp_hdr) + sizeof(struct g_vxlan_hdr) +
- sizeof(struct rte_ether_hdr);
+ udp_hdr->dgram_len = htons(ntohs(ip_hdr_inner->total_length) + sizeof(struct rte_udp_hdr) +
+ sizeof(struct g_vxlan_hdr) + sizeof(struct rte_ether_hdr));
udp_hdr->dgram_cksum = 0;
/* Fill g_vxlan_hdr */
diff --git a/service/src/node_shmdev.c b/service/src/node_shmdev.c
index e287cd5..8f69e09 100644
--- a/service/src/node_shmdev.c
+++ b/service/src/node_shmdev.c
@@ -354,6 +354,11 @@ static __rte_always_inline uint16_t shmdev_rx_node_process(struct rte_graph * gr
(_default_si_table_item->vdev_enable == MR_VLAN_FLIPPING_ADAPTER_DEVICE_ENABLE))
{
uint16_t vlan_id = mbufs[i]->vlan_tci;
+ if ((vlan_id % 2) == 1)
+ vlan_id = vlan_id - 1;
+ else
+ vlan_id = vlan_id + 1;
+
vlan_flipping_adapter_decode(private_ctrlzone, vlan_id, _default_si_table_item);
mbufs[i]->ol_flags = 0;
mbufs[i]->vlan_tci = 0;