Liking cljdoc? Tell your friends :D

clj-ebpf.net.ipv4

IPv4 packet parsing and manipulation helpers for eBPF programs.

IPv4 packet parsing and manipulation helpers for eBPF programs.
raw docstring

decrement-ttlclj

(decrement-ttl ip-hdr-reg ttl-reg drop-label)

Decrement TTL by 1 and check for zero. Jumps to drop-label if TTL reaches 0.

ip-hdr-reg: Register pointing to IP header ttl-reg: Register to use for TTL (will be modified) drop-label: Label to jump to if TTL is 0

Decrement TTL by 1 and check for zero.
Jumps to drop-label if TTL reaches 0.

ip-hdr-reg: Register pointing to IP header
ttl-reg: Register to use for TTL (will be modified)
drop-label: Label to jump to if TTL is 0
sourceraw docstring

get-l4-ptr-dynamicclj

(get-l4-ptr-dynamic l4-ptr-reg ip-hdr-reg ihl-reg)

Calculate L4 header pointer using IHL field (handles IP options).

l4-ptr-reg: Register to store L4 header pointer ip-hdr-reg: Register pointing to IP header ihl-reg: Register to store IHL (will be modified)

Calculate L4 header pointer using IHL field (handles IP options).

l4-ptr-reg: Register to store L4 header pointer
ip-hdr-reg: Register pointing to IP header
ihl-reg: Register to store IHL (will be modified)
sourceraw docstring

get-l4-ptr-fixedclj

(get-l4-ptr-fixed l4-ptr-reg ip-hdr-reg)

Calculate L4 header pointer assuming fixed 20-byte IP header (no options).

l4-ptr-reg: Register to store L4 header pointer ip-hdr-reg: Register pointing to IP header

Calculate L4 header pointer assuming fixed 20-byte IP header (no options).

l4-ptr-reg: Register to store L4 header pointer
ip-hdr-reg: Register pointing to IP header
sourceraw docstring

is-icmpclj

(is-icmp proto-reg icmp-label)

Check if IP protocol is ICMP. Jumps to icmp-label if ICMP, falls through otherwise.

proto-reg: Register containing protocol number icmp-label: Label offset to jump to if ICMP

Check if IP protocol is ICMP.
Jumps to icmp-label if ICMP, falls through otherwise.

proto-reg: Register containing protocol number
icmp-label: Label offset to jump to if ICMP
sourceraw docstring

is-tcpclj

(is-tcp proto-reg tcp-label)

Check if IP protocol is TCP. Jumps to tcp-label if TCP, falls through otherwise.

proto-reg: Register containing protocol number tcp-label: Label offset to jump to if TCP

Check if IP protocol is TCP.
Jumps to tcp-label if TCP, falls through otherwise.

proto-reg: Register containing protocol number
tcp-label: Label offset to jump to if TCP
sourceraw docstring

is-udpclj

(is-udp proto-reg udp-label)

Check if IP protocol is UDP. Jumps to udp-label if UDP, falls through otherwise.

proto-reg: Register containing protocol number udp-label: Label offset to jump to if UDP

Check if IP protocol is UDP.
Jumps to udp-label if UDP, falls through otherwise.

proto-reg: Register containing protocol number
udp-label: Label offset to jump to if UDP
sourceraw docstring

load-daddrclj

(load-daddr dst-reg ip-hdr-reg)

Load destination IP address into dst-reg.

dst-reg: Destination register ip-hdr-reg: Register pointing to IP header

Load destination IP address into dst-reg.

dst-reg: Destination register
ip-hdr-reg: Register pointing to IP header
sourceraw docstring

load-fieldclj

(load-field dst-reg ip-hdr-reg field size)

Load an IPv4 header field into dst-reg.

dst-reg: Destination register ip-hdr-reg: Register pointing to start of IP header field: Field keyword (:protocol, :saddr, :daddr, etc.) size: :b (byte), :h (half-word), :w (word)

Load an IPv4 header field into dst-reg.

dst-reg: Destination register
ip-hdr-reg: Register pointing to start of IP header
field: Field keyword (:protocol, :saddr, :daddr, etc.)
size: :b (byte), :h (half-word), :w (word)
sourceraw docstring

load-ihlclj

(load-ihl dst-reg ip-hdr-reg)

Load IPv4 header length (in bytes) into dst-reg. Extracts IHL field and multiplies by 4.

dst-reg: Destination register for header length ip-hdr-reg: Register pointing to IP header start

Load IPv4 header length (in bytes) into dst-reg.
Extracts IHL field and multiplies by 4.

dst-reg: Destination register for header length
ip-hdr-reg: Register pointing to IP header start
sourceraw docstring

load-protocolclj

(load-protocol dst-reg ip-hdr-reg)

Load IP protocol number into dst-reg.

dst-reg: Destination register ip-hdr-reg: Register pointing to IP header

Load IP protocol number into dst-reg.

dst-reg: Destination register
ip-hdr-reg: Register pointing to IP header
sourceraw docstring

load-saddrclj

(load-saddr dst-reg ip-hdr-reg)

Load source IP address into dst-reg.

dst-reg: Destination register ip-hdr-reg: Register pointing to IP header

