Ensure that the IPPROTO_TCP level socket options

* TCP_KEEPINIT
* TCP_KEEPINTVL
* TCP_KEEPIDLE
* TCP_KEEPCNT
always always report the values currently used when getsockopt()
is used. This wasn't the case when the sysctl-inherited default
values where used.
Ensure that the IPPROTO_TCP level socket option TCP_INFO has the
TCPI_OPT_ECN flag set in the tcpi_options field when ECN support
has been negotiated successfully.

Reviewed by:	rrs, jtl, hiren
MFC after:	1 month
Differential Revision:	7833
This commit is contained in:
Michael Tuexen 2016-09-14 14:48:00 +00:00
parent 701ac88055
commit 5a17b6ad98
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305810

View File

@ -1329,6 +1329,8 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
ti->tcpi_snd_wscale = tp->snd_scale;
ti->tcpi_rcv_wscale = tp->rcv_scale;
}
if (tp->t_flags & TF_ECN_PERMIT)
ti->tcpi_options |= TCPI_OPT_ECN;
ti->tcpi_rto = tp->t_rxtcur * tick;
ti->tcpi_last_data_recv = (long)(ticks - (int)tp->t_rcvtime) * tick;
@ -1817,16 +1819,16 @@ tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp
case TCP_KEEPCNT:
switch (sopt->sopt_name) {
case TCP_KEEPIDLE:
ui = tp->t_keepidle / hz;
ui = TP_KEEPIDLE(tp) / hz;
break;
case TCP_KEEPINTVL:
ui = tp->t_keepintvl / hz;
ui = TP_KEEPINTVL(tp) / hz;
break;
case TCP_KEEPINIT:
ui = tp->t_keepinit / hz;
ui = TP_KEEPINIT(tp) / hz;
break;
case TCP_KEEPCNT:
ui = tp->t_keepcnt;
ui = TP_KEEPCNT(tp);
break;
}
INP_WUNLOCK(inp);