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

TCP header. More...

#include <mitigator_bpf.h>

Detailed Description

TCP header.

Access this header after checking transport protocol:

if (packet_transport_proto(ctx) == IP_PROTO_TCP) {
struct TcpHeader* tcp = 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.
TCP header.
Definition: mitigator_bpf.h:381
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/Transmission_Control_Protocol#TCP_segment_structure
https://tools.ietf.org/html/rfc793

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