freeradius-client sequence file replacement
Alan DeKok
aland at deployingradius.com
Mon Feb 1 11:36:44 CET 2010
Alex Massover wrote:
> I made a patch that adds fast locking mechanisms instead of seq file for
> freeradius-client.
OK... I just re-read the original code, and boggled a bit. Using a
file for a sequence number is completely wrong. There is just no need.
I'd suggest two patches:
1) replace "seq_nbr" in the code with "id". The field is NOT a
sequence number. it's a random id. The ONLY requirement
is that it's unique until the outgoing packet times out,
or a reply is received.
2) replace the rc_get_seqnbr() with a function that tracks 256
allocated IDs, and allocates a free one. Also update
rc_check_reply() to mark the "id" as free.
This will be *enormously* faster than using a file or shared memory.
The array of 256 Ids needs to be unique per source port. But it can
be shared across child threads. It does NOT need to be shared across
multiple processes.
The main server code does it a little differently. See
src/lib/packet.c for a number of functions that track/allocate/free
packet Ids.
Alan DeKok.
More information about the Freeradius-Devel
mailing list