Mitigator BPF API
Functions and types programs can use to filter packets.
UdpHeader Struct Reference

UDP header. More...

#include <mitigator_bpf.h>

Detailed Description

UDP header.

Access this header after checking transport protocol:

if (packet_transport_proto(ctx) == IP_PROTO_UDP) {
struct UdpHeader* udp = packet_transport_header(ctx);
...
}
uint8_t packet_transport_proto(Context ctx)
Get packet transport protocol code, e.g. TCP, UDP, or ICMP.
void * packet_transport_header(Context ctx)
Get packet transport header, e.g. TCP header.
UDP header.
Definition: mitigator_bpf.h:354
Note
This function is for advanced users. Prefer packet_flow() to get ports. Prefer packet_transport_payload() to access payload and its length.
If you modify the fields of this header and return RESULT_PASS from the filter, call set_packet_mangled() to update checksums.
See also
https://en.wikipedia.org/wiki/User_Datagram_Protocol#UDP_datagram_structure
https://tools.ietf.org/html/rfc768

The documentation for this struct was generated from the following file: