rlm_detail and locking

Brian Candler B.Candler at pobox.com
Thu Feb 7 16:10:20 CET 2013


I have an application where I would like to read and process rlm_detail
records in near-real-time (specifically to turn them into JSON and stuff
them into a local database).

I'm familiar with rlm_sql_log + radsqlrelay, and I know this is robust.

So I was hoping to modify radsqlrelay to work with files being appended to
by rlm_detail, but I turned up a wrinkle when checking the file locking in
2.2.x code.

rlm_sql_log uses fcntl() locking only; but rlm_detail is different. It calls
rad_lockfd_nonblock(), which uses lockf if available, else flock, and only
uses fcntl if the other two are not available.

It looks like fcntl and flock locks are independent of each other:
http://www.mjmwired.net/kernel/Documentation/filesystems/locks.txt

Question: what's the safe way to process detail files? Is there a Perl
implementation of radrelay I can hack from?  Looks like the original C
implementation of radrelay was removed in 2005 (acd40e2e)

I am aware of raddb/sites-available/buffered-sql, but that only shows how
to get freeradius to read a detail file, not a standalone program.

Thanks in advance,

Brian.


More information about the Freeradius-Users mailing list