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

uint32_t saddr
 
uint32_t daddr
 
uint16_t sport
 
uint16_t dport
 
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.dport == bswap16(1234)) { ... }

Field Documentation

◆ daddr

uint32_t Flow::daddr

Destination IPv4 address.

◆ dport

uint16_t Flow::dport

Destination port.

◆ padding

uint32_t Flow::padding

Not used and zero-filled by API.

◆ saddr

uint32_t Flow::saddr

Source IPv4 address.

◆ sport

uint16_t Flow::sport

Source port.


The documentation for this struct was generated from the following file:
bswap16
LOCAL uint16_t bswap16(uint16_t value)
Change byte order of a 16-bit value.
Definition: mitigator_bpf.h:714
packet_flow
void packet_flow(Context ctx, struct Flow *info)
Get packet flow information, including source and destination.
Flow
Packet flow information.
Definition: mitigator_bpf.h:352