diff options
author | maxim <maxim@FreeBSD.org> | 2005-10-02 08:43:57 +0000 |
---|---|---|
committer | maxim <maxim@FreeBSD.org> | 2005-10-02 08:43:57 +0000 |
commit | 4a3de87cfe892ce5e9e4b40be039f2547a891155 (patch) | |
tree | f00e771ac2f9f4c720589f1d6b9473359c02c746 /sys/netinet | |
parent | fe2cef7133bb9cdb247a331cc9bcc62437221eb7 (diff) | |
download | FreeBSD-src-4a3de87cfe892ce5e9e4b40be039f2547a891155.zip FreeBSD-src-4a3de87cfe892ce5e9e4b40be039f2547a891155.tar.gz |
o Teach sysctl_drop() how to deal with the sockets in TIME_WAIT state.
This is a special case because tcp_twstart() destroys a tcp control
block via tcp_discardcb() so we cannot call tcp_drop(struct *tcpcb) on
such connections. Use tcp_twclose() instead.
MFC after: 5 days
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_subr.c | 6 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index f8b0707..6a3068a 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2150,6 +2150,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) struct sockaddr_storage addrs[2]; struct inpcb *inp; struct tcpcb *tp; + struct tcptw *tw; struct sockaddr_in *fin, *lin; #ifdef INET6 struct sockaddr_in6 *fin6, *lin6; @@ -2224,7 +2225,10 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) } if (inp != NULL) { INP_LOCK(inp); - if ((tp = intotcpcb(inp)) && + if ((tw = intotw(inp)) && + (inp->inp_vflag & INP_TIMEWAIT) != 0) { + (void) tcp_twclose(tw, 0); + } else if ((tp = intotcpcb(inp)) && ((inp->inp_socket->so_options & SO_ACCEPTCONN) == 0)) { tp = tcp_drop(tp, ECONNABORTED); if (tp != NULL) diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index f8b0707..6a3068a 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -2150,6 +2150,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) struct sockaddr_storage addrs[2]; struct inpcb *inp; struct tcpcb *tp; + struct tcptw *tw; struct sockaddr_in *fin, *lin; #ifdef INET6 struct sockaddr_in6 *fin6, *lin6; @@ -2224,7 +2225,10 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) } if (inp != NULL) { INP_LOCK(inp); - if ((tp = intotcpcb(inp)) && + if ((tw = intotw(inp)) && + (inp->inp_vflag & INP_TIMEWAIT) != 0) { + (void) tcp_twclose(tw, 0); + } else if ((tp = intotcpcb(inp)) && ((inp->inp_socket->so_options & SO_ACCEPTCONN) == 0)) { tp = tcp_drop(tp, ECONNABORTED); if (tp != NULL) |