add some more getsockopt(2) params

This commit is contained in:
christos 2017-08-15 09:21:48 +00:00
parent 2603c86715
commit f6b050ef5e
1 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.215 2017/07/28 19:16:41 maxv Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.216 2017/08/15 09:21:48 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.215 2017/07/28 19:16:41 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.216 2017/08/15 09:21:48 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -464,17 +464,14 @@ tcp_ctloutput(int op, struct socket *so, struct sockopt *sopt)
#ifdef TCP_SIGNATURE
case TCP_MD5SIG:
optval = (tp->t_flags & TF_SIGNATURE) ? 1 : 0;
error = sockopt_set(sopt, &optval, sizeof(optval));
break;
goto setval;
#endif
case TCP_NODELAY:
optval = tp->t_flags & TF_NODELAY;
error = sockopt_set(sopt, &optval, sizeof(optval));
break;
goto setval;
case TCP_MAXSEG:
optval = tp->t_peermss;
error = sockopt_set(sopt, &optval, sizeof(optval));
break;
goto setval;
case TCP_INFO:
tcp_fill_info(tp, &ti);
error = sockopt_set(sopt, &ti, sizeof ti);
@ -483,6 +480,19 @@ tcp_ctloutput(int op, struct socket *so, struct sockopt *sopt)
case TCP_CONGCTL:
break;
#endif
case TCP_KEEPIDLE:
optval = tp->t_keepidle;
goto setval;
case TCP_KEEPINTVL:
optval = tp->t_keepintvl;
goto setval;
case TCP_KEEPCNT:
optval = tp->t_keepcnt;
goto setval;
case TCP_KEEPINIT:
optval = tp->t_keepcnt;
setval: error = sockopt_set(sopt, &optval, sizeof(optval));
break;
default:
error = ENOPROTOOPT;
break;