STRUCT LANDLOCK_NET_PORT_ATTR(9)
π struct landlock_net_port_attr(9) β like, the network port definition one
okay so you're in the Kernel API Manual bestie, and we're talking about struct landlock_net_port_attr β literally the network port definition, that's the whole vibe β¨
πΈ NAME πΈ
struct landlock_net_port_attr β network port definition. that's it, that's the girl π
β¨ SYNOPSIS β¨
struct landlock_net_port_attr {
__u64 allowed_access;
__u64 port;
};
she's small, she's cute, she has exactly two fields, no notes π
π«Ά Members π«Ά
allowed_accessβ a bitmask of the allowed network actions for a port (cf.Network flags_). so like, what's actually permitted on this port, encoded as bits πportβ the network port, in host endianness. don't get weird with byte order, ok? π
ok important note, do NOT skip this one: aportof0passed to :manpage:bind(2)will bind to an available port from the ephemeral port range. you can configure that range with the/proc/sys/net/ipv4/ip_local_port_range sysctl (also used for IPv6), and within that range, on a per-socket basis with setsockopt(IP_LOCAL_PORT_RANGE)π₯
and second note, also lowkey essential: a Landlock rule with port 0 and the LANDLOCK_ACCESS_NET_BIND_TCP or LANDLOCK_ACCESS_NET_BIND_UDP right means that requesting to bind on port 0 is allowed, and it will automatically translate to binding on a kernel-assigned ephemeral port π no cap, the kernel picks for you.
β Description β
she's the argument of sys_landlock_add_rule. that's the whole description. iconic behaviour, honestly π
π¦ SEE ALSO π¦
go read these next, i'm obsessed with all of them fr fr:
- Kernel file
./include/uapi/linux/landlock.hstructlandlock_ruleset_attr(9) landlock_create_ruleset_flags(9)landlock_add_rule_flags(9)landlock_restrict_self_flags(9)- enum
landlock_rule_type(9) - struct
landlock_path_beneath_attr(9) fs_access(9)net_access(9)scope(9)
π reminder bestie: everything above is exactly what the page says, i'm just louder about it.
and that's the page! coming to you from ./include/uapi/linux, dated October 2026, titled struct land...et_port_attr(9) (yes the truncation is real, we love her anyway) β mwah, bye πππ§
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms