cipso_v4_cache_add(9)
π NAME π
cipso_v4_cache_add β bestie, this is the function that adds an entry to the CIPSO cache β¨ (yes, that's literally its whole job and it does it gorgeously)
So this lil guy lives in the kernel's Kernel API Manual section 9, and it's lowkey a whole vibe β it takes a CIPSO label and slots it into the label mapping cache. Let's get into it π«Ά
β SYNOPSIS β
int cipso_v4_cache_add (const unsigned char *cipso_ptr , const struct
netlbl_lsm_secattr *secattr );
Two args, one int coming back at you. That's the whole signature, no cap π
π ARGUMENTS π
cipso_ptrβ pointer to the CIPSO IP option π¦ like, this is the actual CIPSO option data you're feeding insecattrβ the packet's security attributes πΈ the secattr half of the deal
π₯ DESCRIPTION π₯
Okay so here's the tea β β cipso_v4_cache_add adds a new entry into the CIPSO label mapping cache. That's it, that's the function.
The way it does it is lowkey iconic: the new entry goes to the head of the cache bucket's list π so it's giving main character energy, front of the line, no waiting.
And if the cache bucket is out of room? π«£ Then it removes the last entry in the list first before squeezing the new one in. Very "you can't sit with us" of it honestly. Bye bestie, you're evicted π
β οΈ IMPORTANT NOTE, FR FR: there is currently no checking for duplicate keys. Like, none. Zero. The function will not notice, will not warn you, will not throw a vibe check at your duplicate β it will simply add it. So don't come for it later, okay? π
Returns zero on success β¨, and negative values on failure π. That's the whole return contract, memorise it, it's on the test.
π SEE ALSO π
Kernel file ./net/ipv4/cipso_ipv4.c β go read the source, it's right there:
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_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_sock_setattr(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)
π and that's the whole page bestie π this one came out of the ./net/ipv4 source tree, October 2026 edition, Kernel API Manual energy all the way through π§ββοΈ mwah, go add some cache entries, ily π
π¦ 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