Mitigator BPF API
Functions and types programs can use to filter packets.
Data Fields
Flow Struct Reference

Packet flow information. More...

#include <mitigator_bpf.h>

Data Fields

union NetAddr src_ip
 
union NetAddr dst_ip
 
uint16_t src_port
 
uint16_t dst_port
 
uint32_t padding
 

Detailed Description

Packet flow information.

All fields are in network byte order, that is, port numbers must be swapped to check against values. For example, test if port is 1234 as follows:

struct Flow flow;
packet_flow(ctx, &flow);
if (flow.dst_port == bswap16(1234)) { ... }
LOCAL uint16_t bswap16(uint16_t value)
Change byte order of a 16-bit value.
Definition: mitigator_bpf.h:896
void packet_flow(Context ctx, struct Flow *info)
Get packet flow information, including source and destination.
Packet flow information.
Definition: mitigator_bpf.h:446

Field Documentation

◆ dst_ip

union NetAddr Flow::dst_ip

Destination address.

◆ dst_port

uint16_t Flow::dst_port

Destination port.

◆ padding

uint32_t Flow::padding

Not used and zero-filled by API.

◆ src_ip

union NetAddr Flow::src_ip

Source address.

◆ src_port

uint16_t Flow::src_port

Source port.


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