diff options
Diffstat (limited to 'include/linux/dccp.h')
-rw-r--r-- | include/linux/dccp.h | 93 |
1 files changed, 61 insertions, 32 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 333c3ea82a5d..aa0737019e37 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -205,6 +205,7 @@ struct dccp_so_feat { | |||
205 | #define DCCP_SOCKOPT_CHANGE_L 3 | 205 | #define DCCP_SOCKOPT_CHANGE_L 3 |
206 | #define DCCP_SOCKOPT_CHANGE_R 4 | 206 | #define DCCP_SOCKOPT_CHANGE_R 4 |
207 | #define DCCP_SOCKOPT_GET_CUR_MPS 5 | 207 | #define DCCP_SOCKOPT_GET_CUR_MPS 5 |
208 | #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 | ||
208 | #define DCCP_SOCKOPT_SEND_CSCOV 10 | 209 | #define DCCP_SOCKOPT_SEND_CSCOV 10 |
209 | #define DCCP_SOCKOPT_RECV_CSCOV 11 | 210 | #define DCCP_SOCKOPT_RECV_CSCOV 11 |
210 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 | 211 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 |
@@ -227,37 +228,50 @@ struct dccp_so_feat { | |||
227 | #include <net/tcp_states.h> | 228 | #include <net/tcp_states.h> |
228 | 229 | ||
229 | enum dccp_state { | 230 | enum dccp_state { |
230 | DCCP_OPEN = TCP_ESTABLISHED, | 231 | DCCP_OPEN = TCP_ESTABLISHED, |
231 | DCCP_REQUESTING = TCP_SYN_SENT, | 232 | DCCP_REQUESTING = TCP_SYN_SENT, |
232 | DCCP_PARTOPEN = TCP_FIN_WAIT1, /* FIXME: | 233 | DCCP_LISTEN = TCP_LISTEN, |
233 | This mapping is horrible, but TCP has | 234 | DCCP_RESPOND = TCP_SYN_RECV, |
234 | no matching state for DCCP_PARTOPEN, | 235 | /* |
235 | as TCP_SYN_RECV is already used by | 236 | * States involved in closing a DCCP connection: |
236 | DCCP_RESPOND, why don't stop using TCP | 237 | * 1) ACTIVE_CLOSEREQ is entered by a server sending a CloseReq. |
237 | mapping of states? OK, now we don't use | 238 | * |
238 | sk_stream_sendmsg anymore, so doesn't | 239 | * 2) CLOSING can have three different meanings (RFC 4340, 8.3): |
239 | seem to exist any reason for us to | 240 | * a. Client has performed active-close, has sent a Close to the server |
240 | do the TCP mapping here */ | 241 | * from state OPEN or PARTOPEN, and is waiting for the final Reset |
241 | DCCP_LISTEN = TCP_LISTEN, | 242 | * (in this case, SOCK_DONE == 1). |
242 | DCCP_RESPOND = TCP_SYN_RECV, | 243 | * b. Client is asked to perform passive-close, by receiving a CloseReq |
243 | DCCP_CLOSING = TCP_CLOSING, | 244 | * in (PART)OPEN state. It sends a Close and waits for final Reset |
244 | DCCP_TIME_WAIT = TCP_TIME_WAIT, | 245 | * (in this case, SOCK_DONE == 0). |
245 | DCCP_CLOSED = TCP_CLOSE, | 246 | * c. Server performs an active-close as in (a), keeps TIMEWAIT state. |
246 | DCCP_MAX_STATES = TCP_MAX_STATES, | 247 | * |
248 | * 3) The following intermediate states are employed to give passively | ||
249 | * closing nodes a chance to process their unread data: | ||
250 | * - PASSIVE_CLOSE (from OPEN => CLOSED) and | ||
251 | * - PASSIVE_CLOSEREQ (from (PART)OPEN to CLOSING; case (b) above). | ||
252 | */ | ||
253 | DCCP_ACTIVE_CLOSEREQ = TCP_FIN_WAIT1, | ||
254 | DCCP_PASSIVE_CLOSE = TCP_CLOSE_WAIT, /* any node receiving a Close */ | ||
255 | DCCP_CLOSING = TCP_CLOSING, | ||
256 | DCCP_TIME_WAIT = TCP_TIME_WAIT, | ||
257 | DCCP_CLOSED = TCP_CLOSE, | ||
258 | DCCP_PARTOPEN = TCP_MAX_STATES, | ||
259 | DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */ | ||
260 | DCCP_MAX_STATES | ||
247 | }; | 261 | }; |
248 | 262 | ||
249 | #define DCCP_STATE_MASK 0xf | 263 | #define DCCP_STATE_MASK 0x1f |
250 | #define DCCP_ACTION_FIN (1<<7) | ||
251 | 264 | ||
252 | enum { | 265 | enum { |
253 | DCCPF_OPEN = TCPF_ESTABLISHED, | 266 | DCCPF_OPEN = TCPF_ESTABLISHED, |
254 | DCCPF_REQUESTING = TCPF_SYN_SENT, | 267 | DCCPF_REQUESTING = TCPF_SYN_SENT, |
255 | DCCPF_PARTOPEN = TCPF_FIN_WAIT1, | 268 | DCCPF_LISTEN = TCPF_LISTEN, |
256 | DCCPF_LISTEN = TCPF_LISTEN, | 269 | DCCPF_RESPOND = TCPF_SYN_RECV, |
257 | DCCPF_RESPOND = TCPF_SYN_RECV, | 270 | DCCPF_ACTIVE_CLOSEREQ = TCPF_FIN_WAIT1, |
258 | DCCPF_CLOSING = TCPF_CLOSING, | 271 | DCCPF_CLOSING = TCPF_CLOSING, |
259 | DCCPF_TIME_WAIT = TCPF_TIME_WAIT, | 272 | DCCPF_TIME_WAIT = TCPF_TIME_WAIT, |
260 | DCCPF_CLOSED = TCPF_CLOSE, | 273 | DCCPF_CLOSED = TCPF_CLOSE, |
274 | DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN), | ||
261 | }; | 275 | }; |
262 | 276 | ||
263 | static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) | 277 | static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) |
@@ -393,13 +407,23 @@ struct dccp_opt_pend { | |||
393 | 407 | ||
394 | extern void dccp_minisock_init(struct dccp_minisock *dmsk); | 408 | extern void dccp_minisock_init(struct dccp_minisock *dmsk); |
395 | 409 | ||
396 | extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); | 410 | /** |
397 | 411 | * struct dccp_request_sock - represent DCCP-specific connection request | |
412 | * @dreq_inet_rsk: structure inherited from | ||
413 | * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) | ||
414 | * @dreq_isr: initial sequence number received on the Request | ||
415 | * @dreq_service: service code present on the Request (there is just one) | ||
416 | * The following two fields are analogous to the ones in dccp_sock: | ||
417 | * @dreq_timestamp_echo: last received timestamp to echo (13.1) | ||
418 | * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo | ||
419 | */ | ||
398 | struct dccp_request_sock { | 420 | struct dccp_request_sock { |
399 | struct inet_request_sock dreq_inet_rsk; | 421 | struct inet_request_sock dreq_inet_rsk; |
400 | __u64 dreq_iss; | 422 | __u64 dreq_iss; |
401 | __u64 dreq_isr; | 423 | __u64 dreq_isr; |
402 | __be32 dreq_service; | 424 | __be32 dreq_service; |
425 | __u32 dreq_timestamp_echo; | ||
426 | __u32 dreq_timestamp_time; | ||
403 | }; | 427 | }; |
404 | 428 | ||
405 | static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) | 429 | static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) |
@@ -409,6 +433,9 @@ static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) | |||
409 | 433 | ||
410 | extern struct inet_timewait_death_row dccp_death_row; | 434 | extern struct inet_timewait_death_row dccp_death_row; |
411 | 435 | ||
436 | extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | ||
437 | struct sk_buff *skb); | ||
438 | |||
412 | struct dccp_options_received { | 439 | struct dccp_options_received { |
413 | u32 dccpor_ndp; /* only 24 bits */ | 440 | u32 dccpor_ndp; /* only 24 bits */ |
414 | u32 dccpor_timestamp; | 441 | u32 dccpor_timestamp; |
@@ -462,8 +489,8 @@ struct dccp_ackvec; | |||
462 | * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss | 489 | * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss |
463 | * @dccps_service - first (passive sock) or unique (active sock) service code | 490 | * @dccps_service - first (passive sock) or unique (active sock) service code |
464 | * @dccps_service_list - second .. last service code on passive socket | 491 | * @dccps_service_list - second .. last service code on passive socket |
465 | * @dccps_timestamp_time - time of latest TIMESTAMP option | ||
466 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option | 492 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option |
493 | * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo | ||
467 | * @dccps_l_ack_ratio - feature-local Ack Ratio | 494 | * @dccps_l_ack_ratio - feature-local Ack Ratio |
468 | * @dccps_r_ack_ratio - feature-remote Ack Ratio | 495 | * @dccps_r_ack_ratio - feature-remote Ack Ratio |
469 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) | 496 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) |
@@ -479,6 +506,7 @@ struct dccp_ackvec; | |||
479 | * @dccps_role - role of this sock, one of %dccp_role | 506 | * @dccps_role - role of this sock, one of %dccp_role |
480 | * @dccps_hc_rx_insert_options - receiver wants to add options when acking | 507 | * @dccps_hc_rx_insert_options - receiver wants to add options when acking |
481 | * @dccps_hc_tx_insert_options - sender wants to add options when sending | 508 | * @dccps_hc_tx_insert_options - sender wants to add options when sending |
509 | * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3) | ||
482 | * @dccps_xmit_timer - timer for when CCID is not ready to send | 510 | * @dccps_xmit_timer - timer for when CCID is not ready to send |
483 | * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) | 511 | * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) |
484 | */ | 512 | */ |
@@ -497,15 +525,15 @@ struct dccp_sock { | |||
497 | __u64 dccps_gsr; | 525 | __u64 dccps_gsr; |
498 | __u64 dccps_gar; | 526 | __u64 dccps_gar; |
499 | __be32 dccps_service; | 527 | __be32 dccps_service; |
528 | __u32 dccps_mss_cache; | ||
500 | struct dccp_service_list *dccps_service_list; | 529 | struct dccp_service_list *dccps_service_list; |
501 | ktime_t dccps_timestamp_time; | ||
502 | __u32 dccps_timestamp_echo; | 530 | __u32 dccps_timestamp_echo; |
531 | __u32 dccps_timestamp_time; | ||
503 | __u16 dccps_l_ack_ratio; | 532 | __u16 dccps_l_ack_ratio; |
504 | __u16 dccps_r_ack_ratio; | 533 | __u16 dccps_r_ack_ratio; |
505 | __u16 dccps_pcslen; | 534 | __u16 dccps_pcslen; |
506 | __u16 dccps_pcrlen; | 535 | __u16 dccps_pcrlen; |
507 | unsigned long dccps_ndp_count; | 536 | unsigned long dccps_ndp_count; |
508 | __u32 dccps_mss_cache; | ||
509 | unsigned long dccps_rate_last; | 537 | unsigned long dccps_rate_last; |
510 | struct dccp_minisock dccps_minisock; | 538 | struct dccp_minisock dccps_minisock; |
511 | struct dccp_ackvec *dccps_hc_rx_ackvec; | 539 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
@@ -515,6 +543,7 @@ struct dccp_sock { | |||
515 | enum dccp_role dccps_role:2; | 543 | enum dccp_role dccps_role:2; |
516 | __u8 dccps_hc_rx_insert_options:1; | 544 | __u8 dccps_hc_rx_insert_options:1; |
517 | __u8 dccps_hc_tx_insert_options:1; | 545 | __u8 dccps_hc_tx_insert_options:1; |
546 | __u8 dccps_server_timewait:1; | ||
518 | struct timer_list dccps_xmit_timer; | 547 | struct timer_list dccps_xmit_timer; |
519 | }; | 548 | }; |
520 | 549 | ||