Skip to content
Snippets Groups Projects
Commit 8ccf33c1 authored by Michael Tüxen's avatar Michael Tüxen
Browse files

Don't send TCP RST / SCTP ABORT for non-existing connections.

Only send the cleanup messages when the socket is not in a front state.
This fixes a bug where in case of the SUT being a server was sent
a TCP RST with wildcard addresses and ports.
parent 5ba57cf2
No related branches found
No related tags found
No related merge requests found
......@@ -103,15 +103,22 @@ static void close_all_sockets(struct state *state)
if (close(socket->live.fd))
die_perror("close");
}
if (socket->protocol == IPPROTO_TCP &&
!state->config->is_wire_client &&
reset_connection(state, socket)) {
die("error reseting connection\n");
}
if (socket->protocol == IPPROTO_SCTP &&
!state->config->is_wire_client &&
abort_association(state, socket)) {
die("error aborting association\n");
if ((socket->state != SOCKET_INIT) &&
(socket->state != SOCKET_NEW) &&
(socket->state != SOCKET_PASSIVE_LISTENING) &&
(state->config->is_wire_client == false)) {
switch (socket->protocol) {
case IPPROTO_TCP:
if (reset_connection(state, socket) != STATUS_OK)
die("error reseting connection\n");
break;
case IPPROTO_SCTP:
if (abort_association(state, socket) != STATUS_OK)
die("error aborting association\n");
break;
default:
break;
}
}
struct socket *dead_socket = socket;
socket = socket->next;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment