[strongSwan-dev] [PATCH 0/3] Proposer error unifier for loggers

Thomas Egerer thomas.egerer at secunet.com
Wed Mar 27 11:23:51 CET 2013

Hello *,

for my current project I needed charon to insert a unique ID into
each log message. I think it's quite handy to have such a mechanism
although the maintanance of the ID database is a bit tricky.
For the messages being tagged uniquely I had to
1) Extend the logger_t and controller_cb_t with an additional u_int64_t,
   the actual id. The id is logged unless it is zero (which is the
   default if noone registers their own error unifier). I did however
   not test this for android, smp and mediation.
2) Add an extra header file for the unification interface. The interface
   maps from the format string to an ID, which server my purpose very
   well, even if the format string is not exactly unique. The interface
   itself could be extended even more: filtering log message based on
   an external application, translations etc.
3) Add the error unifier to bus.c with a slim default implementation.
   I admit, I'm not to sure about using the mutex for the registration
   is appropriate, so if this is wrong, please tell me. I decided not
   to add a list of registered function but to only allow one, since
   it is most likely to only have a single unifier instead of many.
As of right now I only have a private implementation of the unifier
which uses a gperf-generated hash to map the format strings to an ID
(using the actual message would not work since they are not stable
enough). The database itself is maintened with the help of a script
that parses the preprocessed output of the whole build process and
keeps the IDs up-to-date (i.e. no reuse of vanished ones etc).

So guys, any chance to get this upstream, or do you think this is a
ridiculous idea/bad implementation whatsoever? Tell me!

Cheers, Thomas

More information about the Dev mailing list