[genivi-dlt] DLT LogMode extension

Lipka, Christoph (ADITJ/SWG) clipka at jp.adit-jv.com
Tue May 31 01:34:21 EDT 2016


Hi all,

The attached patch replace the static "LogMode" implementation with a much more generic, configurable solution. The message filter can be configured using a configuration file that is loaded during DLT Daemon startup.
A control application to set a new and get the current filter configuration is part of the patch as well.

The provided dlt_message_filter.conf file is the equivalent of the "LogMode" implementation and can be used to have the same modes (Off, Internal, External, Both) as before. E.g. the log mode External:

[Filter3]
Name         = External
Level         = 50
Clients        = Serial, TCP
ControlMessages = *
Injections      = *

This means, there will be a filter configuration with the name External, the filter level 50. The name is used for human readability only. The value of the level should indicate how strict the filter is. A level of 0 means nothing is allowed (like log mode Off), a level of 100 means everything is allowed (like log mode Both). Furthermore a list of allowed clients is given, all external clients in this case: Serial and TCP connected clients, but not Offlinetrace and Offline Logstorage. Then all control messages and injection messages are allowed. It is possible to write 'None' for nothing is allowed and a comma separated list to allow only a subset.
To allow certain injections only, the Injection property can have one or more injection entries, specified by a name:

Injections = i1

An injection configuration then consists of:
[Injection1]
Name = i1
LogAppName = LOG
ContextNAme = TEST
NodeId = ECU1
ServiceID = 4096 (also a list is possible)

In this configuration, an injection message with the service ID 4096 for the context TEST of the application LOG running on ECU1 is allowed, all other injection messages will be rejected.

Furthermore, the message filter component is integrated into the event handling. Another specific connection type is defined that allows to implement an event source for controlling the message filter. The interface and callback function are already defined, but currently empty.

CAUTION: The user library API dlt_set_log_mode() does not have any effect anymore.

By specifying a backend "Backend = X" in the message filter configuration file, the DLT Daemon will use a functionality defined in dlt_daemon_filter_backend.c to communicate with a proprietary security modul to switch filter configurations.

The filter configuration can be changed with the provided dlt-filter-ctrl application.

Dlt-filter-ctrl -s gives status information about the current active filter. With dlt-filter-ctrl -l <num> (num is Level specified in dlt-message-filter.conf). E.g. dlt-filter-ctrl -l 100 will switch to filter configuration "Both".
To test the behavior, Logstorage or offline trace should be enabled and a viewer connected.

When switching to level 0, there should be no output in either offlinetrace nor DLT viewer. Switching to Internal allows to store logs in internal clients (offline trace, Logstorage), but not in viewer. Control from Viewer is not allowed as well. When switching to External, logs are only written to DLT viewer but not to internal clients. "Both" allows everything. The 5th filter configuration "ReducedViewerCtrl" shows how to allow inly certain control and injection messages:

; Do not allow any state changing controls
[Filter5]
Name            = ReducedViewerCtrl
Level           = 40
Clients         = *
ControlMessages = 0x03, 0x04, 0x0C, 0x13, 0xf0F
Injections      = i1

[Injection1]
Name            = i1
LogAppName      = LOG
ContextName     = TEST
NodeID          = ECU1
ServiceID       = 4096

Only the mentioned control messages are allowed. When sending another control message, in the DLT Daemon log you will see a "Unallowed control message received". Same is true for injection messages.

Please have a look and give some comments what you think. If there are any further questions, please let me know.

Best regards

Christoph Lipka
Software Group (ADITJ/SWG)

Tel. +81-(0)566 61-5124

From: genivi-diagnostic-log-and-trace-bounces at lists.genivi.org [mailto:genivi-diagnostic-log-and-trace-bounces at lists.genivi.org] On Behalf Of Alexander.AW.Wenzel at bmw.de
Sent: Friday, May 20, 2016 4:54 PM
To: Lipka, Christoph (ADITJ/SWG); genivi-diagnostic-log-and-trace at lists.genivi.org
Subject: Re: [genivi-dlt] DLT LogMode extension

Hello Christoph,

The overall idea looks good.

The API "dlt_det_log_mode" is used to disable the logging at all, e.g. by a diagnostic command. Something similar I think we still need, perhaps with some limited access restriction.

Best regards

   Alex

--
BMW Group
Alexander Wenzel
Architect. Connected Drive, I and C Syst.

Postanschrift:
80788 München

