summaryrefslogtreecommitdiff
path: root/src/daemon/dlt-daemon.c
Commit message (Collapse)AuthorAgeFilesLines
* Add option in dlt.conf for bindAddress to specific IPs (#130)AdrianStoenescu2019-09-031-26/+95
| | | | | | | | | | | | | | | | | | | | | | | | Add the possibility to have in dlt.conf an option that specifies a set of IP addresses. The daemon will do a socket bind only for this list, therefore external connections will be limited to this set of IP addresses. If this option is not given, the default INADDR_ANY is used ("0.0.0.0") as before. The option in dlt.conf can look like this: BindAddress = 160.48.199.98;160.48.199.97;160.48.199.226,160.48.199.186;160.48.199.139;172.16.222.99 There can be as many addresses but only specified on one single line. They have to be delimited by ',' or ';'. ' ' (space) delimiter does not work. IPv6 addresses are supported as well. For instance: BindAddress = fe80::255:7bff:feb5:7df7 IPv6 addresses are acceptable only if DLT_USE_IPv6 flag is ON at compile time. IPv4 addresses are acceptable only if DLT_USE_IPv6 flag is OFF at compile time. One cannot have both IPv4 and IPv6 format in the same time. Signed-off-by: Adrian Stoenescu Adrian.Stoenescu@harman.com
* UDP Multicast implementation (#155)Sunil-K-S2019-08-231-0/+49
| | | | | The feature can be enabled by setting WITH_UDP_CONNECTION to ON. Signed-off-by: sunil.s <sunil.s@lge.com>
* daemon: fix compile error with DLT_IPC="UNIX_SOCKET" (#153)Vo Trung Chi2019-08-021-0/+2
| | | Signed-off-by: Vo Trung Chi <chi.votrung@vn.bosch.com>
* using POSIX shared memory APIs (#90) (#151)Vo Trung Chi2019-08-011-3/+30
| | | | | Replace all Linux specific shared memory APIs with POSIX alternatives. Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
* Revert "Add option in dlt.conf for bindAddress to specific IPs (#130)"Saya Sugiura2019-08-011-95/+26
| | | | This reverts commit e8716cc5c950e50411b23a7a6cafa3c063c59e90.
* Add option to set owner group of daemon FIFO (#122)Jiri Popek2019-07-251-1/+37
| | | | | | | | | | New option to set owner group of daemon FIFO (Default: /tmp/dlt) is added in dlt.conf. If this option is used properly, more secure tracing can be realized. Only application that is in dlt_user_apps_group can write log message to daemon FIFO. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* Add option in dlt.conf for bindAddress to specific IPs (#130)AdrianStoenescu2019-07-251-26/+95
| | | | | | | | | | | | | | | | | | | | | | | Add the possibility to have in dlt.conf an option that specifies a set of IP addresses. The daemon will do a socket bind only for this list, therefore external connections will be limited to this set of IP addresses. If this option is not given, the default INADDR_ANY is used ("0.0.0.0") as before. The option in dlt.conf can look like this: BindAddress = 160.48.199.98;160.48.199.97;160.48.199.226,160.48.199.186;160.48.199.139;172.16.222.99 There can be as many addresses but only specified on one single line. They have to be delimited by ',' or ';'. ' ' (space) delimiter does not work. IPv6 addresses are supported as well. For instance: BindAddress = fe80::255:7bff:feb5:7df7 IPv6 addresses are acceptable only if DLT_USE_IPv6 flag is ON at compile time. IPv4 addresses are acceptable only if DLT_USE_IPv6 flag is OFF at compile time. One cannot have both IPv4 and IPv6 format in the same time. Signed-off-by: Adrian Stoenescu Adrian.Stoenescu@harman.com
* doxygen: Remove licenceSaya Sugiura2019-07-191-2/+0
| | | | Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* define DLT_PATH_MAX for max path buffer lengthRadoslaw Kaczorowski2019-07-031-8/+11
| | | | | | | | DLT limits the path length and does not do anything else to determine the actual value, because the least that is supported on any system that DLT runs on is 1024 bytes. Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
* cleanup: Use dlt_vlog()Saya Sugiura2019-06-191-133/+51
| | | | | | | There were a couple of places which used snprintf-dlt_log. It is now replaced with dlt_vlog(). Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* daemon: Don't remove unregistered contextBui Nguyen Quoc Thanh2019-06-181-1/+5
| | | | | | | | If a context is defined and loaded from runtime context config file, that context won't be deleted/removed from dlt-daemon database until its parent application is unregistered. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
* daemon: Don't assign fd after freeBui Nguyen Quoc Thanh2019-06-181-3/+0
| | | | | | Do not assign fd after destroying receiver pointer Signed-off-by: Bui Nguyen Quoc Thanh <Thanh.BuiNguyenQuoc@vn.bosch.com>
* dlt-daemon: fix internal logging to file after daemonizeChristoph Lipka2019-05-061-0/+5
| | | | Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
* Fix compiler warningsSimon Herkenhoff2019-05-061-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix compiler warnings about socket usage Correct the data types used for the socket declaration. We use AF_UNIX sockets so we use struct sockaddr_un, but we need to cast to struct sockaddr for the socket API. Fix compiler warnings about sign-compare Fix two occurences of signed - unsigned comparison by casting the values accordingly. Note that the cast is legal as the first parts of both conditional statements make sure the value is not negative before casting to unsigned. While at it, add strtol error checking. Fix compiler warnings about string functions Add string.h to src/daemon/dlt_daemon_unix_socket.c, because it was unaware of memcpy and strerror. While at it, change unsafe use of sprintf to proper dlt_vlog and remove the char buffer. Fix compiler warnings about unused-* Fix two unused-variable and one unused-parameter warning. While at it, change the #ifdef to not run into an empty block. Simply reverse the condition and enclose the complete else with the #ifdef. POSIX: Use memset instead of bzero "The bzero() function is deprecated (marked as LEGACY in POSIX.1-2001); use memset(3) in new programs." Use memset instead of bzero and remove any occurrence from DLT. Include of header "strings.h" that has bzero is also removed. Signed-off-by: Simon Herkenhoff <sherkenhoff@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* unix socket: IPC code isolationChristoph Lipka2019-05-061-2/+1
| | | | | Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com> Signed-off-by: Vo Trung Chi <Chi.VoTrung@vn.bosch.com>
* dlt-daemon: unlink application socketS. Hameed2019-04-241-0/+5
| | | | Signed-off-by: S. Hameed <shameed@jp.adit-jv.com>
* Code beautification using uncrustifyChristoph Lipka2018-12-211-1217/+1000
| | | | Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
* dlt-daemon: Output current number of connections as defaultYusuke Sato2018-12-211-15/+18
| | | | | | | | | | In previous, number of connections was output only if verbose mode in dlt.conf was enabled. This information is basically useful and is not output frequently. Therefore number of connections information is made to output as default when new connection is established or the connection is lost. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* exit DLT daemon if /dev/null open fails during forkJeevan Ramakant Nagvekar2018-12-211-0/+5
| | | | | | | If /dev/null fails to open during DLT daemon's fork handling, it is treated as an error and DLT daemon exits. Signed-off-by: Jeevan Ramakant Nagvekar <jeevan.nagvekar1@wipro.com>
* Improvement - use dup2 in place of dup in daemon forkJeevan Ramakant Nagvekar2018-12-211-16/+19
| | | | | | | | | | | 1> While daemonizing DLT, for connecting I/O file descriptors to /dev/NULL POSIX call dup() is used. dup2() POSIX call is now used where explicit standard I/O descriptor number is mentioned. 2>After fork() directory changed to root in place of FIFO Base directory - "/tmp" Signed-off-by: Jeevan Ramakant Nagvekar <jeevan.nagvekar1@wipro.com>
* Remove one-instance-lock mechanismJeevan Ramakant Nagvekar2018-12-211-31/+1
| | | | | | | | | | | | | | This commit removes DLT's "one-instance-lock" mechanism. In daemonized mode, on first instance, a file is created (if not already created) and locked. If second instance is attempted file locking fails since the file is already locked by first instance. This prevents new instance of the DLT daemon. After analysis its found that there is no need of any mechanism for prevention of another instance. The same is already taken care by socket mechanism. Since main socket is created by first instance, attempt to create it again with same port number fails. Signed-off-by: Jeevan Ramakant Nagvekar <jeevan.nagvekar1@wipro.com>
* daemon: Add exit triggerSaya Sugiura2018-12-211-13/+18
| | | | | Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
* UnitTest: UpdatesManikandanC2018-12-211-2/+4
| | | | | | | | | | | | Gateway Logstorage Event Handler Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Aditya Paluri <venkataaditya.paluri@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* Removed log level change callback notification while context register done ↵Ravi Sankar P2018-12-211-6/+10
| | | | | | with ll_ts API Signed-off-by: Ravi Sankar P <ponnurangamravi.sankar@in.bosch.com>
* Dynamic allocation of msg bufferManikandanC2018-12-101-4/+5
| | | | | | | | | | | | | It is possible to change the default buffer size for log message creation via environment variable: export DLT_LOG_MSG_BUF_LEN=<value> Instead of using a static buffer with size of 1390 bytes, the buffer is allocated dynamically with the specified value.The max size is restricted to approx 65k. Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* Use poll in the dlt-daemon for POSIX complianceManikandanC2018-11-301-10/+10
| | | | | | | | | | | The poll system call is now used in the daemon to enable DLT use in POSIX compliant systems. Also added introduced new unregister_app macro to avoid missing of logs in startup buffer. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com>
* Log storage - Updates (#82)ManikandanChockalingam2018-11-151-5/+8
| | | | | | | | | | - improvements and refactor key creation - Sync strategies added Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com> Signed-off-by: Ravi Sankar P <ponnurangamravi.sankar@in.bosch.com> Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* dlt-daemon: per ECU list of user information (#80)ManikandanChockalingam2018-10-301-49/+74
| | | | | | Prepare daemon to store applications/context information of other ECUs as well. This commit prepares the dlt-daemon to store logs from passive nodes in a logstorage device. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* Fix compiler warning PR #77Christoph Lipka2018-09-251-1/+1
| | | | | | warning: extra tokens at end of #ifdef directive Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com>
* Fix compilation with glibc 2.28 (#77)Oleksndr Kravchuk2018-09-251-1/+1
| | | | | | | | Package compilation fails with GLIBC 2.28: stat.h:56:8: error: redefinition of 'struct statx_timestamp' stat.h:99:8: error: redefinition of 'struct statx' Signed-off-by: Oleksandr Kravchuk <oleksandr.kravchuk@pelagicore.com>
* dlt-daemon: Output signal number at exit (#68)Yusuke Sato2018-05-291-7/+8
| | | | | | | | | | | So far, signal number had been output in signal handler. However this was not so safety. And when syslog was used as log output destination of dlt_log(), we could not see any info in the same Life Cycle. So dlt_log() is removed from signal handler and signal number is newly output by DLT message and dlt_log() at exit. This info will help analysis why dlt-daemon exits. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* dlt-daemon: Improve error logging on accept() failure (#69)Yusuke Sato2018-05-281-3/+3
| | | | | | | | | Error log in case of accept() failure is improved with errno info. This helps us to analyze dlt-daemon's issue in future. (e.g.) Connection request come to wrong socket unexpectedly and this causes exiting dlt-daemon. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* dlt-daemon: Avoid to output duplicated application registration message (#63)Yusuke Sato2018-05-231-11/+21
| | | | | | | | | | | | | | | | If application tries to send application registration request before dlt-daemon startup, the request is sent twice as below: 1. Buffered request in user library buffer 2. New request when user app succeeds to attach to dlt-daemon In previous, dlt-daemon had been output the registration messages 2 times even though these messages were come from same application. This duplicated output is avoided by this change. Warning message in case of dlt-runtime-context.cfg exists is also avoided. This file is created when Control message: "Store Config" is used. This is not irregular case. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* dlt-daemon: Not output Context un-/registration DLT message by default (#62)Yusuke Sato2018-05-231-5/+11
| | | | | | | | | | | This patch changes Context un-/registration message not to output DLT by default for the purpose of reducing trace messages. Actually dlt-daemon already sends almost same meaning control message which can show Context un-/registration([get_log_info] and [unregister_context]). These are duplicate message and should be suppressed in normal case. Only if "Verbose = 1" is set in dlt.conf, the messages are output as same as before. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* IPC: Unix socket added (#43)ManikandanChockalingam2018-05-181-46/+206
| | | | | | | | | * IPC: Unix socket added The user can select either FIFO or UNIX socket as IPC between user library and daemon through CMakelist option. Socket path configurable for both FIFO and Unix Socket now configurable in CMake Signed-off-by: Christoph Lipka <clipka@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com>
* dlt-daemon: Fix repeated output of marker message (#54)Yusuke Sato2018-05-081-1/+4
| | | | | | | | Marker message had been continued to output if application called dlt_log_marker() due to missing byte removing processing against marker message. Therefore the byte removing for marker message processing is added. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp>
* Data stuck in receiver buffer when dlt_daemon_user_send_log_level() fails (#21)Lutz Helwing2017-08-221-5/+1
| | | | | | | | | | | | - When dlt_daemon_user_send_log_level() called in dlt_daemon_process_user_message_register_context() fails -1 was returned which caused dlt_daemon_process_user_messages() to stop processing receiver buffer. Remaining data was stuck until new data arrived over FIFO. - Make debug output of dlt_daemon_user_send_log_level() more verbose. Signed-off-by: Lutz Helwing <lutz_helwing@mentor.com>
* MultiNode: Specify config file location in dlt.confChristoph Lipka2016-10-241-0/+14
| | | | Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* process user message: Fix bound handlingFrederic Berat2016-10-241-16/+99
| | | | | | | | | | | | | | | | | | | | | | | | On context and application registration, the data needs to be read in 2 parts. If the first part was at the end of the receiver buffer, it was wrongly removed whereas the complete data is not full received and therefore interpretable. This has to be fixed by not removing the data before everything is checked. Thus, while readjusting the buffer to the first found header, the offset was not properly updated. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Process User Messages: Fix buffer handling In case application and context registration the buffer need to be read two times. But before removing the data, the data need to be readjusted to its origin. This was missing in a previous fix. Furthermore, in case of corrupted description field, applications and contexts will be registered anyway with the dummy description "Unknown". Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* Fix: dlt-daemon overwrites ECU ID even if user log message already has the ↵Yusuke Sato2016-09-231-2/+2
| | | | | | | | | | | ECU ID that is not default value dlt-daemon overwrites ECU ID even if user log message already has the ECU ID that is not default value. This phenomenon happens when application uses dlt_forward_msg(). Therefore, dlt-daemon is modified not to overwrite ECU ID if log message has already has the ECU ID. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp> Change-Id: Icbc6304e5571242bf75ff0d32cbe4b004f1d7f9d
* Add: Configuration of option of get log info response during context ↵Yusuke Sato2016-09-231-1/+7
| | | | | | | | | | registration Option of get log info response during context registration was fixed to 7. This modification enables to change that option. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp> Change-Id: Ia75f15cdb33e0bffd77c5ba71a1960e820714e61
* Add: Configuration of daemon FIFO sizeYusuke Sato2016-09-231-0/+28
| | | | | | | Configuration of daemon FIFO (default: /tmp/dlt) size is added to dlt.conf. Signed-off-by: Yusuke Sato <yusuke-sato@apn.alpine.co.jp> Change-Id: I05cc56b9a05e4c3a0a1af49c374f35ae10f4674d
* dlt-daemon: Free DltDaemon structure on exitChristoph Lipka2016-04-281-3/+2
| | | | | Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com> Change-Id: I504664fa8d2a4c6d9449a1911bf139dfe6005d76
* dlt-daemon: Fix user log handler return valueFrederic Berat2016-04-281-8/+8
| | | | | | | | The user log message handler was returning 1 instead of -1 in case of failure, which was not expected. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Change-Id: Id03b2879f631e804f9939a9f52132be26491f888
* dlt-daemon: Connection activation reworkFrederic Berat2016-04-281-2/+1
| | | | | | | | The activation of the connection is now centralized in one common function. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Change-Id: I86703eab411088905a85f526d5102875e2c92b7e
* dlt-daemon: receiver reworkFrederic Berat2016-04-281-615/+595
| | | | | | | | | | The receiver structures have been removed from the dlt-daemon structure, they are now part of the connection. The overall usage of the receiver structrure has also been reviewed in the daemon. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Change-Id: I7cf80d79ed73bd6d4f370bb3f278d26ccc9d8d7a
* Set default log-levels in dlt.confStefan Vacek2015-12-091-5/+47
| | | | | | | | - feature: allow to define a default-log-level in dlt.conf (see dlt.conf for documentation) - bugfix: make dlt_unlock_mutex not inline to fix linkage - bugfix: initial log-level was not set correctly when no dlt-daemon was running Signed-off-by: Stefan Vacek <stefan.vacek@intel.com>
* Dlt MultiNodeChristoph Lipka2015-12-071-116/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MultiNode allows to connect DLT Daemons running on different operating systems, e.g. in a virtualized environment. The central component is the Gateway DLT Daemon which connects external DLT Clients, like the DLT Viewer running on a host computer, with Passive DLT Daemons running on nodes without a physical connection to external DLT clients. The Gateway DLT Daemon itself acts as a DLT client when connecting to a Passive DLT Daemon. To use the Gateway functionality, it has to be enabled in dlt.conf: GatewayMode = 1 All communication between passive nodes and DLT Viewer has to be send via the Gateway node. The Gateway node forwards log messages coming from passive nodes to all connected DLT clients. It also forwards command and control requests coming from DLT clients to the corresponding passive node. The Gateway DLT Daemon read a configuration file (dlt_gateway.conf) at startup with information about Passive DLT Daemon connections. Afterwards, the Daemon will try to connect to the passive DLT Daemons. If the connection cannot be established after the configured timeout, the Gateway DLT Daemon will give up connecting. The configuration file has to contain the following information about a passive node: [PassiveNode1] IPaddress = 192.168.2.35 Port = 3490 EcuID = ECU2 Connect = OnStartup ; timeout in seconds Timeout = 10 Precondition is, that the passive node is configured with the correct ECU id, ECU2 in this case. If the passive node sends messages with another than configured ECU id, the Gateway DLT Daemon will shut down the connection. It is also possible to connect to a passive DLT daemon using the dlt-passive-node-ctrl application. In this case "Connect=OnDemand" has to be configured in the configuration file. To connect to PassiveNode1, "dlt-passive-node-ctrl -n ECU2 -c 1" has to be executed. With "dlt-passive-node-ctrl -s" the status of passive node connections can be retrieved. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* Fix daemon shutdownChristoph Lipka2015-11-241-7/+30
| | | | | | | | | The shutdown of the daemon was not proper implemented. This commit fixes: - memory leaks - removal of created sockets Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
* DltLogstorage: Logstorage CacheChristoph Lipka2015-11-241-6/+23
| | | | | | | | | | | | | | | | | | When using DltLogstorage on internal storage device, it is needed to reduce writing to internal storage device as much as possible. This patch introduces sync strategies to Logstorage to provide that functionality. The ON_MSG strategy is the default sync strategy that flushes every written log message to the storage device (fflush). The ON_DAEMON_EXIT strategy only flushes data to disk when the daemon exits. The strategy can be defined per filter in the dlt_logstorage.conf configuration file by adding SyncBehavior=<Strategy> to a configuration. Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>