radcli_avp_add_ip4prefix(3)

πŸ“¦ version 2.0.1, in arch rolling

πŸ’… radcli_avp_add_ip4prefix(3)

okay so bestie, welcome to the radcli girlies' corner of the manual pages ✨ this one's from the Radius client library, and it's genuinely a good time, i promise.


🌸 NAME

radcli_avp_add_ip4prefix β€” appends an attribute that's typed as an IPv4 prefix. that's it, that's the whole gig πŸ’–


πŸŽ€ SYNOPSIS

#include <radcli/>

int radcli_avp_add_ip4prefix(
    radcli_avp_list        *list,
    const radcli_attr_def  *def,
    struct in_addr          value,
    unsigned                prefix
);

like yes, four arguments, but two of them are basically free 🫢


πŸ¦‹ DESCRIPTION

so the wire format? it's the RFC 8044 Β§3.9 one, and radcli builds it for you internally, no cap: a reserved zero octet, then the prefix length, then the 4-octet address. you don't have to touch any of that, it just happens πŸ’…

now the tea on why this is its own dedicated function instead of just a prefix parameter on radcli_avp_add_ip4(): it's basically a compatibility slay. see, radcli_avp_add_ip6() took a prefix parameter right from its introduction (iconic of it), but radcli_avp_add_ip4() already shipped without one β€” and there are real callers out there in the wild. adding a prefix param now would force every single existing caller to update for a type that most of them literally don't even use. so instead: new function, zero breakage, main character energy πŸ‘‘


✨ PARAMETERS

  • list β€” the destination list πŸ’–
  • def β€” the attribute. must be RADCLI_TYPE_IPV4PREFIX, or it's not gonna work, bestie.
  • value β€” the address.
  • prefix β€” the prefix length, and it's gotta be 0-32. no sneaking outside the range πŸ™ˆ

πŸ”₯ RETURN VALUE

0 when it slays (success). -1 when it doesn't (failure) β€” that's a wrong type, a prefix that's out of range, or literally anything radcli_avp_add_bytes() would give you.

fr fr, -1 is your vibe check failing. check your type and your prefix range first, iykyk.

🌈 SEE ALSO

the whole friend group, and they all ate:

radcli_avp_add_bytes(3), radcli_avp_add_bytes_by_num(3), radcli_avp_add_gigawords64(3), radcli_avp_add_gigawords64_by_num(3), radcli_avp_add_ip4(3), radcli_avp_add_ip4_by_num(3), radcli_avp_add_ip4prefix_by_num(3), radcli_avp_add_ip6(3), radcli_avp_add_ip6_by_num(3), radcli_avp_add_str(3), radcli_avp_add_str_by_num(3), radcli_avp_add_uint32(3), radcli_avp_add_uint32_by_num(3), radcli_avp_add_uint64(3), radcli_avp_add_uint64_by_num(3), radcli_avp_add_username(3), radcli_avp_concat_str(3), radcli_avp_concat_str_by_num(3), radcli_avp_def(3), radcli_avp_get(3), radcli_avp_get_by_num(3), radcli_avp_get_bytes(3), radcli_avp_get_bytes_by_num(3), radcli_avp_get_cstr(3), radcli_avp_get_cstr_by_num(3), radcli_avp_get_gigawords64(3), radcli_avp_get_gigawords64_by_num(3), radcli_avp_get_ip4prefix(3), radcli_avp_get_ip4prefix_by_num(3), radcli_avp_get_ip6(3), radcli_avp_get_ip6_by_num(3), radcli_avp_get_uint32(3), radcli_avp_get_uint32_by_num(3), radcli_avp_get_uint64(3), radcli_avp_get_uint64_by_num(3), radcli_avp_iter_next(3), radcli_avp_list_error(3), radcli_avp_list_free(3), radcli_avp_list_iter(3), radcli_avp_list_new(3)


k that's the whole page bestie πŸ’œ this absolute bop is brought to you by radcli, dated 2026-10-10 🌸 go forth and append those IPv4 prefixes, you've got this πŸ’…βœ¨

πŸ“¦ where this page comes from