2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

flow: Fix parsing l3_ofs with partial offloading

l3_ofs should be set all Ethernet packets, not just IPv4/IPv6 ones.
For example for ARP over VLAN tagged packets, it may cause wrong
processing like in changing the VLAN ID action. Fix it.

Fixes: aab96ec4d8 ("dpif-netdev: retrieve flow directly from the flow mark")
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Eli Britstein
2020-01-14 13:21:15 +00:00
committed by Ben Pfaff
parent cb20837919
commit eb540c0f5f

View File

@@ -1107,6 +1107,7 @@ parse_tcp_flags(struct dp_packet *packet)
if (OVS_UNLIKELY(eth_type_mpls(dl_type))) {
packet->l2_5_ofs = (char *)data - frame;
}
packet->l3_ofs = (char *)data - frame;
if (OVS_LIKELY(dl_type == htons(ETH_TYPE_IP))) {
const struct ip_header *nh = data;
int ip_len;
@@ -1116,7 +1117,6 @@ parse_tcp_flags(struct dp_packet *packet)
return 0;
}
dp_packet_set_l2_pad_size(packet, size - tot_len);
packet->l3_ofs = (uint16_t)((char *)nh - frame);
nw_proto = nh->ip_proto;
nw_frag = ipv4_get_nw_frag(nh);
@@ -1129,7 +1129,6 @@ parse_tcp_flags(struct dp_packet *packet)
if (OVS_UNLIKELY(!ipv6_sanity_check(nh, size))) {
return 0;
}
packet->l3_ofs = (uint16_t)((char *)nh - frame);
data_pull(&data, &size, sizeof *nh);
plen = ntohs(nh->ip6_plen); /* Never pull padding. */