mirror of https://github.com/F-Stack/f-stack.git
Use general protocol header length in protocol filter.
This commit is contained in:
parent
35a813994b
commit
f17ba62bb6
|
@ -878,7 +878,7 @@ ff_veth_input(const struct ff_dpdk_if_context *ctx, struct rte_mbuf *pkt)
|
||||||
static enum FilterReturn
|
static enum FilterReturn
|
||||||
protocol_filter(const void *data, uint16_t len)
|
protocol_filter(const void *data, uint16_t len)
|
||||||
{
|
{
|
||||||
if(len < sizeof(struct ether_hdr))
|
if(len < ETHER_HDR_LEN)
|
||||||
return FILTER_UNKNOWN;
|
return FILTER_UNKNOWN;
|
||||||
|
|
||||||
const struct ether_hdr *hdr;
|
const struct ether_hdr *hdr;
|
||||||
|
|
|
@ -258,6 +258,9 @@ protocol_filter_ip(const void *data, uint16_t len)
|
||||||
hdr = (const struct ipv4_hdr *)data;
|
hdr = (const struct ipv4_hdr *)data;
|
||||||
|
|
||||||
int hdr_len = (hdr->version_ihl & 0x0f) << 2;
|
int hdr_len = (hdr->version_ihl & 0x0f) << 2;
|
||||||
|
if (len < hdr_len)
|
||||||
|
return FILTER_UNKNOWN;
|
||||||
|
|
||||||
void *next = (void *)data + hdr_len;
|
void *next = (void *)data + hdr_len;
|
||||||
uint16_t next_len = len - hdr_len;
|
uint16_t next_len = len - hdr_len;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue