On Mon, Jul 1, 2024 at 6:25 AM junwang01--- via discuss <ovs-discuss@openvswitch.org> wrote: > > Hi,team. > Some switches add padding bytes to packets smaller than 64 bytes that are > sent from outside. > However, in our netdev_tnl_push_ip_header processing, we directly set > l2_pad_size to 0. > I believe that l2_pad_size should be reassigned with the value it originally > carried. > After making this modification, the L4 checksum for my inner packets became > correct. > > https://github.com/openvswitch/ovs/blob/main/lib/netdev-native-tnl.c#L166 > > Currently, I can resolve the issue with the following modification, but I am > unsure if this > approach is the most correct, or if there are other places that also need the > same modification. > > diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c > index dd598ce31..1084dbe91 100644 > --- a/lib/netdev-native-tnl.c > +++ b/lib/netdev-native-tnl.c > @@ -163,7 +163,9 @@ netdev_tnl_push_ip_header(struct dp_packet *packet, > memcpy(eth, header, size); > /* The encapsulated packet has type Ethernet. Adjust dp_packet. */ > packet->packet_type = htonl(PT_ETH); > + uint16_t l2_pad_size = packet->l2_pad_size; > dp_packet_reset_offsets(packet); > + packet->l2_pad_size = l2_pad_size; > packet->l3_ofs = sizeof (struct eth_header);
I don't think we need to carry this padding over a tunnel. I did not test but I wonder if adjusting ip_tot_size is better. Something like: @@ -158,7 +158,8 @@ netdev_tnl_push_ip_header(struct dp_packet *packet, const void *header, struct ovs_16aligned_ip6_hdr *ip6; eth = dp_packet_push_uninit(packet, size); - *ip_tot_size = dp_packet_size(packet) - sizeof (struct eth_header); + *ip_tot_size = dp_packet_size(packet) - dp_packet_l2_pad_size(packet) + - sizeof (struct eth_header); memcpy(eth, header, size); /* The encapsulated packet has type Ethernet. Adjust dp_packet. */ -- David Marchand _______________________________________________ discuss mailing list disc...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-discuss