diff options
Diffstat (limited to 'include/linux/tcp.h')
-rw-r--r-- | include/linux/tcp.h | 190 |
1 files changed, 109 insertions, 81 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 2d36f6db3706..3cc70d1a3504 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
22 | #include <linux/socket.h> | ||
22 | 23 | ||
23 | struct tcphdr { | 24 | struct tcphdr { |
24 | __be16 source; | 25 | __be16 source; |
@@ -51,7 +52,7 @@ struct tcphdr { | |||
51 | #error "Adjust your <asm/byteorder.h> defines" | 52 | #error "Adjust your <asm/byteorder.h> defines" |
52 | #endif | 53 | #endif |
53 | __be16 window; | 54 | __be16 window; |
54 | __be16 check; | 55 | __sum16 check; |
55 | __be16 urg_ptr; | 56 | __be16 urg_ptr; |
56 | }; | 57 | }; |
57 | 58 | ||
@@ -94,6 +95,7 @@ enum { | |||
94 | #define TCP_INFO 11 /* Information about this connection. */ | 95 | #define TCP_INFO 11 /* Information about this connection. */ |
95 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ | 96 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ |
96 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ | 97 | #define TCP_CONGESTION 13 /* Congestion control algorithm */ |
98 | #define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */ | ||
97 | 99 | ||
98 | #define TCPI_OPT_TIMESTAMPS 1 | 100 | #define TCPI_OPT_TIMESTAMPS 1 |
99 | #define TCPI_OPT_SACK 2 | 101 | #define TCPI_OPT_SACK 2 |
@@ -157,6 +159,17 @@ struct tcp_info | |||
157 | __u32 tcpi_total_retrans; | 159 | __u32 tcpi_total_retrans; |
158 | }; | 160 | }; |
159 | 161 | ||
162 | /* for TCP_MD5SIG socket option */ | ||
163 | #define TCP_MD5SIG_MAXKEYLEN 80 | ||
164 | |||
165 | struct tcp_md5sig { | ||
166 | struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ | ||
167 | __u16 __tcpm_pad1; /* zero */ | ||
168 | __u16 tcpm_keylen; /* key length */ | ||
169 | __u32 __tcpm_pad2; /* zero */ | ||
170 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ | ||
171 | }; | ||
172 | |||
160 | #ifdef __KERNEL__ | 173 | #ifdef __KERNEL__ |
161 | 174 | ||
162 | #include <linux/skbuff.h> | 175 | #include <linux/skbuff.h> |
@@ -172,17 +185,17 @@ struct tcp_sack_block_wire { | |||
172 | }; | 185 | }; |
173 | 186 | ||
174 | struct tcp_sack_block { | 187 | struct tcp_sack_block { |
175 | __u32 start_seq; | 188 | u32 start_seq; |
176 | __u32 end_seq; | 189 | u32 end_seq; |
177 | }; | 190 | }; |
178 | 191 | ||
179 | struct tcp_options_received { | 192 | struct tcp_options_received { |
180 | /* PAWS/RTTM data */ | 193 | /* PAWS/RTTM data */ |
181 | long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ | 194 | long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ |
182 | __u32 ts_recent; /* Time stamp to echo next */ | 195 | u32 ts_recent; /* Time stamp to echo next */ |
183 | __u32 rcv_tsval; /* Time stamp value */ | 196 | u32 rcv_tsval; /* Time stamp value */ |
184 | __u32 rcv_tsecr; /* Time stamp echo reply */ | 197 | u32 rcv_tsecr; /* Time stamp echo reply */ |
185 | __u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */ | 198 | u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */ |
186 | tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */ | 199 | tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */ |
187 | dsack : 1, /* D-SACK is scheduled */ | 200 | dsack : 1, /* D-SACK is scheduled */ |
188 | wscale_ok : 1, /* Wscale seen on SYN packet */ | 201 | wscale_ok : 1, /* Wscale seen on SYN packet */ |
@@ -190,16 +203,20 @@ struct tcp_options_received { | |||
190 | snd_wscale : 4, /* Window scaling received from sender */ | 203 | snd_wscale : 4, /* Window scaling received from sender */ |
191 | rcv_wscale : 4; /* Window scaling to send to receiver */ | 204 | rcv_wscale : 4; /* Window scaling to send to receiver */ |
192 | /* SACKs data */ | 205 | /* SACKs data */ |
193 | __u8 eff_sacks; /* Size of SACK array to send with next packet */ | 206 | u8 eff_sacks; /* Size of SACK array to send with next packet */ |
194 | __u8 num_sacks; /* Number of SACK blocks */ | 207 | u8 num_sacks; /* Number of SACK blocks */ |
195 | __u16 user_mss; /* mss requested by user in ioctl */ | 208 | u16 user_mss; /* mss requested by user in ioctl */ |
196 | __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ | 209 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ |
197 | }; | 210 | }; |
198 | 211 | ||
199 | struct tcp_request_sock { | 212 | struct tcp_request_sock { |
200 | struct inet_request_sock req; | 213 | struct inet_request_sock req; |
201 | __u32 rcv_isn; | 214 | #ifdef CONFIG_TCP_MD5SIG |
202 | __u32 snt_isn; | 215 | /* Only used by TCP MD5 Signature so far. */ |
216 | struct tcp_request_sock_ops *af_specific; | ||
217 | #endif | ||
218 | u32 rcv_isn; | ||
219 | u32 snt_isn; | ||
203 | }; | 220 | }; |
204 | 221 | ||
205 | static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) | 222 | static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) |
@@ -210,7 +227,8 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) | |||
210 | struct tcp_sock { | 227 | struct tcp_sock { |
211 | /* inet_connection_sock has to be the first member of tcp_sock */ | 228 | /* inet_connection_sock has to be the first member of tcp_sock */ |
212 | struct inet_connection_sock inet_conn; | 229 | struct inet_connection_sock inet_conn; |
213 | int tcp_header_len; /* Bytes of tcp header to send */ | 230 | u16 tcp_header_len; /* Bytes of tcp header to send */ |
231 | u16 xmit_size_goal; /* Goal for segmenting output packets */ | ||
214 | 232 | ||
215 | /* | 233 | /* |
216 | * Header prediction flags | 234 | * Header prediction flags |
@@ -223,13 +241,13 @@ struct tcp_sock { | |||
223 | * read the code and the spec side by side (and laugh ...) | 241 | * read the code and the spec side by side (and laugh ...) |
224 | * See RFC793 and RFC1122. The RFC writes these in capitals. | 242 | * See RFC793 and RFC1122. The RFC writes these in capitals. |
225 | */ | 243 | */ |
226 | __u32 rcv_nxt; /* What we want to receive next */ | 244 | u32 rcv_nxt; /* What we want to receive next */ |
227 | __u32 snd_nxt; /* Next sequence we send */ | 245 | u32 snd_nxt; /* Next sequence we send */ |
228 | 246 | ||
229 | __u32 snd_una; /* First byte we want an ack for */ | 247 | u32 snd_una; /* First byte we want an ack for */ |
230 | __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ | 248 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ |
231 | __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ | 249 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
232 | __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ | 250 | u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ |
233 | 251 | ||
234 | /* Data for direct copy to user */ | 252 | /* Data for direct copy to user */ |
235 | struct { | 253 | struct { |
@@ -247,32 +265,30 @@ struct tcp_sock { | |||
247 | #endif | 265 | #endif |
248 | } ucopy; | 266 | } ucopy; |
249 | 267 | ||
250 | __u32 snd_wl1; /* Sequence for window update */ | 268 | u32 snd_wl1; /* Sequence for window update */ |
251 | __u32 snd_wnd; /* The window we expect to receive */ | 269 | u32 snd_wnd; /* The window we expect to receive */ |
252 | __u32 max_window; /* Maximal window ever seen from peer */ | 270 | u32 max_window; /* Maximal window ever seen from peer */ |
253 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ | 271 | u32 mss_cache; /* Cached effective mss, not including SACKS */ |
254 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ | ||
255 | /* XXX Two bytes hole, try to pack */ | ||
256 | 272 | ||
257 | __u32 window_clamp; /* Maximal window to advertise */ | 273 | u32 window_clamp; /* Maximal window to advertise */ |
258 | __u32 rcv_ssthresh; /* Current window clamp */ | 274 | u32 rcv_ssthresh; /* Current window clamp */ |
259 | 275 | ||
260 | __u32 frto_highmark; /* snd_nxt when RTO occurred */ | 276 | u32 frto_highmark; /* snd_nxt when RTO occurred */ |
261 | __u8 reordering; /* Packet reordering metric. */ | 277 | u8 reordering; /* Packet reordering metric. */ |
262 | __u8 frto_counter; /* Number of new acks after RTO */ | 278 | u8 frto_counter; /* Number of new acks after RTO */ |
263 | __u8 nonagle; /* Disable Nagle algorithm? */ | 279 | u8 nonagle; /* Disable Nagle algorithm? */ |
264 | __u8 keepalive_probes; /* num of allowed keep alive probes */ | 280 | u8 keepalive_probes; /* num of allowed keep alive probes */ |
265 | 281 | ||
266 | /* RTT measurement */ | 282 | /* RTT measurement */ |
267 | __u32 srtt; /* smoothed round trip time << 3 */ | 283 | u32 srtt; /* smoothed round trip time << 3 */ |
268 | __u32 mdev; /* medium deviation */ | 284 | u32 mdev; /* medium deviation */ |
269 | __u32 mdev_max; /* maximal mdev for the last rtt period */ | 285 | u32 mdev_max; /* maximal mdev for the last rtt period */ |
270 | __u32 rttvar; /* smoothed mdev_max */ | 286 | u32 rttvar; /* smoothed mdev_max */ |
271 | __u32 rtt_seq; /* sequence number to update rttvar */ | 287 | u32 rtt_seq; /* sequence number to update rttvar */ |
272 | 288 | ||
273 | __u32 packets_out; /* Packets which are "in flight" */ | 289 | u32 packets_out; /* Packets which are "in flight" */ |
274 | __u32 left_out; /* Packets which leaved network */ | 290 | u32 left_out; /* Packets which leaved network */ |
275 | __u32 retrans_out; /* Retransmitted packets out */ | 291 | u32 retrans_out; /* Retransmitted packets out */ |
276 | /* | 292 | /* |
277 | * Options received (usually on last packet, some only on SYN packets). | 293 | * Options received (usually on last packet, some only on SYN packets). |
278 | */ | 294 | */ |
@@ -281,20 +297,20 @@ struct tcp_sock { | |||
281 | /* | 297 | /* |
282 | * Slow start and congestion control (see also Nagle, and Karn & Partridge) | 298 | * Slow start and congestion control (see also Nagle, and Karn & Partridge) |
283 | */ | 299 | */ |
284 | __u32 snd_ssthresh; /* Slow start size threshold */ | 300 | u32 snd_ssthresh; /* Slow start size threshold */ |
285 | __u32 snd_cwnd; /* Sending congestion window */ | 301 | u32 snd_cwnd; /* Sending congestion window */ |
286 | __u16 snd_cwnd_cnt; /* Linear increase counter */ | 302 | u16 snd_cwnd_cnt; /* Linear increase counter */ |
287 | __u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ | 303 | u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ |
288 | __u32 snd_cwnd_used; | 304 | u32 snd_cwnd_used; |
289 | __u32 snd_cwnd_stamp; | 305 | u32 snd_cwnd_stamp; |
290 | 306 | ||
291 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | 307 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ |
292 | 308 | ||
293 | __u32 rcv_wnd; /* Current receiver window */ | 309 | u32 rcv_wnd; /* Current receiver window */ |
294 | __u32 rcv_wup; /* rcv_nxt on last window update sent */ | 310 | u32 rcv_wup; /* rcv_nxt on last window update sent */ |
295 | __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ | 311 | u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ |
296 | __u32 pushed_seq; /* Last pushed seq, required to talk to windows */ | 312 | u32 pushed_seq; /* Last pushed seq, required to talk to windows */ |
297 | __u32 copied_seq; /* Head of yet unread data */ | 313 | u32 copied_seq; /* Head of yet unread data */ |
298 | 314 | ||
299 | /* SACKs data */ | 315 | /* SACKs data */ |
300 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 316 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |
@@ -315,26 +331,26 @@ struct tcp_sock { | |||
315 | int retransmit_cnt_hint; | 331 | int retransmit_cnt_hint; |
316 | int forward_cnt_hint; | 332 | int forward_cnt_hint; |
317 | 333 | ||
318 | __u16 advmss; /* Advertised MSS */ | 334 | u16 advmss; /* Advertised MSS */ |
319 | __u16 prior_ssthresh; /* ssthresh saved at recovery start */ | 335 | u16 prior_ssthresh; /* ssthresh saved at recovery start */ |
320 | __u32 lost_out; /* Lost packets */ | 336 | u32 lost_out; /* Lost packets */ |
321 | __u32 sacked_out; /* SACK'd packets */ | 337 | u32 sacked_out; /* SACK'd packets */ |
322 | __u32 fackets_out; /* FACK'd packets */ | 338 | u32 fackets_out; /* FACK'd packets */ |
323 | __u32 high_seq; /* snd_nxt at onset of congestion */ | 339 | u32 high_seq; /* snd_nxt at onset of congestion */ |
324 | 340 | ||
325 | __u32 retrans_stamp; /* Timestamp of the last retransmit, | 341 | u32 retrans_stamp; /* Timestamp of the last retransmit, |
326 | * also used in SYN-SENT to remember stamp of | 342 | * also used in SYN-SENT to remember stamp of |
327 | * the first SYN. */ | 343 | * the first SYN. */ |
328 | __u32 undo_marker; /* tracking retrans started here. */ | 344 | u32 undo_marker; /* tracking retrans started here. */ |
329 | int undo_retrans; /* number of undoable retransmissions. */ | 345 | int undo_retrans; /* number of undoable retransmissions. */ |
330 | __u32 urg_seq; /* Seq of received urgent pointer */ | 346 | u32 urg_seq; /* Seq of received urgent pointer */ |
331 | __u16 urg_data; /* Saved octet of OOB data and control flags */ | 347 | u16 urg_data; /* Saved octet of OOB data and control flags */ |
332 | __u8 urg_mode; /* In urgent mode */ | 348 | u8 urg_mode; /* In urgent mode */ |
333 | __u8 ecn_flags; /* ECN status bits. */ | 349 | u8 ecn_flags; /* ECN status bits. */ |
334 | __u32 snd_up; /* Urgent pointer */ | 350 | u32 snd_up; /* Urgent pointer */ |
335 | 351 | ||
336 | __u32 total_retrans; /* Total retransmits for entire connection */ | 352 | u32 total_retrans; /* Total retransmits for entire connection */ |
337 | __u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ | 353 | u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ |
338 | 354 | ||
339 | unsigned int keepalive_time; /* time before keep alive takes place */ | 355 | unsigned int keepalive_time; /* time before keep alive takes place */ |
340 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ | 356 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ |
@@ -342,27 +358,35 @@ struct tcp_sock { | |||
342 | 358 | ||
343 | unsigned long last_synq_overflow; | 359 | unsigned long last_synq_overflow; |
344 | 360 | ||
345 | __u32 tso_deferred; | 361 | u32 tso_deferred; |
346 | 362 | ||
347 | /* Receiver side RTT estimation */ | 363 | /* Receiver side RTT estimation */ |
348 | struct { | 364 | struct { |
349 | __u32 rtt; | 365 | u32 rtt; |
350 | __u32 seq; | 366 | u32 seq; |
351 | __u32 time; | 367 | u32 time; |
352 | } rcv_rtt_est; | 368 | } rcv_rtt_est; |
353 | 369 | ||
354 | /* Receiver queue space */ | 370 | /* Receiver queue space */ |
355 | struct { | 371 | struct { |
356 | int space; | 372 | int space; |
357 | __u32 seq; | 373 | u32 seq; |
358 | __u32 time; | 374 | u32 time; |
359 | } rcvq_space; | 375 | } rcvq_space; |
360 | 376 | ||
361 | /* TCP-specific MTU probe information. */ | 377 | /* TCP-specific MTU probe information. */ |
362 | struct { | 378 | struct { |
363 | __u32 probe_seq_start; | 379 | u32 probe_seq_start; |
364 | __u32 probe_seq_end; | 380 | u32 probe_seq_end; |
365 | } mtu_probe; | 381 | } mtu_probe; |
382 | |||
383 | #ifdef CONFIG_TCP_MD5SIG | ||
384 | /* TCP AF-Specific parts; only used by MD5 Signature support so far */ | ||
385 | struct tcp_sock_af_ops *af_specific; | ||
386 | |||
387 | /* TCP MD5 Signagure Option information */ | ||
388 | struct tcp_md5sig_info *md5sig_info; | ||
389 | #endif | ||
366 | }; | 390 | }; |
367 | 391 | ||
368 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) | 392 | static inline struct tcp_sock *tcp_sk(const struct sock *sk) |
@@ -372,11 +396,15 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk) | |||
372 | 396 | ||
373 | struct tcp_timewait_sock { | 397 | struct tcp_timewait_sock { |
374 | struct inet_timewait_sock tw_sk; | 398 | struct inet_timewait_sock tw_sk; |
375 | __u32 tw_rcv_nxt; | 399 | u32 tw_rcv_nxt; |
376 | __u32 tw_snd_nxt; | 400 | u32 tw_snd_nxt; |
377 | __u32 tw_rcv_wnd; | 401 | u32 tw_rcv_wnd; |
378 | __u32 tw_ts_recent; | 402 | u32 tw_ts_recent; |
379 | long tw_ts_recent_stamp; | 403 | long tw_ts_recent_stamp; |
404 | #ifdef CONFIG_TCP_MD5SIG | ||
405 | u16 tw_md5_keylen; | ||
406 | u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN]; | ||
407 | #endif | ||
380 | }; | 408 | }; |
381 | 409 | ||
382 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | 410 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) |