Tue Aug 15 09:21:48 2017 UTC ()
add some more getsockopt(2) params


(christos)
diff -r1.215 -r1.216 src/sys/netinet/tcp_usrreq.c

cvs diff -r1.215 -r1.216 src/sys/netinet/tcp_usrreq.c (expand / switch to unified diff)

--- src/sys/netinet/tcp_usrreq.c 2017/07/28 19:16:41 1.215
+++ src/sys/netinet/tcp_usrreq.c 2017/08/15 09:21:48 1.216
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tcp_usrreq.c,v 1.215 2017/07/28 19:16:41 maxv Exp $ */ 1/* $NetBSD: tcp_usrreq.c,v 1.216 2017/08/15 09:21:48 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -89,27 +89,27 @@ @@ -89,27 +89,27 @@
89 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 89 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
90 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 90 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
91 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 91 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
92 * SUCH DAMAGE. 92 * SUCH DAMAGE.
93 * 93 *
94 * @(#)tcp_usrreq.c 8.5 (Berkeley) 6/21/95 94 * @(#)tcp_usrreq.c 8.5 (Berkeley) 6/21/95
95 */ 95 */
96 96
97/* 97/*
98 * TCP protocol interface to socket abstraction. 98 * TCP protocol interface to socket abstraction.
99 */ 99 */
100 100
101#include <sys/cdefs.h> 101#include <sys/cdefs.h>
102__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.215 2017/07/28 19:16:41 maxv Exp $"); 102__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.216 2017/08/15 09:21:48 christos Exp $");
103 103
104#ifdef _KERNEL_OPT 104#ifdef _KERNEL_OPT
105#include "opt_inet.h" 105#include "opt_inet.h"
106#include "opt_tcp_debug.h" 106#include "opt_tcp_debug.h"
107#include "opt_mbuftrace.h" 107#include "opt_mbuftrace.h"
108#include "opt_tcp_space.h" 108#include "opt_tcp_space.h"
109#include "opt_net_mpsafe.h" 109#include "opt_net_mpsafe.h"
110#endif 110#endif
111 111
112#include <sys/param.h> 112#include <sys/param.h>
113#include <sys/systm.h> 113#include <sys/systm.h>
114#include <sys/kernel.h> 114#include <sys/kernel.h>
115#include <sys/mbuf.h> 115#include <sys/mbuf.h>
@@ -454,45 +454,55 @@ tcp_ctloutput(int op, struct socket *so, @@ -454,45 +454,55 @@ tcp_ctloutput(int op, struct socket *so,
454 break; 454 break;
455 455
456 default: 456 default:
457 error = ENOPROTOOPT; 457 error = ENOPROTOOPT;
458 break; 458 break;
459 } 459 }
460 break; 460 break;
461 461
462 case PRCO_GETOPT: 462 case PRCO_GETOPT:
463 switch (optname) { 463 switch (optname) {
464#ifdef TCP_SIGNATURE 464#ifdef TCP_SIGNATURE
465 case TCP_MD5SIG: 465 case TCP_MD5SIG:
466 optval = (tp->t_flags & TF_SIGNATURE) ? 1 : 0; 466 optval = (tp->t_flags & TF_SIGNATURE) ? 1 : 0;
467 error = sockopt_set(sopt, &optval, sizeof(optval)); 467 goto setval;
468 break; 
469#endif 468#endif
470 case TCP_NODELAY: 469 case TCP_NODELAY:
471 optval = tp->t_flags & TF_NODELAY; 470 optval = tp->t_flags & TF_NODELAY;
472 error = sockopt_set(sopt, &optval, sizeof(optval)); 471 goto setval;
473 break; 
474 case TCP_MAXSEG: 472 case TCP_MAXSEG:
475 optval = tp->t_peermss; 473 optval = tp->t_peermss;
476 error = sockopt_set(sopt, &optval, sizeof(optval)); 474 goto setval;
477 break; 
478 case TCP_INFO: 475 case TCP_INFO:
479 tcp_fill_info(tp, &ti); 476 tcp_fill_info(tp, &ti);
480 error = sockopt_set(sopt, &ti, sizeof ti); 477 error = sockopt_set(sopt, &ti, sizeof ti);
481 break; 478 break;
482#ifdef notyet 479#ifdef notyet
483 case TCP_CONGCTL: 480 case TCP_CONGCTL:
484 break; 481 break;
485#endif 482#endif
 483 case TCP_KEEPIDLE:
 484 optval = tp->t_keepidle;
 485 goto setval;
 486 case TCP_KEEPINTVL:
 487 optval = tp->t_keepintvl;
 488 goto setval;
 489 case TCP_KEEPCNT:
 490 optval = tp->t_keepcnt;
 491 goto setval;
 492 case TCP_KEEPINIT:
 493 optval = tp->t_keepcnt;
 494setval: error = sockopt_set(sopt, &optval, sizeof(optval));
 495 break;
486 default: 496 default:
487 error = ENOPROTOOPT; 497 error = ENOPROTOOPT;
488 break; 498 break;
489 } 499 }
490 break; 500 break;
491 } 501 }
492 splx(s); 502 splx(s);
493 return (error); 503 return (error);
494} 504}
495 505
496#ifndef TCP_SENDSPACE 506#ifndef TCP_SENDSPACE
497#define TCP_SENDSPACE 1024*32 507#define TCP_SENDSPACE 1024*32
498#endif 508#endif