lneto
Joined 6 years ago
Joined 6 years ago
We are pleased to announce the release of Lunatik v3.6, introducing new features and improvements for in-kernel Lua scripting.
What is Lunatik?
Lunatik is an in-kernel Lua runtime that enables dynamic scripting within the Linux kernel, allowing extensions and modifications without recompilation. It provides a flexible way to develop networking features, security enhancements, and system automation.
What's New in v3.6?
New kernel bindings:
- Netfilter & Xtables – Packet filtering and firewall extensions
- Completion – Efficient synchronization primitives
- FIFO – Kernel-level queue management
Broader Kernel Support – Now compatible with Linux 5.x series
OpenWRT & OpenWiFi support – Expanding Lunatik to embedded and networking environments OpenWRT feed: https://github.com/luainkernel/openwrt_feed/tree/openwrt-23....
MoonScript support – A more expressive scripting option
New Examples:
- DNS Blocking – Filtering unwanted domains
- DNS Doctoring – Modifying DNS responses dynamically Bug Fixes & Stability Improvements
Acknowledgments
We would like to thank our contributors: @sav and @marcelstanley from Ring-0 Networks, @sheharyaar, @jperon, @vincentmli, @rustedusted, @glk0 – your contributions made this release possible.
We also appreciate the support from Google Summer of Code and Firas from 80211 Networks.
Join the Discussion
To discuss or contribute, join our Matrix room: https://matrix.to/#/#lunatik:matrix.org
Full release notes: https://github.com/luainkernel/lunatik/releases/tag/v3.6
Best regards, The Lunatik Team
[1] https://github.com/luainkernel/lunatik?tab=readme-ov-file#no... [2] https://github.com/luainkernel/lunatik?tab=readme-ov-file#ke...
[1] https://www.netbsd.org/~lneto/dls14.pdf
However, giving you a short answer, we use Lua mainly because it's easy both to extend and to embed. It's implemented as an almost "freestanding" C library. Moreover, it has a considerable small footprint (~250 KB) in comparison to other scripting languages (e.g., Python has a few MB). Moreover, Lua has automatic memory management, fully isolated execution states, protected calls, among other features.
[1] https://pdos.csail.mit.edu/6.828/2008/readings/hunt07singula... [2] https://www.classes.cs.uchicago.edu/archive/2019/winter/3310...
[1] https://legacy.netdevconf.info/0x14/session.html?talk-linux-... [2] https://netdevconf.info/0x17/sessions/talk/scripting-the-lin... [3] https://www.netbsd.org/~lneto/dls14.pdf [4] https://www.slideshare.net/eurobsdcon/lneto-npf-scripting [5] https://2018.eurobsdcon.org/static/slides/Fast,%20Flexible%2...
However, it was conceived for extensibility and flexibility in general, in the spirit of [6]. It has been used also for scripting CPU frequency scaling, debugging, application sandboxing among others [7,8].
[6] https://web.stanford.edu/~ouster/cgi-bin/papers/scripting.pd... [7] https://drive.google.com/file/d/1TJ50IEbRXlBz-TxheGdkO-b4vLS... [8] https://youtu.be/-ufBgy044HI?si=IT4FOqeldA-jsg2r (Portuguese only)
ZFS also has its own kernel Lua version (I'd love to unify them, BTW).
Moreover, we have some simplified examples on our repository [9].
[9] https://github.com/luainkernel/lunatik?tab=readme-ov-file#ex...
The post covers key aspects of Lunatik bindings, including runtime management, integration into the framework, and practical examples like Xtables and kfifo.
Whether you're considering a GSoC project or just interested in kernel scripting with Lua, this article might be a useful reference!