Skip to content

Commit

Permalink
daemon: Do not exit when accept returns ECONNABORTED (#347)
Browse files Browse the repository at this point in the history
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 #341

Signed-off-by: Ruslan Valovyi <ruslan.valovyi@volvocars.com>
  • Loading branch information
rvalovyi committed Nov 2, 2021
1 parent 1f51eab commit 9fba07b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/daemon/dlt-daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <IP of dlt-daemon>
return 0;
dlt_vlog(LOG_ERR, "accept() for socket %d failed: %s\n", receiver->fd, strerror(errno));
return -1;
}
Expand Down

0 comments on commit 9fba07b

Please sign in to comment.