2 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
4 * $Id: sysctl_net_ipv4.c,v 1.50 2001/10/20 00:00:11 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 extern int sysctl_ip_nonlocal_bind
;
22 extern int sysctl_icmp_echo_ignore_all
;
23 extern int sysctl_icmp_echo_ignore_broadcasts
;
24 extern int sysctl_icmp_ignore_bogus_error_responses
;
26 /* From ip_fragment.c */
27 extern int sysctl_ipfrag_low_thresh
;
28 extern int sysctl_ipfrag_high_thresh
;
29 extern int sysctl_ipfrag_time
;
30 extern int sysctl_ipfrag_secret_interval
;
32 /* From ip_output.c */
33 extern int sysctl_ip_dynaddr
;
36 extern int sysctl_icmp_ratelimit
;
37 extern int sysctl_icmp_ratemask
;
40 extern int sysctl_igmp_max_memberships
;
41 extern int sysctl_igmp_max_msf
;
44 extern int inet_peer_threshold
;
45 extern int inet_peer_minttl
;
46 extern int inet_peer_maxttl
;
47 extern int inet_peer_gc_mintime
;
48 extern int inet_peer_gc_maxtime
;
51 static int tcp_retr1_max
= 255;
52 static int ip_local_port_range_min
[] = { 1, 1 };
53 static int ip_local_port_range_max
[] = { 65535, 65535 };
56 /* From tcp_input.c */
57 extern int sysctl_tcp_westwood
;
59 struct ipv4_config ipv4_config
;
61 extern ctl_table ipv4_route_table
[];
66 int ipv4_sysctl_forward(ctl_table
*ctl
, int write
, struct file
* filp
,
67 void *buffer
, size_t *lenp
)
69 int val
= ipv4_devconf
.forwarding
;
72 ret
= proc_dointvec(ctl
, write
, filp
, buffer
, lenp
);
74 if (write
&& ipv4_devconf
.forwarding
!= val
)
75 inet_forward_change(ipv4_devconf
.forwarding
);
80 static int ipv4_sysctl_forward_strategy(ctl_table
*table
, int *name
, int nlen
,
81 void *oldval
, size_t *oldlenp
,
82 void *newval
, size_t newlen
,
86 if (newlen
!= sizeof(int))
88 if (get_user(new,(int *)newval
))
90 if (new != ipv4_devconf
.forwarding
)
91 inet_forward_change(new);
92 return 0; /* caller does change again and handles handles oldval */
95 ctl_table ipv4_table
[] = {
96 {NET_IPV4_TCP_TIMESTAMPS
, "tcp_timestamps",
97 &sysctl_tcp_timestamps
, sizeof(int), 0644, NULL
,
99 {NET_IPV4_TCP_WINDOW_SCALING
, "tcp_window_scaling",
100 &sysctl_tcp_window_scaling
, sizeof(int), 0644, NULL
,
102 {NET_IPV4_TCP_SACK
, "tcp_sack",
103 &sysctl_tcp_sack
, sizeof(int), 0644, NULL
,
105 {NET_IPV4_TCP_RETRANS_COLLAPSE
, "tcp_retrans_collapse",
106 &sysctl_tcp_retrans_collapse
, sizeof(int), 0644, NULL
,
108 {NET_IPV4_FORWARD
, "ip_forward",
109 &ipv4_devconf
.forwarding
, sizeof(int), 0644, NULL
,
110 &ipv4_sysctl_forward
,&ipv4_sysctl_forward_strategy
},
111 {NET_IPV4_DEFAULT_TTL
, "ip_default_ttl",
112 &sysctl_ip_default_ttl
, sizeof(int), 0644, NULL
,
114 {NET_IPV4_AUTOCONFIG
, "ip_autoconfig",
115 &ipv4_config
.autoconfig
, sizeof(int), 0644, NULL
,
117 {NET_IPV4_NO_PMTU_DISC
, "ip_no_pmtu_disc",
118 &ipv4_config
.no_pmtu_disc
, sizeof(int), 0644, NULL
,
120 {NET_IPV4_NONLOCAL_BIND
, "ip_nonlocal_bind",
121 &sysctl_ip_nonlocal_bind
, sizeof(int), 0644, NULL
,
123 {NET_IPV4_TCP_SYN_RETRIES
, "tcp_syn_retries",
124 &sysctl_tcp_syn_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
125 {NET_TCP_SYNACK_RETRIES
, "tcp_synack_retries",
126 &sysctl_tcp_synack_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
127 {NET_TCP_MAX_ORPHANS
, "tcp_max_orphans",
128 &sysctl_tcp_max_orphans
, sizeof(int), 0644, NULL
, &proc_dointvec
},
129 {NET_TCP_MAX_TW_BUCKETS
, "tcp_max_tw_buckets",
130 &sysctl_tcp_max_tw_buckets
, sizeof(int), 0644, NULL
, &proc_dointvec
},
131 {NET_IPV4_IPFRAG_HIGH_THRESH
, "ipfrag_high_thresh",
132 &sysctl_ipfrag_high_thresh
, sizeof(int), 0644, NULL
, &proc_dointvec
},
133 {NET_IPV4_IPFRAG_LOW_THRESH
, "ipfrag_low_thresh",
134 &sysctl_ipfrag_low_thresh
, sizeof(int), 0644, NULL
, &proc_dointvec
},
135 {NET_IPV4_DYNADDR
, "ip_dynaddr",
136 &sysctl_ip_dynaddr
, sizeof(int), 0644, NULL
, &proc_dointvec
},
137 {NET_IPV4_IPFRAG_TIME
, "ipfrag_time",
138 &sysctl_ipfrag_time
, sizeof(int), 0644, NULL
, &proc_dointvec_jiffies
,
140 {NET_IPV4_TCP_KEEPALIVE_TIME
, "tcp_keepalive_time",
141 &sysctl_tcp_keepalive_time
, sizeof(int), 0644, NULL
,
142 &proc_dointvec_jiffies
, &sysctl_jiffies
},
143 {NET_IPV4_TCP_KEEPALIVE_PROBES
, "tcp_keepalive_probes",
144 &sysctl_tcp_keepalive_probes
, sizeof(int), 0644, NULL
,
146 {NET_IPV4_TCP_KEEPALIVE_INTVL
, "tcp_keepalive_intvl",
147 &sysctl_tcp_keepalive_intvl
, sizeof(int), 0644, NULL
,
148 &proc_dointvec_jiffies
, &sysctl_jiffies
},
149 {NET_IPV4_TCP_RETRIES1
, "tcp_retries1",
150 &sysctl_tcp_retries1
, sizeof(int), 0644, NULL
, &proc_dointvec_minmax
,
151 &sysctl_intvec
, NULL
, NULL
, &tcp_retr1_max
},
152 {NET_IPV4_TCP_RETRIES2
, "tcp_retries2",
153 &sysctl_tcp_retries2
, sizeof(int), 0644, NULL
, &proc_dointvec
},
154 {NET_IPV4_TCP_FIN_TIMEOUT
, "tcp_fin_timeout",
155 &sysctl_tcp_fin_timeout
, sizeof(int), 0644, NULL
,
156 &proc_dointvec_jiffies
, &sysctl_jiffies
},
157 #ifdef CONFIG_SYN_COOKIES
158 {NET_TCP_SYNCOOKIES
, "tcp_syncookies",
159 &sysctl_tcp_syncookies
, sizeof(int), 0644, NULL
, &proc_dointvec
},
161 {NET_TCP_TW_RECYCLE
, "tcp_tw_recycle",
162 &sysctl_tcp_tw_recycle
, sizeof(int), 0644, NULL
, &proc_dointvec
},
163 {NET_TCP_ABORT_ON_OVERFLOW
, "tcp_abort_on_overflow",
164 &sysctl_tcp_abort_on_overflow
, sizeof(int), 0644, NULL
, &proc_dointvec
},
165 {NET_TCP_STDURG
, "tcp_stdurg", &sysctl_tcp_stdurg
,
166 sizeof(int), 0644, NULL
, &proc_dointvec
},
167 {NET_TCP_RFC1337
, "tcp_rfc1337", &sysctl_tcp_rfc1337
,
168 sizeof(int), 0644, NULL
, &proc_dointvec
},
169 {NET_TCP_MAX_SYN_BACKLOG
, "tcp_max_syn_backlog", &sysctl_max_syn_backlog
,
170 sizeof(int), 0644, NULL
, &proc_dointvec
},
171 {NET_IPV4_LOCAL_PORT_RANGE
, "ip_local_port_range",
172 &sysctl_local_port_range
, sizeof(sysctl_local_port_range
), 0644,
173 NULL
, &proc_dointvec_minmax
, &sysctl_intvec
, NULL
,
174 ip_local_port_range_min
, ip_local_port_range_max
},
175 {NET_IPV4_ICMP_ECHO_IGNORE_ALL
, "icmp_echo_ignore_all",
176 &sysctl_icmp_echo_ignore_all
, sizeof(int), 0644, NULL
,
178 {NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS
, "icmp_echo_ignore_broadcasts",
179 &sysctl_icmp_echo_ignore_broadcasts
, sizeof(int), 0644, NULL
,
181 {NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES
, "icmp_ignore_bogus_error_responses",
182 &sysctl_icmp_ignore_bogus_error_responses
, sizeof(int), 0644, NULL
,
184 {NET_IPV4_ROUTE
, "route", NULL
, 0, 0555, ipv4_route_table
},
185 #ifdef CONFIG_IP_MULTICAST
186 {NET_IPV4_IGMP_MAX_MEMBERSHIPS
, "igmp_max_memberships",
187 &sysctl_igmp_max_memberships
, sizeof(int), 0644, NULL
, &proc_dointvec
},
189 {NET_IPV4_IGMP_MAX_MSF
, "igmp_max_msf",
190 &sysctl_igmp_max_msf
, sizeof(int), 0644, NULL
, &proc_dointvec
},
191 {NET_IPV4_INET_PEER_THRESHOLD
, "inet_peer_threshold",
192 &inet_peer_threshold
, sizeof(int), 0644, NULL
, &proc_dointvec
},
193 {NET_IPV4_INET_PEER_MINTTL
, "inet_peer_minttl",
194 &inet_peer_minttl
, sizeof(int), 0644, NULL
,
195 &proc_dointvec_jiffies
, &sysctl_jiffies
},
196 {NET_IPV4_INET_PEER_MAXTTL
, "inet_peer_maxttl",
197 &inet_peer_maxttl
, sizeof(int), 0644, NULL
,
198 &proc_dointvec_jiffies
, &sysctl_jiffies
},
199 {NET_IPV4_INET_PEER_GC_MINTIME
, "inet_peer_gc_mintime",
200 &inet_peer_gc_mintime
, sizeof(int), 0644, NULL
,
201 &proc_dointvec_jiffies
, &sysctl_jiffies
},
202 {NET_IPV4_INET_PEER_GC_MAXTIME
, "inet_peer_gc_maxtime",
203 &inet_peer_gc_maxtime
, sizeof(int), 0644, NULL
,
204 &proc_dointvec_jiffies
, &sysctl_jiffies
},
205 {NET_TCP_ORPHAN_RETRIES
, "tcp_orphan_retries",
206 &sysctl_tcp_orphan_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
207 {NET_TCP_FACK
, "tcp_fack",
208 &sysctl_tcp_fack
, sizeof(int), 0644, NULL
, &proc_dointvec
},
209 {NET_TCP_REORDERING
, "tcp_reordering",
210 &sysctl_tcp_reordering
, sizeof(int), 0644, NULL
, &proc_dointvec
},
211 {NET_TCP_ECN
, "tcp_ecn",
212 &sysctl_tcp_ecn
, sizeof(int), 0644, NULL
, &proc_dointvec
},
213 {NET_TCP_DSACK
, "tcp_dsack",
214 &sysctl_tcp_dsack
, sizeof(int), 0644, NULL
, &proc_dointvec
},
215 {NET_TCP_MEM
, "tcp_mem",
216 &sysctl_tcp_mem
, sizeof(sysctl_tcp_mem
), 0644, NULL
, &proc_dointvec
},
217 {NET_TCP_WMEM
, "tcp_wmem",
218 &sysctl_tcp_wmem
, sizeof(sysctl_tcp_wmem
), 0644, NULL
, &proc_dointvec
},
219 {NET_TCP_RMEM
, "tcp_rmem",
220 &sysctl_tcp_rmem
, sizeof(sysctl_tcp_rmem
), 0644, NULL
, &proc_dointvec
},
221 {NET_TCP_APP_WIN
, "tcp_app_win",
222 &sysctl_tcp_app_win
, sizeof(int), 0644, NULL
, &proc_dointvec
},
223 {NET_TCP_ADV_WIN_SCALE
, "tcp_adv_win_scale",
224 &sysctl_tcp_adv_win_scale
, sizeof(int), 0644, NULL
, &proc_dointvec
},
225 {NET_IPV4_ICMP_RATELIMIT
, "icmp_ratelimit",
226 &sysctl_icmp_ratelimit
, sizeof(int), 0644, NULL
, &proc_dointvec
},
227 {NET_IPV4_ICMP_RATEMASK
, "icmp_ratemask",
228 &sysctl_icmp_ratemask
, sizeof(int), 0644, NULL
, &proc_dointvec
},
229 {NET_IPV4_IPFRAG_SECRET_INTERVAL
, "ipfrag_secret_interval",
230 &sysctl_ipfrag_secret_interval
, sizeof(int), 0644, NULL
, &proc_dointvec_jiffies
,
232 {NET_TCP_TW_REUSE
, "tcp_tw_reuse",
233 &sysctl_tcp_tw_reuse
, sizeof(int), 0644, NULL
, &proc_dointvec
},
234 {NET_TCP_FRTO
, "tcp_frto",
235 &sysctl_tcp_frto
, sizeof(int), 0644, NULL
, &proc_dointvec
},
236 {NET_TCP_LOW_LATENCY
, "tcp_low_latency",
237 &sysctl_tcp_low_latency
, sizeof(int), 0644, NULL
, &proc_dointvec
},
238 {NET_IPV4_IPFRAG_SECRET_INTERVAL
, "ipfrag_secret_interval",
239 &sysctl_ipfrag_secret_interval
, sizeof(int), 0644, NULL
, &proc_dointvec_jiffies
,
241 {NET_TCP_WESTWOOD
, "tcp_westwood",
242 &sysctl_tcp_westwood
, sizeof(int), 0644, NULL
,
244 {NET_TCP_NO_METRICS_SAVE
, "tcp_no_metrics_save",
245 &sysctl_tcp_nometrics_save
, sizeof(int), 0644, NULL
,
247 {NET_TCP_VEGAS
, "tcp_vegas_cong_avoid",
248 &sysctl_tcp_vegas_cong_avoid
, sizeof(int), 0644, NULL
,
250 {NET_TCP_VEGAS_ALPHA
, "tcp_vegas_alpha",
251 &sysctl_tcp_vegas_alpha
, sizeof(int), 0644, NULL
,
253 {NET_TCP_VEGAS_BETA
, "tcp_vegas_beta",
254 &sysctl_tcp_vegas_beta
, sizeof(int), 0644, NULL
,
256 {NET_TCP_VEGAS_GAMMA
, "tcp_vegas_gamma",
257 &sysctl_tcp_vegas_gamma
, sizeof(int), 0644, NULL
,
259 {NET_TCP_BIC
, "tcp_bic",
260 &sysctl_tcp_bic
, sizeof(int), 0644, NULL
,
262 {NET_TCP_BIC_FAST_CONVERGENCE
, "tcp_bic_fast_convergence",
263 &sysctl_tcp_bic_fast_convergence
, sizeof(int), 0644, NULL
,
265 {NET_TCP_BIC_LOW_WINDOW
, "tcp_bic_low_window",
266 &sysctl_tcp_bic_low_window
, sizeof(int), 0644, NULL
,
268 {NET_TCP_DEFAULT_WIN_SCALE
, "tcp_default_win_scale",
269 &sysctl_tcp_default_win_scale
, sizeof(int), 0644, NULL
,
271 {NET_TCP_MODERATE_RCVBUF
, "tcp_moderate_rcvbuf",
272 &sysctl_tcp_moderate_rcvbuf
, sizeof(int), 0644, NULL
,
274 {NET_TCP_BIC_BETA
, "tcp_bic_beta",
275 &sysctl_tcp_bic_beta
, sizeof(int), 0644, NULL
,
280 #endif /* CONFIG_SYSCTL */