summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2012-09-27 07:13:21 +0000
committerglebius <glebius@FreeBSD.org>2012-09-27 07:13:21 +0000
commitb83730f01b372102c84d4d1b59927b3fc461d838 (patch)
treef2d760e0e91efb58d65caa4c3d523622f1b5adb8 /sys/netinet
parent7d13dfe98920506c323a96331065dc05bcb0f3d6 (diff)
downloadFreeBSD-src-b83730f01b372102c84d4d1b59927b3fc461d838.zip
FreeBSD-src-b83730f01b372102c84d4d1b59927b3fc461d838.tar.gz
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
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_usrreq.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index b69961e..85597d9 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1473,7 +1473,6 @@ unlock_and_done:
case TCP_KEEPIDLE:
case TCP_KEEPINTVL:
- case TCP_KEEPCNT:
case TCP_KEEPINIT:
INP_WUNLOCK(inp);
error = sooptcopyin(sopt, &ui, sizeof(ui), sizeof(ui));
@@ -1506,13 +1505,6 @@ unlock_and_done:
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 ||
@@ -1523,6 +1515,20 @@ unlock_and_done:
}
goto unlock_and_done;
+ 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));
+ goto unlock_and_done;
+
default:
INP_WUNLOCK(inp);
error = ENOPROTOOPT;
OpenPOWER on IntegriCloud