Page MenuHomeFreeBSD

D38507.id116986.diff
No OneTemporary

D38507.id116986.diff

diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -540,6 +540,10 @@
error = EINVAL;
goto out;
}
+ if ((so->so_state & (SS_ISCONNECTING | SS_ISCONNECTED)) != 0) {
+ error = EISCONN;
+ goto out;
+ }
tp = intotcpcb(inp);
#ifdef INET
/*
@@ -1401,6 +1405,9 @@
NET_EPOCH_ASSERT();
INP_WLOCK_ASSERT(inp);
+ if ((so->so_state & (SS_ISCONNECTING | SS_ISCONNECTED)) != 0)
+ return (EISCONN);
+
INP_HASH_WLOCK(&V_tcbinfo);
error = in_pcbconnect(inp, sin, td->td_ucred, true);
INP_HASH_WUNLOCK(&V_tcbinfo);
@@ -1433,11 +1440,15 @@
tcp6_connect(struct tcpcb *tp, struct sockaddr_in6 *sin6, struct thread *td)
{
struct inpcb *inp = tptoinpcb(tp);
+ struct socket *so = tptosocket(tp);
int error;
NET_EPOCH_ASSERT();
INP_WLOCK_ASSERT(inp);
+ if ((so->so_state & (SS_ISCONNECTING | SS_ISCONNECTED)) != 0)
+ return (EISCONN);
+
INP_HASH_WLOCK(&V_tcbinfo);
error = in6_pcbconnect(inp, sin6, td->td_ucred, true);
INP_HASH_WUNLOCK(&V_tcbinfo);
@@ -1449,7 +1460,7 @@
(TCP_MAXWIN << tp->request_r_scale) < sb_max)
tp->request_r_scale++;
- soisconnecting(inp->inp_socket);
+ soisconnecting(so);
TCPSTAT_INC(tcps_connattempt);
tcp_state_change(tp, TCPS_SYN_SENT);
tp->iss = tcp_new_isn(&inp->inp_inc);

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 8, 9:50 AM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28468809
Default Alt Text
D38507.id116986.diff (1 KB)

Event Timeline