[PATCH 0/3] Implement D-Bus API for toggling debug on/off at run-time

Jussi Laakkonen <[email protected]>
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
This patch set contains a new D-Bus API, net.connman.DebugLog, for toggling
debug on/off during run-time. The API itself is implemented as a plugin an can
be enabled by building ConnMan with --enable-debuglog. The aim is to help in
debugging corner case scenarios where restarting ConnMan is not desired but
more logging could aid in getting the detailed information about how the flow
inside ConnMan progresses before hitting the issue or an error.

In order to make the interface work, log.c as well as plugin.c needed some
modifications. On log.c the methods for updating the flags for the desc is
added that can be accessed via plugin.c to do this separately for builtin and
dynamically loaded plugins. With similar approach, a listing of available files
is added to log.c that is used via plugins.c for the plugin desc's. The listing
method adds the filenames and a pointer to desc into a hash table for
convenience.

The API itself is very simple, it has Enable(), Disable() and List() methods.
First two take the exact filename or GLib g_pattern_match_simple() semantics
for mathcing a pattern. The third, List() simply returns the filename and the
current status of logging on the file as a boolean. This is documented in more
detail in doc/logcontrol-api.txt.

Approach similar to this has been in use in Sailfish OS ConnMan fork for over a
decade (https://github.com/sailfishos/connman) and has evolved into a direction
where an external server is used via a plugin that requires more dependencies
https://github.com/sailfishos/connman/blob/master/connman/plugins/sailfish_debuglog.c
and is not feasible to upstream. Thus, this version is an adaptation and an
improvement from the old logcontrol.c plugin. Most of the functionality within
the plugin was moved to log.c and, thus, improved to meet the changed features
of ConnMan. This has been tested to work on latest Debian 13. 

These changes are also available at my connman_ng repository located at:
https://github.com/LaakkonenJussi/connman_ng/pull/6 - I will keep adding these
NLnet project works on top of next branch, and sync from upstream when there
are changes pulled in.

The work for making these patches available for ConnMan upstream has been
funded by NLnet foundation grant NGI0 Commons Fund:
https://nlnet.nl/commonsfund.

The NLnet project website is available at:
https://nlnet.nl/project/ConnMan/.


Jussi Laakkonen (3):
  log: Add update, list and enabled check funcs, allow to disable debug
  plugin: Add log update and list functionality accessible from plugins
  logcontrol: Implement net.connman.DebugLog interface as a plugin

 Makefile.plugins       |   5 ++
 configure.ac           |   5 ++
 doc/logcontrol-api.txt |  38 +++++++++
 include/log.h          |   9 ++
 include/plugin.h       |   5 ++
 plugins/logcontrol.c   | 181 +++++++++++++++++++++++++++++++++++++++++
 src/connman.h          |   8 ++
 src/log.c              | 122 +++++++++++++++++++++++++--
 src/plugin.c           |  34 ++++++++
 9 files changed, 400 insertions(+), 7 deletions(-)
 create mode 100644 doc/logcontrol-api.txt
 create mode 100644 plugins/logcontrol.c

-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.