Proper way to share code between several modules
Alan DeKok
aland at deployingradius.com
Thu Jun 13 18:57:31 UTC 2024
On Jun 13, 2024, at 2:10 PM, g4-lisz at tonarchiv.ch wrote:
> I wrote several modules which share similar logic and the same DB backend. Right now I'm using a source file for this purpose which is included in every module's SOURCES variable (all.mk).
>
> I don't like this approach very much. But are there better alternatives?
If the modules share the same DB backend, then it's best to share the same DB connections. Look at the rlm_sql module, and rlm_sql_ippool for examples.
> I could add the shared code as a library. But it uses Freeradius functions, so I had to build it somewhere in the Freeradius source tree... At this point I am overwhelmed with my little knowledge...
TBH, simple is fine. Copying code (or creating soft links) is fine. Compare to things like a web browser, FreeRADIUS uses zero RAM.
Alan DeKok.
More information about the Freeradius-Users
mailing list