2 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
4 * $Id: sysctl_net_ipv4.c,v 1.43 2000/01/16 05:11:27 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_icmp_destunreach_time
;
46 extern int sysctl_icmp_timeexceed_time
;
47 extern int sysctl_icmp_paramprob_time
;
48 extern int sysctl_icmp_echoreply_time
;
51 extern int sysctl_igmp_max_memberships
;
54 extern int inet_peer_threshold
;
55 extern int inet_peer_minttl
;
56 extern int inet_peer_maxttl
;
57 extern int inet_peer_gc_mintime
;
58 extern int inet_peer_gc_maxtime
;
60 int tcp_retr1_max
= 255;
62 struct ipv4_config ipv4_config
;
64 extern ctl_table ipv4_route_table
[];
69 int ipv4_sysctl_forward(ctl_table
*ctl
, int write
, struct file
* filp
,
70 void *buffer
, size_t *lenp
)
72 int val
= ipv4_devconf
.forwarding
;
75 ret
= proc_dointvec(ctl
, write
, filp
, buffer
, lenp
);
77 if (write
&& ipv4_devconf
.forwarding
!= val
)
78 inet_forward_change();
83 static int ipv4_sysctl_forward_strategy(ctl_table
*table
, int *name
, int nlen
,
84 void *oldval
, size_t *oldlenp
,
85 void *newval
, size_t newlen
,
89 if (newlen
!= sizeof(int))
91 if (get_user(new,(int *)newval
))
93 if (new != ipv4_devconf
.forwarding
)
94 inet_forward_change();
95 return 0; /* caller does change again and handles handles oldval */
98 ctl_table ipv4_table
[] = {
99 {NET_IPV4_TCP_TIMESTAMPS
, "tcp_timestamps",
100 &sysctl_tcp_timestamps
, sizeof(int), 0644, NULL
,
102 {NET_IPV4_TCP_WINDOW_SCALING
, "tcp_window_scaling",
103 &sysctl_tcp_window_scaling
, sizeof(int), 0644, NULL
,
105 {NET_IPV4_TCP_SACK
, "tcp_sack",
106 &sysctl_tcp_sack
, sizeof(int), 0644, NULL
,
108 {NET_IPV4_TCP_RETRANS_COLLAPSE
, "tcp_retrans_collapse",
109 &sysctl_tcp_retrans_collapse
, sizeof(int), 0644, NULL
,
111 {NET_IPV4_FORWARD
, "ip_forward",
112 &ipv4_devconf
.forwarding
, sizeof(int), 0644, NULL
,
113 &ipv4_sysctl_forward
,&ipv4_sysctl_forward_strategy
},
114 {NET_IPV4_DEFAULT_TTL
, "ip_default_ttl",
115 &sysctl_ip_default_ttl
, sizeof(int), 0644, NULL
,
117 {NET_IPV4_AUTOCONFIG
, "ip_autoconfig",
118 &ipv4_config
.autoconfig
, sizeof(int), 0644, NULL
,
120 {NET_IPV4_NO_PMTU_DISC
, "ip_no_pmtu_disc",
121 &ipv4_config
.no_pmtu_disc
, 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
},
174 {NET_IPV4_ICMP_ECHO_IGNORE_ALL
, "icmp_echo_ignore_all",
175 &sysctl_icmp_echo_ignore_all
, sizeof(int), 0644, NULL
,
177 {NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS
, "icmp_echo_ignore_broadcasts",
178 &sysctl_icmp_echo_ignore_broadcasts
, sizeof(int), 0644, NULL
,
180 {NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES
, "icmp_ignore_bogus_error_responses",
181 &sysctl_icmp_ignore_bogus_error_responses
, sizeof(int), 0644, NULL
,
183 {NET_IPV4_ICMP_DESTUNREACH_RATE
, "icmp_destunreach_rate",
184 &sysctl_icmp_destunreach_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
185 {NET_IPV4_ICMP_TIMEEXCEED_RATE
, "icmp_timeexceed_rate",
186 &sysctl_icmp_timeexceed_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
187 {NET_IPV4_ICMP_PARAMPROB_RATE
, "icmp_paramprob_rate",
188 &sysctl_icmp_paramprob_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
189 {NET_IPV4_ICMP_ECHOREPLY_RATE
, "icmp_echoreply_rate",
190 &sysctl_icmp_echoreply_time
, sizeof(int), 0644, NULL
, &proc_dointvec
},
191 {NET_IPV4_ROUTE
, "route", NULL
, 0, 0555, ipv4_route_table
},
192 #ifdef CONFIG_IP_MULTICAST
193 {NET_IPV4_IGMP_MAX_MEMBERSHIPS
, "igmp_max_memberships",
194 &sysctl_igmp_max_memberships
, sizeof(int), 0644, NULL
, &proc_dointvec
},
196 {NET_IPV4_INET_PEER_THRESHOLD
, "inet_peer_threshold",
197 &inet_peer_threshold
, sizeof(int), 0644, NULL
, &proc_dointvec
},
198 {NET_IPV4_INET_PEER_MINTTL
, "inet_peer_minttl",
199 &inet_peer_minttl
, sizeof(int), 0644, NULL
,
200 &proc_dointvec_jiffies
, &sysctl_jiffies
},
201 {NET_IPV4_INET_PEER_MAXTTL
, "inet_peer_maxttl",
202 &inet_peer_maxttl
, sizeof(int), 0644, NULL
,
203 &proc_dointvec_jiffies
, &sysctl_jiffies
},
204 {NET_IPV4_INET_PEER_GC_MINTIME
, "inet_peer_gc_mintime",
205 &inet_peer_gc_mintime
, sizeof(int), 0644, NULL
,
206 &proc_dointvec_jiffies
, &sysctl_jiffies
},
207 {NET_IPV4_INET_PEER_GC_MAXTIME
, "inet_peer_gc_maxtime",
208 &inet_peer_gc_maxtime
, sizeof(int), 0644, NULL
,
209 &proc_dointvec_jiffies
, &sysctl_jiffies
},
210 {NET_TCP_ORPHAN_RETRIES
, "tcp_orphan_retries",
211 &sysctl_tcp_orphan_retries
, sizeof(int), 0644, NULL
, &proc_dointvec
},
215 #endif /* CONFIG_SYSCTL */