Updated XDP program (not payload matching support).
This commit is contained in:
@@ -212,19 +212,20 @@ int xdp_prog_main(struct xdp_md *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Payload match.
|
// Payload match.
|
||||||
|
/*
|
||||||
if (filter[i]->payloadLen > 0)
|
if (filter[i]->payloadLen > 0)
|
||||||
{
|
{
|
||||||
|
uint8_t found = 1;
|
||||||
|
uint16_t len = filter[i]->payloadLen;
|
||||||
|
|
||||||
// Initialize packet data.
|
// Initialize packet data.
|
||||||
uint8_t *pcktData = (data + sizeof(struct ethhdr) + (iph->ihl * 4) + l4headerLen);
|
uint8_t *pcktData = (data + sizeof(struct ethhdr) + (iph->ihl * 4) + l4headerLen);
|
||||||
|
|
||||||
// Now check packet data and ensure we have enough to match.
|
if (pcktData + len > (uint8_t *)data_end)
|
||||||
if (pcktData + (filter[i]->payloadLen) > (uint8_t *)data_end)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t found = 1;
|
|
||||||
|
|
||||||
for (uint16_t j = 0; j < filter[i]->payloadLen; j++)
|
for (uint16_t j = 0; j < filter[i]->payloadLen; j++)
|
||||||
{
|
{
|
||||||
if ((*pcktData++) == filter[i]->payloadMatch[j])
|
if ((*pcktData++) == filter[i]->payloadMatch[j])
|
||||||
@@ -242,6 +243,7 @@ int xdp_prog_main(struct xdp_md *ctx)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Check layer 4 filters.
|
// Check layer 4 filters.
|
||||||
if (iph->protocol == IPPROTO_TCP && !filter[i]->tcpopts.enabled)
|
if (iph->protocol == IPPROTO_TCP && !filter[i]->tcpopts.enabled)
|
||||||
|
|||||||
Reference in New Issue
Block a user