2 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
4 * $Id: sysctl_net_ipv4.c,v 1.1.1.4 2003/10/14 08:09:33 sparq 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
;
31 /* From ip_output.c */
32 extern int sysctl_ip_dynaddr
;
35 extern int sysctl_icmp_ratelimit
;
36 extern int sysctl_icmp_ratemask
;
39 extern int sysctl_igmp_max_memberships
;
42 extern int inet_peer_threshold
;
43 extern int inet_peer_minttl
;
44 extern int inet_peer_maxttl
;
45 extern int inet_peer_gc_mintime
;
46 extern int inet_peer_gc_maxtime
;
49 static int tcp_retr1_max
= 255;
50 static int ip_local_port_range_min
[] = { 1, 1 };
51 static int ip_local_port_range_max
[] = { 65535, 65535 };
54 struct ipv4_config ipv4_config
;
56 extern ctl_table ipv4_route_table
[];
61 int ipv4_sysctl_forward(ctl_table
*ctl
, int write
, struct file
* filp
,
62 void *buffer
, size_t *lenp
)
64 int val
= ipv4_devconf
.forwarding
;
67 ret
= proc_dointvec(ctl
, write
, filp
, buffer
, lenp
);
69 if (write
&& ipv4_devconf
.forwarding
!= val
)
70 inet_forward_change();
75 static int ipv4_sysctl_forward_strategy(ctl_table
*table
, int *name
, int nlen
,
76 void *oldval
, size_t *oldlenp
,
77 void *newval
, size_t newlen
,
81 if (newlen
!= sizeof(int))
83 if (get_user(new,(int *)newval
))
85 if (new != ipv4_devconf
.forwarding
)
86 inet_forward_change();
87 return 0; /* caller does change again and handles handles oldval */
90 ctl_table ipv4_table
[] = {
91 {NET_IPV4_TCP_TIMESTAMPS
, "tcp_timestamps",
92 &sysctl_tcp_timestamps
, sizeof(int), 0644, NULL
,
94 {NET_IPV4_TCP_WINDOW_SCALING
, "tcp_window_scaling",
95 &sysctl_tcp_window_scaling
, sizeof(int), 0644, NULL
,
97 {NET_IPV4_TCP_SACK
, "tcp_sack",
98 &sysctl_tcp_sack
, sizeof(int), 0644, NULL
,
100 {NET_IPV4_TCP_RETRANS_COLLAPSE
, "tcp_retrans_collapse",
101 &sysctl_tcp_retrans_collapse
, sizeof(int), 0644, NULL
,
103 {NET_IPV4_FORWARD
, "ip_forward",
104 &ipv4_devconf
.forwarding
, sizeof(int), 0644, NULL
,
105 &ipv4_sysctl_forward
,&ipv4_sysctl_forward_strategy
},
106 {NET_IPV4_DEFAULT_TTL
, "ip_default_ttl",
107 &sysctl_ip_default_ttl
, sizeof(int), 0644, NULL
,
109 {NET_IPV4_AUTOCONFIG
, "ip_autoconfig",
110 &ipv4_config
.autoconfig
, sizeof(int), 0644, NULL
,
112 {NET_IPV4_NO_PMTU_DISC
, "ip_no_pmtu_disc",
113 &ipv4_config
.no_pmtu_disc
, sizeof(int), 0644, NULL
,
115 {NET_IPV4_NONLOCAL_BIND
, "ip_nonlocal_bind",
116 &sysctl_ip_nonlocal_bind
, sizeof(int), 0644, NULL
,
118 {NET_IPV4_TCP_SYN_RETRIES
, "tcp_syn_retries",
119 &sysctl_tcp_syn_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
120 {NET_TCP_SYNACK_RETRIES
, "tcp_synack_retries",
121 &sysctl_tcp_synack_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
122 {NET_TCP_MAX_ORPHANS
, "tcp_max_orphans",
123 &sysctl_tcp_max_orphans
, sizeof(int), 0644, NULL
, &proc_dointvec
},
124 {NET_TCP_MAX_TW_BUCKETS
, "tcp_max_tw_buckets",
125 &sysctl_tcp_max_tw_buckets
, sizeof(int), 0644, NULL
, &proc_dointvec
},
126 {NET_IPV4_IPFRAG_HIGH_THRESH
, "ipfrag_high_thresh",
127 &sysctl_ipfrag_high_thresh
, sizeof(int), 0644, NULL
, &proc_dointvec
},
128 {NET_IPV4_IPFRAG_LOW_THRESH
, "ipfrag_low_thresh",
129 &sysctl_ipfrag_low_thresh
, sizeof(int), 0644, NULL
, &proc_dointvec
},
130 {NET_IPV4_DYNADDR
, "ip_dynaddr",
131 &sysctl_ip_dynaddr
, sizeof(int), 0644, NULL
, &proc_dointvec
},
132 {NET_IPV4_IPFRAG_TIME
, "ipfrag_time",
133 &sysctl_ipfrag_time
, sizeof(int), 0644, NULL
, &proc_dointvec_jiffies
,
135 {NET_IPV4_TCP_KEEPALIVE_TIME
, "tcp_keepalive_time",
136 &sysctl_tcp_keepalive_time
, sizeof(int), 0644, NULL
,
137 &proc_dointvec_jiffies
, &sysctl_jiffies
},
138 {NET_IPV4_TCP_KEEPALIVE_PROBES
, "tcp_keepalive_probes",
139 &sysctl_tcp_keepalive_probes
, sizeof(int), 0644, NULL
,
141 {NET_IPV4_TCP_KEEPALIVE_INTVL
, "tcp_keepalive_intvl",
142 &sysctl_tcp_keepalive_intvl
, sizeof(int), 0644, NULL
,
143 &proc_dointvec_jiffies
, &sysctl_jiffies
},
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
, &sysctl_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_TW_RECYCLE
, "tcp_tw_recycle",
157 &sysctl_tcp_tw_recycle
, sizeof(int), 0644, NULL
, &proc_dointvec
},
158 {NET_TCP_ABORT_ON_OVERFLOW
, "tcp_abort_on_overflow",
159 &sysctl_tcp_abort_on_overflow
, sizeof(int), 0644, NULL
, &proc_dointvec
},
160 {NET_TCP_STDURG
, "tcp_stdurg", &sysctl_tcp_stdurg
,
161 sizeof(int), 0644, NULL
, &proc_dointvec
},
162 {NET_TCP_RFC1337
, "tcp_rfc1337", &sysctl_tcp_rfc1337
,
163 sizeof(int), 0644, NULL
, &proc_dointvec
},
164 {NET_TCP_MAX_SYN_BACKLOG
, "tcp_max_syn_backlog", &sysctl_max_syn_backlog
,
165 sizeof(int), 0644, NULL
, &proc_dointvec
},
166 {NET_IPV4_LOCAL_PORT_RANGE
, "ip_local_port_range",
167 &sysctl_local_port_range
, sizeof(sysctl_local_port_range
), 0644,
168 NULL
, &proc_dointvec_minmax
, &sysctl_intvec
, NULL
,
169 ip_local_port_range_min
, ip_local_port_range_max
},
170 {NET_IPV4_ICMP_ECHO_IGNORE_ALL
, "icmp_echo_ignore_all",
171 &sysctl_icmp_echo_ignore_all
, sizeof(int), 0644, NULL
,
173 {NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS
, "icmp_echo_ignore_broadcasts",
174 &sysctl_icmp_echo_ignore_broadcasts
, sizeof(int), 0644, NULL
,
176 {NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES
, "icmp_ignore_bogus_error_responses",
177 &sysctl_icmp_ignore_bogus_error_responses
, sizeof(int), 0644, NULL
,
179 {NET_IPV4_ROUTE
, "route", NULL
, 0, 0555, ipv4_route_table
},
180 #ifdef CONFIG_IP_MULTICAST
181 {NET_IPV4_IGMP_MAX_MEMBERSHIPS
, "igmp_max_memberships",
182 &sysctl_igmp_max_memberships
, sizeof(int), 0644, NULL
, &proc_dointvec
},
184 {NET_IPV4_INET_PEER_THRESHOLD
, "inet_peer_threshold",
185 &inet_peer_threshold
, sizeof(int), 0644, NULL
, &proc_dointvec
},
186 {NET_IPV4_INET_PEER_MINTTL
, "inet_peer_minttl",
187 &inet_peer_minttl
, sizeof(int), 0644, NULL
,
188 &proc_dointvec_jiffies
, &sysctl_jiffies
},
189 {NET_IPV4_INET_PEER_MAXTTL
, "inet_peer_maxttl",
190 &inet_peer_maxttl
, sizeof(int), 0644, NULL
,
191 &proc_dointvec_jiffies
, &sysctl_jiffies
},
192 {NET_IPV4_INET_PEER_GC_MINTIME
, "inet_peer_gc_mintime",
193 &inet_peer_gc_mintime
, sizeof(int), 0644, NULL
,
194 &proc_dointvec_jiffies
, &sysctl_jiffies
},
195 {NET_IPV4_INET_PEER_GC_MAXTIME
, "inet_peer_gc_maxtime",
196 &inet_peer_gc_maxtime
, sizeof(int), 0644, NULL
,
197 &proc_dointvec_jiffies
, &sysctl_jiffies
},
198 {NET_TCP_ORPHAN_RETRIES
, "tcp_orphan_retries",
199 &sysctl_tcp_orphan_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
200 {NET_TCP_FACK
, "tcp_fack",
201 &sysctl_tcp_fack
, sizeof(int), 0644, NULL
, &proc_dointvec
},
202 {NET_TCP_REORDERING
, "tcp_reordering",
203 &sysctl_tcp_reordering
, sizeof(int), 0644, NULL
, &proc_dointvec
},
204 {NET_TCP_ECN
, "tcp_ecn",
205 &sysctl_tcp_ecn
, sizeof(int), 0644, NULL
, &proc_dointvec
},
206 {NET_TCP_DSACK
, "tcp_dsack",
207 &sysctl_tcp_dsack
, sizeof(int), 0644, NULL
, &proc_dointvec
},
208 {NET_TCP_MEM
, "tcp_mem",
209 &sysctl_tcp_mem
, sizeof(sysctl_tcp_mem
), 0644, NULL
, &proc_dointvec
},
210 {NET_TCP_WMEM
, "tcp_wmem",
211 &sysctl_tcp_wmem
, sizeof(sysctl_tcp_wmem
), 0644, NULL
, &proc_dointvec
},
212 {NET_TCP_RMEM
, "tcp_rmem",
213 &sysctl_tcp_rmem
, sizeof(sysctl_tcp_rmem
), 0644, NULL
, &proc_dointvec
},
214 {NET_TCP_APP_WIN
, "tcp_app_win",
215 &sysctl_tcp_app_win
, sizeof(int), 0644, NULL
, &proc_dointvec
},
216 {NET_TCP_ADV_WIN_SCALE
, "tcp_adv_win_scale",
217 &sysctl_tcp_adv_win_scale
, sizeof(int), 0644, NULL
, &proc_dointvec
},
218 {NET_IPV4_ICMP_RATELIMIT
, "icmp_ratelimit",
219 &sysctl_icmp_ratelimit
, sizeof(int), 0644, NULL
, &proc_dointvec
},
220 {NET_IPV4_ICMP_RATEMASK
, "icmp_ratemask",
221 &sysctl_icmp_ratemask
, sizeof(int), 0644, NULL
, &proc_dointvec
},
222 {NET_TCP_TW_REUSE
, "tcp_tw_reuse",
223 &sysctl_tcp_tw_reuse
, sizeof(int), 0644, NULL
, &proc_dointvec
},
224 {NET_TCP_VEGAS
, "tcp_vegas_cong_avoid",
225 &sysctl_tcp_vegas_cong_avoid
, sizeof(int), 0644, NULL
,
227 {NET_TCP_VEGAS_ALPHA
, "tcp_vegas_alpha",
228 &sysctl_tcp_vegas_alpha
, sizeof(int), 0644, NULL
,
230 {NET_TCP_VEGAS_BETA
, "tcp_vegas_beta",
231 &sysctl_tcp_vegas_beta
, sizeof(int), 0644, NULL
,
233 {NET_TCP_VEGAS_GAMMA
, "tcp_vegas_gamma",
234 &sysctl_tcp_vegas_gamma
, sizeof(int), 0644, NULL
,
239 #endif /* CONFIG_SYSCTL */