Creating a timer within a module

Alejandro Pérez Méndez alex at um.es
Mon May 8 21:18:40 CEST 2017


>    You should create a thread in the modules initialization routine.  Then, call radius_event_list_corral() to get the main server event list.
>
>    That thread can do updates.

Thanks. I'll look into it. I didn't want to make changes to rlm_realm, 
just to trustrouter.c. But if I need to create the thread there, so be it.

>    You will need to be sure that memory accesses are thread-safe.  How to do that... is not simple.  I've made some changes in realms.c, but I don't think they're finished.
>
>    In the end, v3 isn't designed to have dynamic realm updates.  And fixing it will be almost impossible at this stage.

I see. My code won't do anything different to what it is currently being 
done in trustrouter.c... would there be any difference? I assume current 
code can potentially be executed from different threads.

What I see is that trustrouter.c either:
1) Adds a new realm, which seems to be mutex protected by the tree itself.
2) Replaces one server pool with another one. This change does not seem 
to be mutex protected 
(https://github.com/FreeRADIUS/freeradius-server/blob/v3.0.x/src/modules/rlm_realm/trustrouter.c#L273)

I will only do 2), in exactly the same way as it is being done right 
now, but within the event handler.

Alejandro
>
>    Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html



More information about the Freeradius-Devel mailing list