Tel: +49-89-382-54199
Mail: alexander.aw.wenzel at bmw.de<mailto:alexander.aw.wenzel at bmw.de>
Web: http://www.bmwgroup.com/
--------------------------------------------------------------------
Bayerische Motoren Werke Aktiengesellschaft
Vorstand: Harald Krüger (Vorsitzender),
Milagros Caiña Carreiro-Andree, Klaus Draeger,
Friedrich Eichiner, Klaus Fröhlich, Ian Robertson,
Peter Schwarzenbauer, Oliver Zipse.
Vorsitzender des Aufsichtsrats: Norbert Reithofer
Sitz und Registergericht: München HRB 42243
--------------------------------------------------------------------
Von: genivi-diagnostic-log-and-trace-bounces at lists.genivi.org<mailto:genivi-diagnostic-log-and-trace-bounces at lists.genivi.org> [mailto:genivi-diagnostic-log-and-trace-bounces at lists.genivi.org]<mailto:[mailto:genivi-diagnostic-log-and-trace-bounces at lists.genivi.org]> Im Auftrag von Lipka, Christoph (ADITJ/SWG)
Gesendet: Montag, 16. Mai 2016 04:43
An: genivi-diagnostic-log-and-trace at lists.genivi.org<mailto:genivi-diagnostic-log-and-trace at lists.genivi.org>
Betreff: [genivi-dlt] DLT LogMode extension

Dear all,

We like to propose an extension to the DLT LogMode. Currently, the DLT Daemon consists of 4 modes (OFF, INTERNAL, EXTERNAL, BOTH). This is very static and does not allow any further configuration which is needed from our point of view. Furthermore, the LogMode can be changed by every application using the "dlt_set_log_mode" API. It is not a good idea to let any application change the general behavior of the DLT Daemon - so we propose to remove this API (or at least disable it in some way to overcome this problem).

The proposed message filter works in two directions:
- filter the forwarding of log messages to different connected DLT Clients (Offline Trace, Offline Logstorage, DLT Viewer connected via TCP or serial connections).
- filter incoming control and injection messages

Currently, when EXTERNAL or BOTH is specified, all incoming control and injection messages are handled by the DLT Daemon, but we have the requirement to allow only specific ones. Therefore, we propose to add a configuration file which is read by the DLT Daemon during startup. The following describes the current LogMode. If no message filter configuration is specified, this is used by default:

[General]
Name         = Genivi-LogMode
DefaultLevel    = 75

[Filter1]
Name         = Off
Level         = 0
Clients        = NONE
ControlMessages = NONE
Injections      = NONE

[Filter2]
Name         = Internal
Level          = 25
Clients         = TRACE, LOGSTORAGE
ControlMessages = NONE
Injections      = NONE

[Filter3]
Name         = External
Level         = 50
Clients        = Serial, TCP
ControlMessages = *
Injections      = *

[Filter4]
Name         = Both
Level         = 100
Clients        = *
ControlMessages = *
Injections      = *

Having a configuration file like this, you can add another filter configuration to allow only specific control and injection messages without any source code changes, e.g.

[Filter5]
Name         = TrustedControl
Level         = 90
Clients        = *
ControlMessages = 0x03, 0x13 // allow only get log info and get software version control messages
Injections      = i1                  // allow only specified injections, list and wildcard will be possible


The injection message has to be specified:
[Injection1]
Name            = i1
LogAppName      = LOG
ContextName      = TEST
NodeID          = ECU1 // makes sense only for MultiNode
ServiceID         = 4096 // list and wildcard will be possible

If the DLT Daemon is in such a mode and receives a not allowed control message, it will send a "PERMISSION_DENIED" response. Of course, the DLT Viewer need a little modification to understand this.
Furthermore, there will be an control application to change the filter configuration and display the current message filter status.

We will provide source code within a couple of days, but want to use the time in between to start some discussion. So if you already have any questions regarding the concept, please let me know.

Best regards

Christoph Lipka
Advanced Driver Information Technology
Software Group (ADITJ/SWG)
1-1 Showa-cho, Kariya-shi
Aichi-ken 448-8661, Japan
Tel. +81-(0)566 61-5124
Fax +81-(0)566 25-4774
clipka at jp.adit-jv.com<mailto:clipka at jp.adit-jv.com>

ADIT is joint venture company of DENSO Corporation and Bosch GmbH

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160531/0b8477e3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Configurable-Message-Filter.patch
Type: application/octet-stream
Size: 127431 bytes
Desc: 0001-Configurable-Message-Filter.patch
URL: <http://lists.genivi.org/pipermail/genivi-diagnostic-log-and-trace_lists.genivi.org/attachments/20160531/0b8477e3/attachment.patch>


More information about the genivi-diagnostic-log-and-trace mailing list