Author: glebius
Date: Tue Oct  2 13:03:11 2012
New Revision: 241133
URL: http://svn.freebsd.org/changeset/base/241133

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
  
  Approved by:  re (kib)

Modified:
  releng/9.1/sys/netinet/tcp_usrreq.c
Directory Properties:
  releng/9.1/sys/   (props changed)

Modified: releng/9.1/sys/netinet/tcp_usrreq.c
==============================================================================
--- releng/9.1/sys/netinet/tcp_usrreq.c Tue Oct  2 12:57:47 2012        
(r241132)
+++ releng/9.1/sys/netinet/tcp_usrreq.c Tue Oct  2 13:03:11 2012        
(r241133)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to