cipso_v4_sock_setattr(9)
π cipso_v4_sock_setattr β the Kernel API Manual page, bestie edition π
okay so real talk, we're in the Kernel API Manual and this is the page for cipso_v4_sock_setattr(9). yes the name is a whole mouthful, but it's lowkey iconic. let's get into it π«Ά
β¨ NAME β¨
cipso_v4_sock_setattr β Add a CIPSO option to a socket
like... it literally slaps a CIPSO option onto a socket. that's the whole job. no notes π
πΈ SYNOPSIS πΈ
int cipso_v4_sock_setattr (struct sock *sk , const struct cipso_v4_doi
*doi_def , const struct netlbl_lsm_secattr *secattr , bool sk_locked );
it's giving "function signature that ate" β¨ four params, returns an int, and you're gonna want to know what each one means, so:
π ARGUMENTS π
skβ the socket. the main character, honestly. πdoi_defβ the CIPSO DOI to use. this is the vibe-setter for how the labeling goes down.secattrβ the specific security attributes of the socket. i.e. the actual deets β¨sk_lockedβtrueif caller holds the socket lock. not us being nosy, we just need to know π
π¦ DESCRIPTION π¦
So this function sets the CIPSO option on the given socket, using the DOI definition and the security attributes that got passed in. that's it, that's the function π
but okay, here's the part you cannot skip, and i'm saying this with my whole chest: this function requires exclusive access to sk. which literally means it either needs to be in the process of being created, or locked. no in-between, no vibes-based threading, no "it'll probably be fine." it will not be fine. π
Returns zero on success and negative values on failure. so like, 0 = slay, negative = nope π§
bestie warning π¨: exclusive access to sk is a hard requirement, not a suggestion. creation-in-progress or locked. periodt.
π SEE ALSO π
okay this list is LONG, buckle up, but every single one of these is invited to the party π first up, the kernel file this whole thing lives in: ./net/ipv4/cipso_ipv4.c π
then the whole friend group:
cipso_v4_cache_entry_free(9)cipso_v4_map_cache_hash(9)cipso_v4_cache_init(9)cipso_v4_cache_invalidate(9)cipso_v4_cache_check(9)cipso_v4_cache_add(9)cipso_v4_doi_search(9)cipso_v4_doi_add(9)cipso_v4_doi_free(9)cipso_v4_doi_free_rcu(9)cipso_v4_doi_remove(9)cipso_v4_doi_getdef(9)cipso_v4_doi_putdef(9)cipso_v4_doi_walk(9)cipso_v4_map_lvl_valid(9)cipso_v4_map_lvl_hton(9)cipso_v4_map_lvl_ntoh(9)cipso_v4_map_cat_rbm_valid(9)cipso_v4_map_cat_rbm_hton(9)cipso_v4_map_cat_rbm_ntoh(9)cipso_v4_map_cat_enum_valid(9)cipso_v4_map_cat_enum_hton(9)cipso_v4_map_cat_enum_ntoh(9)cipso_v4_map_cat_rng_valid(9)cipso_v4_map_cat_rng_hton(9)cipso_v4_map_cat_rng_ntoh(9)cipso_v4_gentag_hdr(9)cipso_v4_gentag_rbm(9)cipso_v4_parsetag_rbm(9)cipso_v4_gentag_enum(9)cipso_v4_parsetag_enum(9)cipso_v4_gentag_rng(9)cipso_v4_parsetag_rng(9)cipso_v4_gentag_loc(9)cipso_v4_parsetag_loc(9)cipso_v4_optptr(9)cipso_v4_validate(9)cipso_v4_error(9)cipso_v4_genopt(9)cipso_v4_req_setattr(9)cipso_v4_delopt(9)cipso_v4_sock_delattr(9)cipso_v4_req_delattr(9)cipso_v4_getattr(9)cipso_v4_sock_getattr(9)cipso_v4_skbuff_setattr(9)cipso_v4_skbuff_delattr(9)cipso_v4_init(9)
go read them all. i'll wait. iykyk π
and that's the page bestie!! π huge shoutout to the source <pink>./net/ipv4</pink> and the date <purple>October 2026</purple> β that's where this whole thing came from and when it was stamped, so go stan accordingly. 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