From owner-svn-src-stable@FreeBSD.ORG Tue Oct 2 12:57:48 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C7AF7106566C; Tue, 2 Oct 2012 12:57:48 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9824E8FC08; Tue, 2 Oct 2012 12:57:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q92CvmK8040963; Tue, 2 Oct 2012 12:57:48 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q92CvmuT040961; Tue, 2 Oct 2012 12:57:48 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201210021257.q92CvmuT040961@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 2 Oct 2012 12:57:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241132 - stable/9/sys/netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2012 12:57:48 -0000 Author: glebius Date: Tue Oct 2 12:57:47 2012 New Revision: 241132 URL: http://svn.freebsd.org/changeset/base/241132 Log: Merge r240985 from head: Fix bug in TCP_KEEPCNT setting, which slipped in in the last round of reviewing of r231025. Unlike other options from this family TCP_KEEPCNT doesn't specify time interval, but a count, thus parameter supplied doesn't need to be multiplied by hz. Reported & tested by: amdmi3 Modified: stable/9/sys/netinet/tcp_usrreq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/9/sys/netinet/tcp_usrreq.c Tue Oct 2 12:44:46 2012 (r241131) +++ stable/9/sys/netinet/tcp_usrreq.c Tue Oct 2 12:57:47 2012 (r241132) @@ -1443,7 +1443,6 @@ tcp_ctloutput(struct socket *so, struct case TCP_KEEPIDLE: case TCP_KEEPINTVL: - case TCP_KEEPCNT: case TCP_KEEPINIT: INP_WUNLOCK(inp); error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui)); @@ -1476,13 +1475,6 @@ tcp_ctloutput(struct socket *so, struct tcp_timer_activate(tp, TT_2MSL, TP_MAXIDLE(tp)); break; - case TCP_KEEPCNT: - tp->t_keepcnt = ui; - if ((tp->t_state == TCPS_FIN_WAIT_2) && - (TP_MAXIDLE(tp) > 0)) - tcp_timer_activate(tp, TT_2MSL, - TP_MAXIDLE(tp)); - break; case TCP_KEEPINIT: tp->t_keepinit = ui; if (tp->t_state == TCPS_SYN_RECEIVED || @@ -1494,6 +1486,21 @@ tcp_ctloutput(struct socket *so, struct INP_WUNLOCK(inp); break; + case TCP_KEEPCNT: + INP_WUNLOCK(inp); + error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui)); + if (error) + return (error); + + INP_WLOCK_RECHECK(inp); + tp->t_keepcnt = ui; + if ((tp->t_state == TCPS_FIN_WAIT_2) && + (TP_MAXIDLE(tp) > 0)) + tcp_timer_activate(tp, TT_2MSL, + TP_MAXIDLE(tp)); + INP_WUNLOCK(inp); + break; + default: INP_WUNLOCK(inp); error = ENOPROTOOPT;