sel_netport_sid(9)
π¦ sel_netport_sid β a Kernel API Manual moment π¦
okay so bestie, welcome to the Kernel API Manual β yes that's the actual manual name, we're in the big leagues now π
β and today's main character is a lil function called sel_netport_sid. she's small, she's fast, she's literally the lookup girlie for network port SIDs. let's get into it β¨
πΈ NAME πΈ
sel_netport_sid β Lookup the SID of a network port
like, that's her whole job. finding the SID for a network port. no cap π«Ά
β¨ SYNOPSIS β¨
int sel_netport_sid (u8 protocol , u16 pnum , u32 *sid );
three args, one int coming back at you. that's it, that's the whole signature, she's lowkey minimalist π₯
π ARGUMENTS π
- protocol β the protocol. that's it. that's the description. the protocol. (yes the original is literally just "protocol", she's a woman of few words π)
- pnum β the port. the port number in question, bestie.
- sid β the port SID. this is where the answer lands, it's a
u32 *so it's giving "output parameter" main character energy π
π DESCRIPTION π
okay so here's the tea β β this function determines the SID of a network port using the fastest method possible. like she is not wasting your time, she is not doing extra work, she is efficient and iconic for it π
the way it works, step by step:
- first, the port table gets queried β quick lil lookup, love that for us π
- but if an entry can't be found, then the policy gets queried instead
- and then the result gets added to the table so future queries are speedup-ed π (yes, speedup. she's helping future-you. self-care fr fr)
and the returns? glad you asked:
- zero on success π
- negative values on failure π
that's the whole vibe check. no surprises, no plot twists, just a clean lookup with a lil caching glow-up β¨
π SEE ALSO π
go read these, they're the friend group π«Ά
- Kernel file
./security/selinux/netport.c sel_netport_hashfn(9)sel_netport_find(9)sel_netport_insert(9)sel_netport_sid_slow(9)β yes there's a slow version, and honestly? relatable. sometimes you gotta be the slow one πsel_netport_flush(9)
okay that's the page!! this whole thing lives in ./security/selinux and the manual itself is dated October 2026 β yes, from the future, she's ahead of her time π§π anyway bestie go read the source, mwah ππ
π¦ 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