[ovs-dev] [PATCH] netdev-native-tnl: strip padding bytes of inner L2.

305753229 at qq.com 305753229 at qq.com
Wed Jun 10 11:25:25 UTC 2020


From: zhangweilizhangweili <zhangweilizhangweili at didiglobal.com>

We need strip the inner L2 padding bytes, before enapcasulate a packet.

Signed-off-by: Martin Zhang <martinbj2008 at gmail.com>
Signed-off-by: Weili Zhang <305753229 at qq.com>
---
 lib/netdev-native-tnl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
index 0acc87953..945cca3d5 100644
--- a/lib/netdev-native-tnl.c
+++ b/lib/netdev-native-tnl.c
@@ -153,8 +153,11 @@ netdev_tnl_push_ip_header(struct dp_packet *packet,
     struct eth_header *eth;
     struct ip_header *ip;
     struct ovs_16aligned_ip6_hdr *ip6;
+    int padding = dp_packet_l2_pad_size(packet);
 
     eth = dp_packet_push_uninit(packet, size);
+    if (padding)
+        dp_packet_set_size(packet, dp_packet_size(packet) - padding);
     *ip_tot_size = dp_packet_size(packet) - sizeof (struct eth_header);
 
     memcpy(eth, header, size);
-- 
2.24.2 (Apple Git-127)



More information about the dev mailing list