[ovs-dev] [PATCH 1/1] flow: Fix parsing l3_ofs with partial offloading

Eli Britstein elibr at mellanox.com
Tue Jan 14 13:21:15 UTC 2020


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: aab96ec4d81e ("dpif-netdev: retrieve flow directly from the flow mark")
Signed-off-by: Eli Britstein <elibr at mellanox.com>
Reviewed-by: Roi Dayan <roid at mellanox.com>
---
 lib/flow.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/flow.c b/lib/flow.c
index 45bb96b54..5c32b4a01 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -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. */
-- 
2.14.5



More information about the dev mailing list