Load source IP address into dst-reg.

dst-reg: Destination register
ip-hdr-reg: Register pointing to IP header
sourceraw docstring

load-total-lenclj

(load-total-len dst-reg ip-hdr-reg)

Load total length field into dst-reg (network byte order).

dst-reg: Destination register ip-hdr-reg: Register pointing to IP header

Load total length field into dst-reg (network byte order).

dst-reg: Destination register
ip-hdr-reg: Register pointing to IP header
sourceraw docstring

load-ttlclj

(load-ttl dst-reg ip-hdr-reg)

Load TTL field into dst-reg.

dst-reg: Destination register ip-hdr-reg: Register pointing to IP header

Load TTL field into dst-reg.

dst-reg: Destination register
ip-hdr-reg: Register pointing to IP header
sourceraw docstring

parse-addrsclj

(parse-addrs saddr-reg daddr-reg ip-hdr-reg)

Load source and destination IPs into registers.

saddr-reg: Register for source IP daddr-reg: Register for destination IP ip-hdr-reg: Register pointing to IP header

Load source and destination IPs into registers.

saddr-reg: Register for source IP
daddr-reg: Register for destination IP
ip-hdr-reg: Register pointing to IP header
sourceraw docstring

parse-ipv4-headerclj

(parse-ipv4-header ip-hdr-reg
                   data-end-reg
                   proto-reg
                   l4-ptr-reg
                   fail-label
                   scratch-reg)

Parse IPv4 header and check bounds. Returns instructions that:

  1. Check bounds for minimum IP header (20 bytes)
  2. Load protocol into proto-reg
  3. Calculate L4 header pointer (fixed offset)

ip-hdr-reg: Register pointing to IP header start data-end-reg: Register containing data_end pointer proto-reg: Register to store protocol l4-ptr-reg: Register to store L4 header pointer fail-label: Label to jump to on bounds failure scratch-reg: Scratch register for bounds check

Parse IPv4 header and check bounds.
Returns instructions that:
1. Check bounds for minimum IP header (20 bytes)
2. Load protocol into proto-reg
3. Calculate L4 header pointer (fixed offset)

ip-hdr-reg: Register pointing to IP header start
data-end-reg: Register containing data_end pointer
proto-reg: Register to store protocol
l4-ptr-reg: Register to store L4 header pointer
fail-label: Label to jump to on bounds failure
scratch-reg: Scratch register for bounds check
sourceraw docstring

parse-ipv4-header-dynamicclj

(parse-ipv4-header-dynamic ip-hdr-reg
                           data-end-reg
                           proto-reg
                           l4-ptr-reg
                           ihl-reg
                           fail-label
                           scratch-reg)

Parse IPv4 header with dynamic IHL (handles IP options). Returns instructions that:

  1. Check bounds for minimum IP header
  2. Load IHL and check bounds for actual header size
  3. Load protocol
  4. Calculate L4 header pointer

ip-hdr-reg: Register pointing to IP header start data-end-reg: Register containing data_end pointer proto-reg: Register to store protocol l4-ptr-reg: Register to store L4 header pointer ihl-reg: Register for IHL (scratch) fail-label: Label to jump to on bounds failure scratch-reg: Scratch register for bounds check

Parse IPv4 header with dynamic IHL (handles IP options).
Returns instructions that:
1. Check bounds for minimum IP header
2. Load IHL and check bounds for actual header size
3. Load protocol
4. Calculate L4 header pointer

ip-hdr-reg: Register pointing to IP header start
data-end-reg: Register containing data_end pointer
proto-reg: Register to store protocol
l4-ptr-reg: Register to store L4 header pointer
ihl-reg: Register for IHL (scratch)
fail-label: Label to jump to on bounds failure
scratch-reg: Scratch register for bounds check
sourceraw docstring

store-daddrclj

(store-daddr ip-hdr-reg addr-reg)

Store destination IP address.

ip-hdr-reg: Register pointing to IP header addr-reg: Register containing new destination IP

Store destination IP address.

ip-hdr-reg: Register pointing to IP header
addr-reg: Register containing new destination IP
sourceraw docstring

store-fieldclj

(store-field ip-hdr-reg field src-reg size)

Store value to IPv4 header field.

ip-hdr-reg: Register pointing to IP header start field: Field keyword src-reg: Register containing value to store size: :b, :h, or :w

Store value to IPv4 header field.

ip-hdr-reg: Register pointing to IP header start
field: Field keyword
src-reg: Register containing value to store
size: :b, :h, or :w
sourceraw docstring

store-saddrclj

(store-saddr ip-hdr-reg addr-reg)

Store source IP address.

ip-hdr-reg: Register pointing to IP header addr-reg: Register containing new source IP

Store source IP address.

ip-hdr-reg: Register pointing to IP header
addr-reg: Register containing new source IP
sourceraw docstring

store-ttlclj

(store-ttl ip-hdr-reg ttl-reg)

Store TTL field.

ip-hdr-reg: Register pointing to IP header ttl-reg: Register containing new TTL value

Store TTL field.

ip-hdr-reg: Register pointing to IP header
ttl-reg: Register containing new TTL value
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close