Index | Thread | Search

From:
Vitaliy Makkoveev <otto@bsdbox.dev>
Subject:
Re: tcp const variables
To:
Alexander Bluhm <bluhm@openbsd.org>
Cc:
tech@openbsd.org
Date:
Thu, 26 Dec 2024 03:08:51 +0300

Download raw body.

Thread

> On 26 Dec 2024, at 01:29, Alexander Bluhm <bluhm@openbsd.org> wrote:
> 
> Hi,
> 
> Variables sb_max and tcprexmtthresh never change.  Declare them
> const to make arguing about MP easier.
> 
> ok?
> 
> bluhm
> 
> Index: kern/uipc_socket2.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket2.c,v
> diff -u -p -r1.160 uipc_socket2.c
> --- kern/uipc_socket2.c	19 Dec 2024 22:11:35 -0000	1.160
> +++ kern/uipc_socket2.c	25 Dec 2024 22:13:51 -0000
> @@ -47,7 +47,7 @@
>  * Primitive routines for operating on sockets and socket buffers
>  */
> 
> -u_long	sb_max = SB_MAX;		/* patchable */
> +const u_long sb_max = SB_MAX;		/* patchable */
> 
> extern struct pool mclpools[];
> extern struct pool mbpool;
> Index: netinet/tcp_input.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_input.c,v
> diff -u -p -r1.412 tcp_input.c
> --- netinet/tcp_input.c	24 Dec 2024 19:16:53 -0000	1.412
> +++ netinet/tcp_input.c	25 Dec 2024 22:13:51 -0000
> @@ -108,8 +108,8 @@ int tcp_flush_queue(struct tcpcb *);
> #include <netinet6/nd6.h>
> #endif /* INET6 */
> 
> -int	tcprexmtthresh = 3;
> -int	tcptv_keep_init = TCPTV_KEEP_INIT;
> +const int tcprexmtthresh = 3;
> +int tcptv_keep_init = TCPTV_KEEP_INIT;
> 
> int tcp_rst_ppslim = 100;		/* 100pps */
> int tcp_rst_ppslim_count = 0;
> Index: netinet/tcp_output.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_output.c,v
> diff -u -p -r1.146 tcp_output.c
> --- netinet/tcp_output.c	19 Dec 2024 22:11:35 -0000	1.146
> +++ netinet/tcp_output.c	25 Dec 2024 22:13:51 -0000
> @@ -103,8 +103,6 @@
> extern struct mbuf *m_copypack();
> #endif
> 
> -extern int tcprexmtthresh;
> -
> #ifdef TCP_SACK_DEBUG
> void tcp_print_holes(struct tcpcb *tp);
> 
> Index: netinet/tcp_var.h
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_var.h,v
> diff -u -p -r1.178 tcp_var.h
> --- netinet/tcp_var.h	13 May 2024 01:15:53 -0000	1.178
> +++ netinet/tcp_var.h	25 Dec 2024 22:13:51 -0000
> @@ -678,6 +678,7 @@ extern	const struct pr_usrreqs tcp6_usrr
> extern	struct pool tcpcb_pool;
> extern	struct inpcbtable tcbtable, tcb6table;	/* queue of active tcpcb's */
> extern	int tcp_do_rfc1323;	/* enabled/disabled? */
> +extern	const int tcprexmtthresh;
> extern	int tcptv_keep_init;	/* [N] time to keep alive initial SYN packet */
> extern	int tcp_mssdflt;	/* default maximum segment size */
> extern	int tcp_rst_ppslim;	/* maximum outgoing RST packet per second */
> Index: sys/socketvar.h
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/sys/socketvar.h,v
> diff -u -p -r1.134 socketvar.h
> --- sys/socketvar.h	9 Sep 2024 07:38:45 -0000	1.134
> +++ sys/socketvar.h	25 Dec 2024 22:13:51 -0000
> @@ -376,7 +376,7 @@ sbassertlocked(struct sockbuf *sb)
> 	}								\
> } while (/*CONSTCOND*/0)
> 
> -extern u_long sb_max;
> +extern const u_long sb_max;
> 
> extern struct pool	socket_pool;
> 
>