Skip to content

Lunatik v4.2

Choose a tag to compare

@lneto lneto released this 16 Mar 00:14
· 69 commits to master since this release

Lunatik 4.2

New Modules

  • luaskb: wraps struct sk_buff for direct packet manipulation from Lua — skb:data([layer]), skb:forward(), skb:copy(), skb:resize(n), skb:ifindex(), skb:vlan(), with IPv6 checksum support; skb:copy() guards against FRAGLIST GSO skbs
  • darken + lighten: AES-256-CTR encrypted Lua script support — darken (C module) decrypts and executes scripts in-kernel; lighten (Lua) provides the high-level interface

API Changes

  • lunatik.runtime(script, context): the sleep boolean parameter is now a context string — "softirq" replaces false for non-sleepable runtimes; CLI: lunatik run <script> softirq
  • data.new(size, mode): new optional mode parameter ("single", "shared") controls object sharing semantics
  • data:checksum(): new method — raw IP checksum over the data buffer; luadata_reset no longer takes an offset parameter
  • socket.unix: rewritten from a dynamic factory pattern to explicit OOP-style classes (unix.stream, unix.dgram) with full method set; tests added
  • lunatik_opt_t (C API): new bitmask type replaces the bool sleep and bool shared parameters throughout the API — lunatik_runtime(), lunatik_newobject(), lunatik_createobject(), and lunatik_class_t all take lunatik_opt_t now; flags: LUNATIK_OPT_SOFTIRQ (non-sleepable), LUNATIK_OPT_MONITOR (spinlock serialization), LUNATIK_OPT_SINGLE (no monitor overhead for per-object instances), LUNATIK_OPT_EXTERNAL (externally-owned pointer)
  • luarcu (C API): entries now store lunatik_value_t (tagged union) instead of raw object pointers — supports nil, boolean, integer, and Lunatik objects as values

CLI and REPL

  • Full REPL rewrite: multi-line input, readline support, expression auto-detection, multiple return values
  • New lunatik test [suite] command
  • Argument validation for run/spawn/stop
  • Globals and runner state now initialized correctly when modules are pre-loaded (e.g., via modprobe at boot) without calling lunatik load first

Bug Fixes

  • Fix GC finalizers running under spinlock in lunatik_monitor (scheduling-while-atomic crash)
  • Fix opaque error messages in lunatik_monitor — errors now include method name and Lua traceback
  • Fix module refcount leak on runtime error path
  • Fix shouldstop() crash when called outside kthread context
  • Fix thread.run error during module load

Removed

  • luaxtable module removed

Examples

  • New tcpreject: TCP RST injection via netfilter mark, with IPv6 support

Tests

  • KTAP shell framework introduced for all test suites
  • New regression tests: GC-under-spinlock, rcu_shared, resume_shared, shouldstop, spawn-during-module-load, opt_guards, opt_skb_single
  • New socket/unix test suites (STREAM and DGRAM)

Contributors

Thank you to everyone who contributed to this release:

  • @sneaky-potato — opaque error messages in lunatik_monitor, non-shared objects in shared class, remove Lua traceback from lunatik_fixerror, README fix
  • @carloslackdata:checksum() (raw IP checksum), skb:vlan(), removed unneeded includes
  • @Suryansh-Dey — fix sockaddr version guard (first contribution! 🎉)

Full Changelog: v4.1.1...v4.2