From 9fba07b326eb90e1864848b2c8244f6203f4209a Mon Sep 17 00:00:00 2001 From: rvalovyi <49940758+rvalovyi@users.noreply.github.com> Date: Wed, 3 Nov 2021 01:22:21 +0200 Subject: daemon: Do not exit when accept returns ECONNABORTED (#347) Scan of port 3490 from a Linux machine by 'nmap -v -p 3490 -Pn IP_address_of_QNX_board' leads to dlt-daemon crash. It is necessary to parse the code of the returned error in errno. If errno = ECONNABORTED it means there was an attempt to scan port 3490 and on this error there is no need to exit the application by error. Fix for the issue https://github.com/GENIVI/dlt-daemon/issues/341 Signed-off-by: Ruslan Valovyi --- src/daemon/dlt-daemon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index 55d5954..9678247 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -2060,6 +2060,8 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, cli_size = sizeof(cli); if ((in_sock = accept(receiver->fd, (struct sockaddr *)&cli, &cli_size)) < 0) { + if (errno == ECONNABORTED) // Caused by nmap -v -p 3490 -Pn + return 0; dlt_vlog(LOG_ERR, "accept() for socket %d failed: %s\n", receiver->fd, strerror(errno)); return -1; } -- cgit v1.2.1