Skip to content

Commit 3bb4314

Browse files
committed
Fix bug of kni while set vlan_strip=0.
1 parent a08b952 commit 3bb4314

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/ff_dpdk_if.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,14 @@ protocol_filter(const void *data, uint16_t len)
909909
const struct vlan_hdr *vlanhdr;
910910
hdr = (const struct ether_hdr *)data;
911911
uint16_t ether_type = rte_be_to_cpu_16(hdr->ether_type);
912+
data += ETHER_HDR_LEN;
913+
len -= ETHER_HDR_LEN;
912914

913915
if (ether_type == ETHER_TYPE_VLAN) {
914-
vlanhdr = (struct vlan_hdr *)(data + sizeof(struct ether_hdr));
916+
vlanhdr = (struct vlan_hdr *)data;
915917
ether_type = rte_be_to_cpu_16(vlanhdr->eth_proto);
918+
data += sizeof(struct vlan_hdr);
919+
len -= sizeof(struct vlan_hdr);
916920
}
917921

918922
if(ether_type == ETHER_TYPE_ARP)
@@ -928,8 +932,7 @@ protocol_filter(const void *data, uint16_t len)
928932
if(ether_type != ETHER_TYPE_IPv4)
929933
return FILTER_UNKNOWN;
930934

931-
return ff_kni_proto_filter(data + ETHER_HDR_LEN,
932-
len - ETHER_HDR_LEN);
935+
return ff_kni_proto_filter(data, len);
933936
#endif
934937
}
935938

0 commit comments

Comments
 (0)