Optimized code.

This commit is contained in:
Christian Deacon
2020-05-07 13:41:37 +00:00
parent c505d2b97d
commit c628afcbb8

View File

@@ -480,9 +480,12 @@ int xdp_prog_main(struct xdp_md *ctx)
if (matched && action == 0)
{
// Before dropping, update the blacklist map.
if (blocktime > 0)
{
uint64_t newTime = now + (blocktime * 1000000000);
bpf_map_update_elem(&ip_blacklist_map, &iph->saddr, &newTime, BPF_ANY);
}
return XDP_DROP;
}