Skip to content

Commit 628364a

Browse files
author
rhc54
committed
Merge pull request #674 from rhc54/topic/oob
Protect the oob/tcp component from port scanners
2 parents 98bf024 + 4352123 commit 628364a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

orte/mca/oob/tcp/oob_tcp_connection.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,11 @@ static bool tcp_peer_recv_blocking(mca_oob_tcp_peer_t* peer, int sd,
10091009
if (opal_socket_errno != EINTR &&
10101010
opal_socket_errno != EAGAIN &&
10111011
opal_socket_errno != EWOULDBLOCK) {
1012-
if (peer->state == MCA_OOB_TCP_CONNECT_ACK) {
1012+
if (NULL == peer) {
1013+
/* protect against things like port scanners */
1014+
CLOSE_THE_SOCKET(sd);
1015+
return false;
1016+
} else if (peer->state == MCA_OOB_TCP_CONNECT_ACK) {
10131017
/* If we overflow the listen backlog, it's
10141018
possible that even though we finished the three
10151019
way handshake, the remote host was unable to
@@ -1038,12 +1042,8 @@ static bool tcp_peer_recv_blocking(mca_oob_tcp_peer_t* peer, int sd,
10381042
(NULL == peer) ? "UNKNOWN" : ORTE_NAME_PRINT(&(peer->name)),
10391043
strerror(opal_socket_errno),
10401044
opal_socket_errno);
1041-
if (NULL != peer) {
1042-
peer->state = MCA_OOB_TCP_FAILED;
1043-
mca_oob_tcp_peer_close(peer);
1044-
} else {
1045-
CLOSE_THE_SOCKET(sd);
1046-
}
1045+
peer->state = MCA_OOB_TCP_FAILED;
1046+
mca_oob_tcp_peer_close(peer);
10471047
return false;
10481048
}
10491049
}

0 commit comments

Comments
 (0)