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
This commit is contained in:
Maxim Konovalov 2005-10-02 08:43:57 +00:00
parent d11122e73a
commit ac827533df
2 changed files with 10 additions and 2 deletions

View File

@ -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)

View File

@ -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)