diff --git a/linux/vr_host_interface.c b/linux/vr_host_interface.c index 37b0795ea..3a023f1da 100644 --- a/linux/vr_host_interface.c +++ b/linux/vr_host_interface.c @@ -1010,6 +1010,7 @@ static int linux_pull_outer_headers(struct sk_buff *skb) { struct vlan_hdr *vhdr; + bool thdr = false, pull = false; uint16_t proto, offset, ip_proto = 0; struct iphdr *iph = NULL; struct ipv6hdr *ip6h = NULL; @@ -1038,8 +1039,9 @@ linux_pull_outer_headers(struct sk_buff *skb) if (!pskb_may_pull(skb, offset)) goto pull_fail; iph = ip_hdr(skb); - if (linux_ip_proto_pull(iph) && - vr_ip_transport_header_valid((struct vr_ip *)iph)) { + thdr = vr_ip_transport_header_valid((struct vr_ip *)iph); + pull = linux_ip_proto_pull(iph); + if (pull && thdr) { ip_proto = iph->protocol; } } else if (proto == htons(ETH_P_IPV6)) { @@ -1050,8 +1052,9 @@ linux_pull_outer_headers(struct sk_buff *skb) goto pull_fail; ip6h = ipv6_hdr(skb); - - if (linux_ipv6_proto_pull(ip6h)) { + thdr = true; + pull = linux_ipv6_proto_pull(ip6h); + if (pull) { ip_proto = ip6h->nexthdr; } } else if (proto == htons(ETH_P_ARP)) { @@ -1060,7 +1063,7 @@ linux_pull_outer_headers(struct sk_buff *skb) goto pull_fail; } - if (iph || ip6h) { + if (thdr && pull && (iph || ip6h)) { /* * this covers both regular port number offsets that come in * the first 4 bytes and the icmp header