Skip to content

netlink: group rt, genl and channel under a netlink namespace - #623

Merged
lneto merged 1 commit into
masterfrom
claude_netlink_ns
Jul 26, 2026
Merged

netlink: group rt, genl and channel under a netlink namespace#623
lneto merged 1 commit into
masterfrom
claude_netlink_ns

Conversation

@lneto

@lneto lneto commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Constructing a netlink session read as an anonymous call on the required class — require("netlink.rt")() — inconsistent with socket.inet's inet.tcp(). This makes netlink a namespace like socket.inet:

local netlink = require("netlink")
local session = netlink.rt()          -- was require("netlink.rt")()
local g       = netlink.genl()
local ch      = netlink.channel(name) -- unchanged
local sock    = inet.tcp()            -- socket family: unchanged

require("netlink") now returns a table whose netlink.rt(), netlink.genl() and netlink.channel(name) are the factories, mirroring inet.tcp()/inet.udp(). The aggregator requires the three members eagerly; loading rt/genl only defines the classes (constructing a session is what needs a sleepable runtime), so a softirq runtime that only wants netlink.channel requires netlink all the same — the channel test exercises exactly that.

How

  • The channel C module registers as netlink.channel (luaopen_netlink_channel); verified in-kernel that the dotted C module name resolves. The source stays lib/luanetlink.c and the kernel module stays luanetlink.ko.
  • A small Lua aggregator (lib/netlink.lua) re-exports channel, rt, genl.

Channel callers (require("netlink").channel(name)) are unchanged. Full socket and netlink suites pass; LDoc builds clean.

Supersedes #622 (the .new approach): keeps everything callable and consistent with inet.tcp(), which is what the redesign was after.

Open branches (nl80211 #617, netfailover #618, floodguard #619) rebase onto this.

🤖 Generated with Claude Code

@lneto
lneto force-pushed the claude_netlink_ns branch 4 times, most recently from bafe650 to 828eda8 Compare July 4, 2026 18:57
@lneto
lneto force-pushed the claude_netlink_ns branch 5 times, most recently from 4efe0f0 to cb98f83 Compare July 26, 2026 12:05
Constructing a netlink session read as an anonymous call on the required class
(require("netlink.rt")()), inconsistent with socket.inet's inet.tcp(). Make
netlink a namespace like socket.inet: require("netlink") returns a table whose
netlink.rt(), netlink.genl() and netlink.channel(name) are the factories,
mirroring inet.tcp()/inet.udp().

The channel C module now registers as netlink.channel (luaopen_netlink_channel),
and the netlink Lua aggregator re-exports it plus rt and genl.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lneto
lneto force-pushed the claude_netlink_ns branch from cb98f83 to 899e67f Compare July 26, 2026 12:11
@lneto
lneto merged commit d52ea7d into master Jul 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant