Freeradius Queries

Arran Cudbard-Bell a.cudbardb at freeradius.org
Thu Sep 18 20:52:01 CEST 2014


> Fine I will go through the code thoroughly now.

Good luck. As Alan said, if you have a specific need to modify the code then tell us 
what it is and we can advise you on the best way to achieve what you want.

> One question that I have is how AVPs (Attribute Value Pairs) are stored in memory in freeradius.

http://doc.freeradius.org/libradius_8h.html#structVALUE__PAIR

They're stored in the above structure, and alloced on the heap at run time.

They're parented from either the REQUEST struct, or from a RADIUS_PACKET struct
to ensure they're cleaned up when the REQUEST is freed.

Fixed length values are stored in the value_data_t union, octets, text and tlv
attributes have dynamically allocated buffers parented off the VALUE_PAIR.
These buffers are pointed to by the value_data_t union.

VALUE_PAIRs are always allocated with pairalloc, and are freed using talloc_free
or pairfree (if you need to free a linked list of AVPs).

The vendor, number and type of attributes are in the DICT_ATTR struct. These are
usually allocated on startup when reading the config and dictionaries. The da
field of the VALUE_PAIR struct points to a DICT_ATTR struct.

VALUE_PAIR (text, octets, tlv) buffers should be considered immutable. If a new
value needs to be assigned, the old buffer is freed and a new one allocated.

talloc_free performs all necessary cleanup for VALUE_PAIRs.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140918/e57c6078/attachment.pgp>


More information about the Freeradius-Users mailing list