Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Make more sysctl constants read-only
Browse files Browse the repository at this point in the history
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
  • Loading branch information
madaidan authored and thestinger committed Jun 7, 2021
1 parent 6e22bdf commit 200aae2
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 106 deletions.
8 changes: 4 additions & 4 deletions ipc/mq_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ static int proc_mq_dointvec_minmax(struct ctl_table *table, int write,
#define proc_mq_dointvec_minmax NULL
#endif

static int msg_max_limit_min = MIN_MSGMAX;
static int msg_max_limit_max = HARD_MSGMAX;
static int msg_max_limit_min __read_only = MIN_MSGMAX;
static int msg_max_limit_max __read_only = HARD_MSGMAX;

static int msg_maxsize_limit_min = MIN_MSGSIZEMAX;
static int msg_maxsize_limit_max = HARD_MSGSIZEMAX;
static int msg_maxsize_limit_min __read_only = MIN_MSGSIZEMAX;
static int msg_maxsize_limit_max __read_only = HARD_MSGSIZEMAX;

static struct ctl_table mq_sysctls[] = {
{
Expand Down
28 changes: 14 additions & 14 deletions net/ax25/sysctl_net_ax25.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
#include <linux/spinlock.h>
#include <net/ax25.h>

static int min_ipdefmode[1], max_ipdefmode[] = {1};
static int min_axdefmode[1], max_axdefmode[] = {1};
static int min_backoff[1], max_backoff[] = {2};
static int min_conmode[1], max_conmode[] = {2};
static int min_window[] = {1}, max_window[] = {7};
static int min_ewindow[] = {1}, max_ewindow[] = {63};
static int min_t1[] = {1}, max_t1[] = {30000};
static int min_t2[] = {1}, max_t2[] = {20000};
static int min_t3[1], max_t3[] = {3600000};
static int min_idle[1], max_idle[] = {65535000};
static int min_n2[] = {1}, max_n2[] = {31};
static int min_paclen[] = {1}, max_paclen[] = {512};
static int min_proto[1], max_proto[] = { AX25_PROTO_MAX };
static int min_ipdefmode[1], max_ipdefmode[] __read_only = {1};
static int min_axdefmode[1], max_axdefmode[] __read_only = {1};
static int min_backoff[1], max_backoff[] __read_only = {2};
static int min_conmode[1], max_conmode[] __read_only = {2};
static int min_window[] __read_only = {1}, max_window[] __read_only = {7};
static int min_ewindow[] __read_only = {1}, max_ewindow[] __read_only = {63};
static int min_t1[] __read_only = {1}, max_t1[] __read_only = {30000};
static int min_t2[] __read_only = {1}, max_t2[] __read_only = {20000};
static int min_t3[1], max_t3[] __read_only = {3600000};
static int min_idle[1], max_idle[] __read_only = {65535000};
static int min_n2[] __read_only = {1}, max_n2[] __read_only = {31};
static int min_paclen[] __read_only = {1}, max_paclen[] __read_only = {512};
static int min_proto[1], max_proto[] __read_only = { AX25_PROTO_MAX };
#ifdef CONFIG_AX25_DAMA_SLAVE
static int min_ds_timeout[1], max_ds_timeout[] = {65535000};
static int min_ds_timeout[1], max_ds_timeout[] __read_only = {65535000};
#endif

static const struct ctl_table ax25_param_table[] = {
Expand Down
16 changes: 8 additions & 8 deletions net/core/sysctl_net_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#include <net/busy_poll.h>
#include <net/pkt_sched.h>

static int zero = 0;
static int one = 1;
static int two __maybe_unused = 2;
static int min_sndbuf = SOCK_MIN_SNDBUF;
static int min_rcvbuf = SOCK_MIN_RCVBUF;
static int max_skb_frags = MAX_SKB_FRAGS;
static long long_one __maybe_unused = 1;
static long long_max __maybe_unused = LONG_MAX;
static int zero __read_only = 0;
static int one __read_only = 1;
static int two __maybe_unused __read_only = 2;
static int min_sndbuf __read_only = SOCK_MIN_SNDBUF;
static int min_rcvbuf __read_only = SOCK_MIN_RCVBUF;
static int max_skb_frags __read_only = MAX_SKB_FRAGS;
static long long_one __maybe_unused __read_only = 1;
static long long_max __maybe_unused __read_only = LONG_MAX;

static int net_msg_warn; /* Unused, but still a sysctl */

Expand Down
16 changes: 8 additions & 8 deletions net/decnet/sysctl_net_decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ int sysctl_decnet_rmem[3] = { 4 * 1024, 87380, 87380 * 2 };

#ifdef CONFIG_SYSCTL
extern int decnet_dst_gc_interval;
static int min_decnet_time_wait[] = { 5 };
static int max_decnet_time_wait[] = { 600 };
static int min_state_count[] = { 1 };
static int max_state_count[] = { NSP_MAXRXTSHIFT };
static int min_decnet_dst_gc_interval[] = { 1 };
static int max_decnet_dst_gc_interval[] = { 60 };
static int min_decnet_no_fc_max_cwnd[] = { NSP_MIN_WINDOW };
static int max_decnet_no_fc_max_cwnd[] = { NSP_MAX_WINDOW };
static int min_decnet_time_wait[] __read_only = { 5 };
static int max_decnet_time_wait[] __read_only = { 600 };
static int min_state_count[] __read_only = { 1 };
static int max_state_count[] __read_only = { NSP_MAXRXTSHIFT };
static int min_decnet_dst_gc_interval[] __read_only = { 1 };
static int max_decnet_dst_gc_interval[] __read_only = { 60 };
static int min_decnet_no_fc_max_cwnd[] __read_only = { NSP_MIN_WINDOW };
static int max_decnet_no_fc_max_cwnd[] __read_only = { NSP_MAX_WINDOW };
static char node_name[7] = "???";

static struct ctl_table_header *dn_table_header = NULL;
Expand Down
50 changes: 25 additions & 25 deletions net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,31 @@
#include <net/inet_frag.h>
#include <net/ping.h>

static int zero;
static int one = 1;
static int three = 3;
static int four = 4;
static int hundred = 100;
static int thousand = 1000;
static int gso_max_segs = GSO_MAX_SEGS;
static int tcp_retr1_max = 255;
static int ip_local_port_range_min[] = { 1, 1 };
static int ip_local_port_range_max[] = { 65535, 65535 };
static int tcp_adv_win_scale_min = -31;
static int tcp_adv_win_scale_max = 31;
static int tcp_min_snd_mss_min = TCP_MIN_SND_MSS;
static int tcp_min_snd_mss_max = 65535;
static int ip_ttl_min = 1;
static int ip_ttl_max = 255;
static int tcp_syn_retries_min = 1;
static int tcp_syn_retries_max = MAX_TCP_SYNCNT;
static int ip_ping_group_range_min[] = { 0, 0 };
static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
static int one_day_secs = 24 * 3600;
static int tcp_delack_seg_min = TCP_DELACK_MIN;
static int tcp_delack_seg_max = 60;
static int tcp_use_userconfig_min;
static int tcp_use_userconfig_max = 1;
static int zero __read_only;
static int one __read_only = 1;
static int three __read_only = 3;
static int four __read_only = 4;
static int hundred __read_only = 100;
static int thousand __read_only = 1000;
static int gso_max_segs __read_only = GSO_MAX_SEGS;
static int tcp_retr1_max __read_only = 255;
static int ip_local_port_range_min[] __read_only = { 1, 1 };
static int ip_local_port_range_max[] __read_only = { 65535, 65535 };
static int tcp_adv_win_scale_min __read_only = -31;
static int tcp_adv_win_scale_max __read_only = 31;
static int tcp_min_snd_mss_min __read_only = TCP_MIN_SND_MSS;
static int tcp_min_snd_mss_max __read_only = 65535;
static int ip_ttl_min __read_only = 1;
static int ip_ttl_max __read_only = 255;
static int tcp_syn_retries_min __read_only = 1;
static int tcp_syn_retries_max __read_only = MAX_TCP_SYNCNT;
static int ip_ping_group_range_min[] __read_only = { 0, 0 };
static int ip_ping_group_range_max[] __read_only = { GID_T_MAX, GID_T_MAX };
static int one_day_secs __read_only = 24 * 3600;
static int tcp_delack_seg_min __read_only = TCP_DELACK_MIN;
static int tcp_delack_seg_max __read_only = 60;
static int tcp_use_userconfig_min __read_only;
static int tcp_use_userconfig_max __read_only = 1;

/* Update system visible IP port range */
static void set_local_port_range(struct net *net, int range[2])
Expand Down
6 changes: 3 additions & 3 deletions net/ipv6/sysctl_net_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <net/calipso.h>
#endif

static int one = 1;
static int auto_flowlabels_min;
static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;
static int one __read_only = 1;
static int auto_flowlabels_min __read_only;
static int auto_flowlabels_max __read_only = IP6_AUTO_FLOW_LABEL_MAX;


static struct ctl_table ipv6_table_template[] = {
Expand Down
32 changes: 16 additions & 16 deletions net/netrom/sysctl_net_netrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
/*
* Values taken from NET/ROM documentation.
*/
static int min_quality[] = {0}, max_quality[] = {255};
static int min_obs[] = {0}, max_obs[] = {255};
static int min_ttl[] = {0}, max_ttl[] = {255};
static int min_t1[] = {5 * HZ};
static int max_t1[] = {600 * HZ};
static int min_n2[] = {2}, max_n2[] = {127};
static int min_t2[] = {1 * HZ};
static int max_t2[] = {60 * HZ};
static int min_t4[] = {1 * HZ};
static int max_t4[] = {1000 * HZ};
static int min_window[] = {1}, max_window[] = {127};
static int min_idle[] = {0 * HZ};
static int max_idle[] = {65535 * HZ};
static int min_route[] = {0}, max_route[] = {1};
static int min_fails[] = {1}, max_fails[] = {10};
static int min_reset[] = {0}, max_reset[] = {1};
static int min_quality[] __read_only = {0}, max_quality[] __read_only = {255};
static int min_obs[] __read_only = {0}, max_obs[] __read_only = {255};
static int min_ttl[] __read_only = {0}, max_ttl[] __read_only = {255};
static int min_t1[] __read_only = {5 * HZ};
static int max_t1[] __read_only = {600 * HZ};
static int min_n2[] __read_only = {2}, max_n2[] __read_only = {127};
static int min_t2[] __read_only = {1 * HZ};
static int max_t2[] __read_only = {60 * HZ};
static int min_t4[] __read_only = {1 * HZ};
static int max_t4[] __read_only = {1000 * HZ};
static int min_window[] __read_only = {1}, max_window[] __read_only = {127};
static int min_idle[] __read_only = {0 * HZ};
static int max_idle[] __read_only = {65535 * HZ};
static int min_route[] __read_only = {0}, max_route[] __read_only = {1};
static int min_fails[] __read_only = {1}, max_fails[] __read_only = {10};
static int min_reset[] __read_only = {0}, max_reset[] __read_only = {1};

static struct ctl_table_header *nr_table_header;

Expand Down
4 changes: 2 additions & 2 deletions net/phonet/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#define DYNAMIC_PORT_MAX 0x7f

static DEFINE_SEQLOCK(local_port_range_lock);
static int local_port_range_min[2] = {0, 0};
static int local_port_range_max[2] = {1023, 1023};
static int local_port_range_min[2] __read_only = {0, 0};
static int local_port_range_max[2] __read_only = {1023, 1023};
static int local_port_range[2] = {DYNAMIC_PORT_MIN, DYNAMIC_PORT_MAX};
static struct ctl_table_header *phonet_table_hrd;

Expand Down
18 changes: 9 additions & 9 deletions net/rose/sysctl_net_rose.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
#include <net/ax25.h>
#include <net/rose.h>

static int min_timer[] = {1 * HZ};
static int max_timer[] = {300 * HZ};
static int min_idle[] = {0 * HZ};
static int max_idle[] = {65535 * HZ};
static int min_route[1], max_route[] = {1};
static int min_ftimer[] = {60 * HZ};
static int max_ftimer[] = {600 * HZ};
static int min_maxvcs[] = {1}, max_maxvcs[] = {254};
static int min_window[] = {1}, max_window[] = {7};
static int min_timer[] __read_only = {1 * HZ};
static int max_timer[] __read_only = {300 * HZ};
static int min_idle[] __read_only = {0 * HZ};
static int max_idle[] __read_only = {65535 * HZ};
static int min_route[1], max_route[] __read_only = {1};
static int min_ftimer[] __read_only = {60 * HZ};
static int max_ftimer[] __read_only = {600 * HZ};
static int min_maxvcs[] __read_only = {1}, max_maxvcs[] = {254};
static int min_window[] __read_only = {1}, max_window[] = {7};

static struct ctl_table_header *rose_table_header;

Expand Down
30 changes: 15 additions & 15 deletions net/sctp/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@
#include <net/sctp/sctp.h>
#include <linux/sysctl.h>

static int zero = 0;
static int one = 1;
static int timer_max = 86400000; /* ms in one day */
static int int_max = INT_MAX;
static int sack_timer_min = 1;
static int sack_timer_max = 500;
static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
static int rwnd_scale_max = 16;
static int rto_alpha_min = 0;
static int rto_beta_min = 0;
static int rto_alpha_max = 1000;
static int rto_beta_max = 1000;

static unsigned long max_autoclose_min = 0;
static unsigned long max_autoclose_max =
static int zero __read_only = 0;
static int one __read_only = 1;
static int timer_max __read_only = 86400000; /* ms in one day */
static int int_max __read_only = INT_MAX;
static int sack_timer_min __read_only = 1;
static int sack_timer_max __read_only = 500;
static int addr_scope_max __read_only = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
static int rwnd_scale_max __read_only = 16;
static int rto_alpha_min __read_only = 0;
static int rto_beta_min __read_only = 0;
static int rto_alpha_max __read_only = 1000;
static int rto_beta_max __read_only = 1000;

static unsigned long max_autoclose_min __read_only = 0;
static unsigned long max_autoclose_max __read_only =
(MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX)
? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;

Expand Down
4 changes: 2 additions & 2 deletions net/x25/sysctl_net_x25.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <linux/init.h>
#include <net/x25.h>

static int min_timer[] = { 1 * HZ };
static int max_timer[] = { 300 * HZ };
static int min_timer[] __read_only = { 1 * HZ };
static int max_timer[] __read_only = { 300 * HZ };

static struct ctl_table_header *x25_table_header;

Expand Down

0 comments on commit 200aae2

Please sign in to comment.