diff options
author | sebastienr <sebastien.raillet@gmail.com> | 2020-11-25 01:11:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 09:11:43 +0900 |
commit | f093d547c2e4c68d0b7060f9accfc67784b7c06a (patch) | |
tree | 073535ce523b8bcfb66f0bff5e2056068d20b9ef /src/daemon/dlt_daemon_client.c | |
parent | 723344e43485c105fe79d21e2ba4c0dcd3dd0ca7 (diff) | |
download | DLT-daemon-f093d547c2e4c68d0b7060f9accfc67784b7c06a.tar.gz |
dlt-daemon: Adds an option to disable injection mode (#266)
A new option named "InjectionMode" allows to select if
we want to enable / disable the feature
Signed-off-by: Sebastien RAILLET <sebastien.raillet@marelli.com>
Diffstat (limited to 'src/daemon/dlt_daemon_client.c')
-rw-r--r-- | src/daemon/dlt_daemon_client.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c index 9450e77..941aa8c 100644 --- a/src/daemon/dlt_daemon_client.c +++ b/src/daemon/dlt_daemon_client.c @@ -1544,7 +1544,7 @@ void dlt_daemon_control_callsw_cinjection(int sock, PRINT_FUNCTION_VERBOSE(verbose); - if ((daemon == NULL) || (msg == NULL) || (msg->databuffer == NULL)) + if ((daemon == NULL) || (daemon_local == NULL) || (msg == NULL) || (msg->databuffer == NULL)) return; datalength = msg->datasize; @@ -1553,6 +1553,12 @@ void dlt_daemon_control_callsw_cinjection(int sock, DLT_MSG_READ_VALUE(id_tmp, ptr, datalength, uint32_t); /* Get service id */ id = DLT_ENDIAN_GET_32(msg->standardheader->htyp, id_tmp); + /* injectionMode is disabled */ + if (daemon_local->flags.injectionMode == 0) { + dlt_daemon_control_service_response(sock, daemon, daemon_local, id, DLT_SERVICE_RESPONSE_PERM_DENIED, verbose); + return; + } + /* id is always less than DLT_DAEMON_INJECTION_MAX since its type is uinit32_t */ if (id >= DLT_DAEMON_INJECTION_MIN) { /* This a a real SW-C injection call */ |