TCP packet parsing and manipulation helpers for eBPF programs.
TCP packet parsing and manipulation helpers for eBPF programs.
(get-payload-ptr payload-reg tcp-hdr-reg tcp-hlen-reg)Calculate pointer to TCP payload. Requires knowing TCP header length (data offset).
payload-reg: Register to store payload pointer tcp-hdr-reg: Register pointing to TCP header tcp-hlen-reg: Register containing TCP header length in bytes
Calculate pointer to TCP payload. Requires knowing TCP header length (data offset). payload-reg: Register to store payload pointer tcp-hdr-reg: Register pointing to TCP header tcp-hlen-reg: Register containing TCP header length in bytes
(is-ack flags-reg ack-label)Check if TCP ACK flag is set.
flags-reg: Register containing TCP flags ack-label: Label offset to jump to if ACK
Check if TCP ACK flag is set. flags-reg: Register containing TCP flags ack-label: Label offset to jump to if ACK
(is-dport dport-reg port match-label)Check if destination port matches (network byte order comparison).
dport-reg: Register containing destination port (network order) port: Port number (will be converted to network order) match-label: Label to jump to if ports match
Check if destination port matches (network byte order comparison). dport-reg: Register containing destination port (network order) port: Port number (will be converted to network order) match-label: Label to jump to if ports match
(is-fin flags-reg fin-label)Check if TCP FIN flag is set.
flags-reg: Register containing TCP flags fin-label: Label offset to jump to if FIN
Check if TCP FIN flag is set. flags-reg: Register containing TCP flags fin-label: Label offset to jump to if FIN
(is-psh flags-reg psh-label)Check if TCP PSH flag is set.
flags-reg: Register containing TCP flags psh-label: Label offset to jump to if PSH
Check if TCP PSH flag is set. flags-reg: Register containing TCP flags psh-label: Label offset to jump to if PSH
(is-rst flags-reg rst-label)Check if TCP RST flag is set.
flags-reg: Register containing TCP flags rst-label: Label offset to jump to if RST
Check if TCP RST flag is set. flags-reg: Register containing TCP flags rst-label: Label offset to jump to if RST
(is-sport sport-reg port match-label)Check if source port matches (network byte order comparison).
sport-reg: Register containing source port (network order) port: Port number (will be converted to network order) match-label: Label to jump to if ports match
Check if source port matches (network byte order comparison). sport-reg: Register containing source port (network order) port: Port number (will be converted to network order) match-label: Label to jump to if ports match
(is-syn flags-reg syn-label)Check if TCP SYN flag is set. Jumps to syn-label if SYN is set, falls through otherwise.
flags-reg: Register containing TCP flags syn-label: Label offset to jump to if SYN
Check if TCP SYN flag is set. Jumps to syn-label if SYN is set, falls through otherwise. flags-reg: Register containing TCP flags syn-label: Label offset to jump to if SYN
(is-syn-ack flags-reg scratch-reg syn-ack-label)Check if SYN and ACK flags are both set.
flags-reg: Register containing TCP flags scratch-reg: Scratch register syn-ack-label: Label offset to jump to if SYN+ACK
Check if SYN and ACK flags are both set. flags-reg: Register containing TCP flags scratch-reg: Scratch register syn-ack-label: Label offset to jump to if SYN+ACK
(is-syn-only flags-reg scratch-reg syn-only-label)Check if only SYN flag is set (connection initiation). Jumps to syn-only-label if SYN is set and ACK is not.
flags-reg: Register containing TCP flags scratch-reg: Scratch register syn-only-label: Label offset to jump to if SYN-only
Check if only SYN flag is set (connection initiation). Jumps to syn-only-label if SYN is set and ACK is not. flags-reg: Register containing TCP flags scratch-reg: Scratch register syn-only-label: Label offset to jump to if SYN-only
(load-ack-seq dst-reg tcp-hdr-reg)Load TCP acknowledgment number into dst-reg (network byte order).
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP acknowledgment number into dst-reg (network byte order). dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(load-data-offset dst-reg tcp-hdr-reg)Load TCP data offset (header length in 32-bit words) into dst-reg.
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP data offset (header length in 32-bit words) into dst-reg. dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(load-dport dst-reg tcp-hdr-reg)Load TCP destination port into dst-reg (network byte order).
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP destination port into dst-reg (network byte order). dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(load-field dst-reg tcp-hdr-reg field size)Load a TCP header field into dst-reg.
dst-reg: Destination register tcp-hdr-reg: Register pointing to start of TCP header field: Field keyword (:sport, :dport, :seq, etc.) size: :b (byte), :h (half-word), :w (word)
Load a TCP header field into dst-reg. dst-reg: Destination register tcp-hdr-reg: Register pointing to start of TCP header field: Field keyword (:sport, :dport, :seq, etc.) size: :b (byte), :h (half-word), :w (word)
(load-flags dst-reg tcp-hdr-reg)Load TCP flags byte into register.
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP flags byte into register. dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(load-header-len dst-reg tcp-hdr-reg)Load TCP header length in bytes into dst-reg.
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP header length in bytes into dst-reg. dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(load-ports sport-reg dport-reg tcp-hdr-reg)Load TCP source and destination ports. Ports are loaded in network byte order.
sport-reg: Register for source port dport-reg: Register for destination port tcp-hdr-reg: Register pointing to TCP header
Load TCP source and destination ports. Ports are loaded in network byte order. sport-reg: Register for source port dport-reg: Register for destination port tcp-hdr-reg: Register pointing to TCP header
(load-ports-host sport-reg dport-reg tcp-hdr-reg)Load TCP source and destination ports in host byte order.
sport-reg: Register for source port (host order) dport-reg: Register for destination port (host order) tcp-hdr-reg: Register pointing to TCP header
Load TCP source and destination ports in host byte order. sport-reg: Register for source port (host order) dport-reg: Register for destination port (host order) tcp-hdr-reg: Register pointing to TCP header
(load-seq dst-reg tcp-hdr-reg)Load TCP sequence number into dst-reg (network byte order).
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP sequence number into dst-reg (network byte order). dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(load-sport dst-reg tcp-hdr-reg)Load TCP source port into dst-reg (network byte order).
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP source port into dst-reg (network byte order). dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(load-window dst-reg tcp-hdr-reg)Load TCP window size into dst-reg (network byte order).
dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
Load TCP window size into dst-reg (network byte order). dst-reg: Destination register tcp-hdr-reg: Register pointing to TCP header
(parse-tcp-header tcp-hdr-reg
data-end-reg
sport-reg
dport-reg
fail-label
scratch-reg)Parse TCP header and check bounds. Returns instructions that:
tcp-hdr-reg: Register pointing to TCP header start data-end-reg: Register containing data_end pointer sport-reg: Register to store source port dport-reg: Register to store destination port fail-label: Label to jump to on bounds failure scratch-reg: Scratch register for bounds check
Parse TCP header and check bounds. Returns instructions that: 1. Check bounds for minimum TCP header (20 bytes) 2. Load source and destination ports tcp-hdr-reg: Register pointing to TCP header start data-end-reg: Register containing data_end pointer sport-reg: Register to store source port dport-reg: Register to store destination port fail-label: Label to jump to on bounds failure scratch-reg: Scratch register for bounds check
(store-dport tcp-hdr-reg port-reg)Store TCP destination port (expects network byte order).
tcp-hdr-reg: Register pointing to TCP header port-reg: Register containing port (network order)
Store TCP destination port (expects network byte order). tcp-hdr-reg: Register pointing to TCP header port-reg: Register containing port (network order)
(store-field tcp-hdr-reg field src-reg size)Store value to TCP header field.
tcp-hdr-reg: Register pointing to TCP header start field: Field keyword src-reg: Register containing value to store size: :b, :h, or :w
Store value to TCP header field. tcp-hdr-reg: Register pointing to TCP header start field: Field keyword src-reg: Register containing value to store size: :b, :h, or :w
(store-port-host tcp-hdr-reg field port-reg scratch-reg)Store TCP port from host byte order value.
tcp-hdr-reg: Register pointing to TCP header field: :sport or :dport port-reg: Register containing port (host order) scratch-reg: Scratch register for byte order conversion
Store TCP port from host byte order value. tcp-hdr-reg: Register pointing to TCP header field: :sport or :dport port-reg: Register containing port (host order) scratch-reg: Scratch register for byte order conversion
(store-sport tcp-hdr-reg port-reg)Store TCP source port (expects network byte order).
tcp-hdr-reg: Register pointing to TCP header port-reg: Register containing port (network order)
Store TCP source port (expects network byte order). tcp-hdr-reg: Register pointing to TCP header port-reg: Register containing port (network order)
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |