BPF

1 program Added 2026-03-13T10:00:00Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: Berkeley Packet Filter, cBPF, Classic BPF
Provenance: commit a26aff5b10 · authored 2026-03-13T01:35:51+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

eBPF (0.48)PF (0.30)UCBLogo (0.15)PacketC (0.13)CLASSIC (0.12)

LLM-contributed programs

TCP Port 80 Packet Filter

Provenance: commit a26aff5b10 · authored 2026-03-13T01:35:51+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.bpf · added: 2026-03-13T10:00:00Z
; BPF classic assembly filter: capture TCP packets to/from port 80 (HTTP)
; Classic BPF (cBPF) as used by libpcap and tcpdump
;
; Instruction format: opcode  operands
; Registers: A (accumulator), X (index), memory store M[]
; Packet bytes accessed via [offset] notation

ldh      [12]               ; load EtherType (2 bytes at offset 12)
jeq      #0x0800, jt 1, jf 6 ; jump if IPv4, else reject
ldb      [23]               ; load IP protocol (byte at offset 23)
jeq      #0x06, jt 1, jf 4  ; jump if TCP (0x06), else reject
ldh      [20]               ; load fragment flags + offset
jset     #0x1fff, jt 3, jf 1 ; reject if fragment offset != 0
ldxb     4*([14]&0xf)       ; X = IP header length (IHL field * 4)
ldh      [x + 14]           ; load TCP destination port (offset 2 in TCP = 14+IHL)
jeq      #0x0050, jt 1, jf 1 ; jump if port 80 (0x50)
ret      #262144             ; accept: return max snapshot length
ret      #0                 ; reject: return 0 (drop packet)

Contribute — propose a file extension

Tell us where to find evidence about BPF (mapped to pl/bpf). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/BPF/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← BPEL script BPFtrace →