Skip to content

v0.9.0 - DSL Improvements & Socket Helpers

Latest

Choose a tag to compare

@pgdad pgdad released this 30 Dec 16:08
· 0 commits to tutorial-outline since this release

What's New in v0.9.0

This release adds significant improvements to the DSL with new constants, context offsets, byte order conversion, and socket key building helpers.

BPF Helper Function ID Constants

  • All 209 BPF helper function IDs (IDs 1-191, 194-211; 192-193 reserved)
  • Complete mapping in bpf-helpers map for instruction generation
  • Includes latest kernel 6.x helpers (timer, cgroup storage, ktime_get_tai_ns, etc.)

BPF Context Structure Offsets (clj-ebpf.ctx)

  • bpf-sock-ops - 30+ field offsets for SOCK_OPS programs
  • bpf-sock - 12+ field offsets for socket programs
  • Re-exports of sk-buff, xdp-md, sk-msg, bpf-sk-lookup
  • Protocol header offsets (Ethernet, IPv4, IPv6, TCP, UDP)
  • Header size and protocol constants
  • Byte order documentation (HOST vs NETWORK) for each field

Network Byte Order Conversion (clj-ebpf.dsl)

  • BPF instruction aliases: htons, htonl, ntohs, ntohl
  • Clojure value conversion: htons-val, ntohs-val, htonl-val, ntohl-val

Socket Key Building Helpers (clj-ebpf.maps.helpers)

  • build-sock-key - Build 4-tuple IPv4 socket key from context (16 bytes)
  • build-sock-key-ipv6 - Build IPv6 socket key from context (40 bytes)
  • Support for :sock-ops, :sk-msg, :sk-skb, :tc context types

Comprehensive Tutorials

  • examples/helpers_tutorial.clj - 3 new sections with 15 examples
  • tutorials/quick-start-sockmap.md - Part 9: Building Socket Keys

New Tests

  • ctx-test - 13 test cases for context offsets
  • maps-helpers-test - 14 test cases for socket key helpers

Full Changelog: v0.8.2...v0.9.0