2 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
4 * $Id: sysctl_net_ipv4.c,v 1.38 1999/01/02 16:51:48 davem Exp $
6 * Begun April 1, 1996, Mike Shaver.
7 * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
11 #include <linux/sysctl.h>
12 #include <linux/config.h>
15 #include <net/route.h>
19 * TCP configuration parameters
22 #define TCP_PMTU_DISC 0x00000001 /* perform PMTU discovery */
23 #define TCP_CONG_AVOID 0x00000002 /* congestion avoidance algorithm */
24 #define TCP_DELAY_ACKS 0x00000003 /* delayed ack stategy */
27 static int boolean_min
= 0;
28 static int boolean_max
= 1;
32 extern int sysctl_icmp_echo_ignore_all
;
33 extern int sysctl_icmp_echo_ignore_broadcasts
;
34 extern int sysctl_icmp_ignore_bogus_error_responses
;
36 /* From ip_fragment.c */
37 extern int sysctl_ipfrag_low_thresh
;
38 extern int sysctl_ipfrag_high_thresh
;
39 extern int sysctl_ipfrag_time
;
41 /* From ip_output.c */
42 extern int sysctl_ip_dynaddr
;
45 extern int sysctl_ip_masq_debug
;
47 extern int sysctl_tcp_timestamps
;
48 extern int sysctl_tcp_window_scaling
;
49 extern int sysctl_tcp_sack
;
50 extern int sysctl_tcp_retrans_collapse
;
51 extern int sysctl_tcp_keepalive_time
;
52 extern int sysctl_tcp_keepalive_probes
;
53 extern int sysctl_tcp_max_ka_probes
;
54 extern int sysctl_tcp_retries1
;
55 extern int sysctl_tcp_retries2
;
56 extern int sysctl_tcp_fin_timeout
;
57 extern int sysctl_tcp_syncookies
;
58 extern int sysctl_tcp_syn_retries
;
59 extern int sysctl_tcp_stdurg
;
60 extern int sysctl_tcp_rfc1337
;
61 extern int sysctl_tcp_syn_taildrop
;
62 extern int sysctl_max_syn_backlog
;
65 extern int sysctl_icmp_destunreach_time
;
66 extern int sysctl_icmp_timeexceed_time
;
67 extern int sysctl_icmp_paramprob_time
;
68 extern int sysctl_icmp_echoreply_time
;
71 extern int sysctl_igmp_max_memberships
;
73 int tcp_retr1_max
= 255;
75 struct ipv4_config ipv4_config
;
77 extern ctl_table ipv4_route_table
[];
82 int ipv4_sysctl_forward(ctl_table
*ctl
, int write
, struct file
* filp
,
83 void *buffer
, size_t *lenp
)
85 int val
= ipv4_devconf
.forwarding
;
88 ret
= proc_dointvec(ctl
, write
, filp
, buffer
, lenp
);
90 if (write
&& ipv4_devconf
.forwarding
!= val
)
91 inet_forward_change();
97 ctl_table ipv4_table
[] = {
98 {NET_IPV4_TCP_TIMESTAMPS
, "tcp_timestamps",
99 &sysctl_tcp_timestamps
, sizeof(int), 0644, NULL
,
101 {NET_IPV4_TCP_WINDOW_SCALING
, "tcp_window_scaling",
102 &sysctl_tcp_window_scaling
, sizeof(int), 0644, NULL
,
104 {NET_IPV4_TCP_SACK
, "tcp_sack",
105 &sysctl_tcp_sack
, sizeof(int), 0644, NULL
,
107 {NET_IPV4_TCP_RETRANS_COLLAPSE
, "tcp_retrans_collapse",
108 &sysctl_tcp_retrans_collapse
, sizeof(int), 0644, NULL
,
110 {NET_IPV4_FORWARD
, "ip_forward",
111 &ipv4_devconf
.forwarding
, sizeof(int), 0644, NULL
,
112 &ipv4_sysctl_forward
},
113 {NET_IPV4_DEFAULT_TTL
, "ip_default_ttl",
114 &ip_statistics
.IpDefaultTTL
, sizeof(int), 0644, NULL
,
116 {NET_IPV4_AUTOCONFIG
, "ip_autoconfig",
117 &ipv4_config
.autoconfig
, sizeof(int), 0644, NULL
,
119 {NET_IPV4_NO_PMTU_DISC
, "ip_no_pmtu_disc",
120 &ipv4_config
.no_pmtu_disc
, sizeof(int), 0644, NULL
,
122 {NET_IPV4_TCP_SYN_RETRIES
, "tcp_syn_retries",
123 &sysctl_tcp_syn_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
124 {NET_IPV4_IPFRAG_HIGH_THRESH
, "ipfrag_high_thresh",
125 &sysctl_ipfrag_high_thresh
, sizeof(int), 0644, NULL
, &proc_dointvec
},
126 {NET_IPV4_IPFRAG_LOW_THRESH
, "ipfrag_low_thresh",
127 &sysctl_ipfrag_low_thresh
, sizeof(int), 0644, NULL
, &proc_dointvec
},
128 {NET_IPV4_DYNADDR
, "ip_dynaddr",
129 &sysctl_ip_dynaddr
, sizeof(int), 0644, NULL
, &proc_dointvec
},
130 #ifdef CONFIG_IP_MASQUERADE
131 {NET_IPV4_IP_MASQ_DEBUG
, "ip_masq_debug",
132 &sysctl_ip_masq_debug
, sizeof(int), 0644, NULL
, &proc_dointvec
},
134 {NET_IPV4_IPFRAG_TIME
, "ipfrag_time",
135 &sysctl_ipfrag_time
, sizeof(int), 0644, NULL
, &proc_dointvec_jiffies
},
136 {NET_IPV4_TCP_MAX_KA_PROBES
, "tcp_max_ka_probes",
137 &sysctl_tcp_max_ka_probes
, sizeof(int), 0644, NULL
, &proc_dointvec
},
138 {NET_IPV4_TCP_KEEPALIVE_TIME
, "tcp_keepalive_time",
139 &sysctl_tcp_keepalive_time
, sizeof(int), 0644, NULL
,
140 &proc_dointvec_jiffies
},
141 {NET_IPV4_TCP_KEEPALIVE_PROBES
, "tcp_keepalive_probes",
142 &sysctl_tcp_keepalive_probes
, sizeof(int), 0644, NULL
,
144 {NET_IPV4_TCP_RETRIES1
, "tcp_retries1",
145 &sysctl_tcp_retries1
, sizeof(int), 0644, NULL
, &proc_dointvec_minmax
,
146 &sysctl_intvec
, NULL
, NULL
, &tcp_retr1_max
},
147 {NET_IPV4_TCP_RETRIES2
, "tcp_retries2",
148 &sysctl_tcp_retries2
, sizeof(int), 0644, NULL
, &proc_dointvec
},
149 {NET_IPV4_TCP_FIN_TIMEOUT
, "tcp_fin_timeout",
150 &sysctl_tcp_fin_timeout
, sizeof(int), 0644, NULL
,
151 &proc_dointvec_jiffies
},
152 #ifdef CONFIG_SYN_COOKIES
153 {NET_TCP_SYNCOOKIES
, "tcp_syncookies",
154 &sysctl_tcp_syncookies
, sizeof(int), 0644, NULL
, &proc_dointvec
},
156 {NET_TCP_STDURG
, "tcp_stdurg", &sysctl_tcp_stdurg
,
157 sizeof(int), 0644, NULL
, &proc_dointvec
},
158 {NET_TCP_RFC1337
, "tcp_rfc1337", &sysctl_tcp_rfc1337
,
159 sizeof(int), 0644, NULL
, &proc_dointvec
},
160 {NET_TCP_MAX_SYN_BACKLOG
, "tcp_max_syn_backlog", &sysctl_max_syn_backlog
,
161 sizeof(int), 0644, NULL
, &proc_dointvec
},
162 {NET_IPV4_LOCAL_PORT_RANGE
, "ip_local_port_range",
163 &sysctl_local_port_range
, sizeof(sysctl_local_port_range
), 0644,
164 NULL
, &proc_dointvec
},
165 {NET_IPV4_ICMP_ECHO_IGNORE_ALL
, "icmp_echo_ignore_all",
166 &sysctl_icmp_echo_ignore_all
, sizeof(int), 0644, NULL
,
168 {NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS
, "icmp_echo_ignore_broadcasts",
169 &sysctl_icmp_echo_ignore_broadcasts
, sizeof(int), 0644, NULL
,
171 {NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES
, "icmp_ignore_bogus_error_responses",
172 &sysctl_icmp_ignore_bogus_error_responses
, sizeof(int), 0644, NULL
,
174 {NET_IPV4_ICMP_DESTUNREACH_RATE
, "icmp_destunreach_rate",
175 &sysctl_icmp_destunreach_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
176 {NET_IPV4_ICMP_TIMEEXCEED_RATE
, "icmp_timeexceed_rate",
177 &sysctl_icmp_timeexceed_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
178 {NET_IPV4_ICMP_PARAMPROB_RATE
, "icmp_paramprob_rate",
179 &sysctl_icmp_paramprob_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
180 {NET_IPV4_ICMP_ECHOREPLY_RATE
, "icmp_echoreply_rate",
181 &sysctl_icmp_echoreply_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
182 {NET_IPV4_ROUTE
, "route", NULL
, 0, 0555, ipv4_route_table
},
183 #ifdef CONFIG_IP_MULTICAST
184 {NET_IPV4_IGMP_MAX_MEMBERSHIPS
, "igmp_max_memberships",
185 &sysctl_igmp_max_memberships
, sizeof(int), 0644, NULL
, &proc_dointvec
},
190 #endif /* CONFIG_SYSCTL */