aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/input.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-08-13 19:34:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:59:26 -0400
commit7690af3fff7633e40b1b9950eb8489129251d074 (patch)
tree92fa07234a7547c4a7dd74877972b5a291673fcf /net/dccp/input.c
parentc173437669967301facff151bfeb7bae67354e4c (diff)
[DCCP]: Just reflow the source code to fit in 80 columns
Andrew Morton should be happy now 8) Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/input.c')
-rw-r--r--net/dccp/input.c100
1 files changed, 62 insertions, 38 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c
index bdaecde0bde1..4b8638f153a5 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -93,7 +93,8 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
93 */ 93 */
94 if (dh->dccph_type == DCCP_PKT_SYNC || 94 if (dh->dccph_type == DCCP_PKT_SYNC ||
95 dh->dccph_type == DCCP_PKT_SYNCACK) { 95 dh->dccph_type == DCCP_PKT_SYNCACK) {
96 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, dp->dccps_awl, dp->dccps_awh) && 96 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
97 dp->dccps_awl, dp->dccps_awh) &&
97 !before48(DCCP_SKB_CB(skb)->dccpd_seq, dp->dccps_swl)) 98 !before48(DCCP_SKB_CB(skb)->dccpd_seq, dp->dccps_swl))
98 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq); 99 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
99 else 100 else
@@ -122,11 +123,13 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
122 123
123 if (between48(DCCP_SKB_CB(skb)->dccpd_seq, lswl, dp->dccps_swh) && 124 if (between48(DCCP_SKB_CB(skb)->dccpd_seq, lswl, dp->dccps_swh) &&
124 (DCCP_SKB_CB(skb)->dccpd_ack_seq == DCCP_PKT_WITHOUT_ACK_SEQ || 125 (DCCP_SKB_CB(skb)->dccpd_ack_seq == DCCP_PKT_WITHOUT_ACK_SEQ ||
125 between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, lawl, dp->dccps_awh))) { 126 between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
127 lawl, dp->dccps_awh))) {
126 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq); 128 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
127 129
128 if (dh->dccph_type != DCCP_PKT_SYNC && 130 if (dh->dccph_type != DCCP_PKT_SYNC &&
129 DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) 131 (DCCP_SKB_CB(skb)->dccpd_ack_seq !=
132 DCCP_PKT_WITHOUT_ACK_SEQ))
130 dp->dccps_gar = DCCP_SKB_CB(skb)->dccpd_ack_seq; 133 dp->dccps_gar = DCCP_SKB_CB(skb)->dccpd_ack_seq;
131 } else { 134 } else {
132 dccp_pr_debug("Step 6 failed, sending SYNC...\n"); 135 dccp_pr_debug("Step 6 failed, sending SYNC...\n");
@@ -161,10 +164,13 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
161 if (dccp_ackpkts_add(dp->dccps_hc_rx_ackpkts, 164 if (dccp_ackpkts_add(dp->dccps_hc_rx_ackpkts,
162 DCCP_SKB_CB(skb)->dccpd_seq, 165 DCCP_SKB_CB(skb)->dccpd_seq,
163 DCCP_ACKPKTS_STATE_RECEIVED)) { 166 DCCP_ACKPKTS_STATE_RECEIVED)) {
164 LIMIT_NETDEBUG(KERN_INFO "DCCP: acknowledgeable packets buffer full!\n"); 167 LIMIT_NETDEBUG(KERN_INFO "DCCP: acknowledgeable "
168 "packets buffer full!\n");
165 ap->dccpap_ack_seqno = DCCP_MAX_SEQNO + 1; 169 ap->dccpap_ack_seqno = DCCP_MAX_SEQNO + 1;
166 inet_csk_schedule_ack(sk); 170 inet_csk_schedule_ack(sk);
167 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, TCP_DELACK_MIN, TCP_RTO_MAX); 171 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
172 TCP_DELACK_MIN,
173 DCCP_RTO_MAX);
168 goto discard; 174 goto discard;
169 } 175 }
170 176
@@ -175,7 +181,8 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
175 */ 181 */
176 if (!inet_csk_ack_scheduled(sk)) { 182 if (!inet_csk_ack_scheduled(sk)) {
177 inet_csk_schedule_ack(sk); 183 inet_csk_schedule_ack(sk);
178 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 5 * HZ, TCP_RTO_MAX); 184 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 5 * HZ,
185 DCCP_RTO_MAX);
179 } 186 }
180 } 187 }
181 188
@@ -186,8 +193,8 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
186 case DCCP_PKT_DATAACK: 193 case DCCP_PKT_DATAACK:
187 case DCCP_PKT_DATA: 194 case DCCP_PKT_DATA:
188 /* 195 /*
189 * FIXME: check if sk_receive_queue is full, schedule DATA_DROPPED option 196 * FIXME: check if sk_receive_queue is full, schedule DATA_DROPPED
190 * if it is. 197 * option if it is.
191 */ 198 */
192 __skb_pull(skb, dh->dccph_doff * 4); 199 __skb_pull(skb, dh->dccph_doff * 4);
193 __skb_queue_tail(&sk->sk_receive_queue, skb); 200 __skb_queue_tail(&sk->sk_receive_queue, skb);
@@ -272,11 +279,13 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
272 __kfree_skb(sk->sk_send_head); 279 __kfree_skb(sk->sk_send_head);
273 sk->sk_send_head = NULL; 280 sk->sk_send_head = NULL;
274 281
275 if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, dp->dccps_awl, dp->dccps_awh)) { 282 if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
276 dccp_pr_debug("invalid ackno: S.AWL=%llu, P.ackno=%llu, S.AWH=%llu \n", 283 dp->dccps_awl, dp->dccps_awh)) {
277 (unsigned long long) dp->dccps_awl, 284 dccp_pr_debug("invalid ackno: S.AWL=%llu, "
278 (unsigned long long) DCCP_SKB_CB(skb)->dccpd_ack_seq, 285 "P.ackno=%llu, S.AWH=%llu \n",
279 (unsigned long long) dp->dccps_awh); 286 (unsigned long long)dp->dccps_awl,
287 (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq,
288 (unsigned long long)dp->dccps_awh);
280 goto out_invalid_packet; 289 goto out_invalid_packet;
281 } 290 }
282 291
@@ -296,16 +305,17 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
296 /* 305 /*
297 * Step 10: Process REQUEST state (second part) 306 * Step 10: Process REQUEST state (second part)
298 * If S.state == REQUEST, 307 * If S.state == REQUEST,
299 * / * If we get here, P is a valid Response from the server (see 308 * / * If we get here, P is a valid Response from the
300 * Step 4), and we should move to PARTOPEN state. PARTOPEN 309 * server (see Step 4), and we should move to
301 * means send an Ack, don't send Data packets, retransmit 310 * PARTOPEN state. PARTOPEN means send an Ack,
302 * Acks periodically, and always include any Init Cookie from 311 * don't send Data packets, retransmit Acks
303 * the Response * / 312 * periodically, and always include any Init Cookie
313 * from the Response * /
304 * S.state := PARTOPEN 314 * S.state := PARTOPEN
305 * Set PARTOPEN timer 315 * Set PARTOPEN timer
306 * Continue with S.state == PARTOPEN 316 * Continue with S.state == PARTOPEN
307 * / * Step 12 will send the Ack completing the three-way 317 * / * Step 12 will send the Ack completing the
308 * handshake * / 318 * three-way handshake * /
309 */ 319 */
310 dccp_set_state(sk, DCCP_PARTOPEN); 320 dccp_set_state(sk, DCCP_PARTOPEN);
311 321
@@ -341,7 +351,8 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
341 351
342out_invalid_packet: 352out_invalid_packet:
343 return 1; /* dccp_v4_do_rcv will send a reset, but... 353 return 1; /* dccp_v4_do_rcv will send a reset, but...
344 FIXME: the reset code should be DCCP_RESET_CODE_PACKET_ERROR */ 354 FIXME: the reset code should be
355 DCCP_RESET_CODE_PACKET_ERROR */
345} 356}
346 357
347static int dccp_rcv_respond_partopen_state_process(struct sock *sk, 358static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
@@ -358,11 +369,12 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
358 case DCCP_PKT_DATAACK: 369 case DCCP_PKT_DATAACK:
359 case DCCP_PKT_ACK: 370 case DCCP_PKT_ACK:
360 /* 371 /*
361 * FIXME: we should be reseting the PARTOPEN (DELACK) timer here, 372 * FIXME: we should be reseting the PARTOPEN (DELACK) timer
362 * but only if we haven't used the DELACK timer for something else, 373 * here but only if we haven't used the DELACK timer for
363 * like sending a delayed ack for a TIMESTAMP echo, etc, for now 374 * something else, like sending a delayed ack for a TIMESTAMP
364 * were not clearing it, sending an extra ACK when there is nothing 375 * echo, etc, for now were not clearing it, sending an extra
365 * else to do in DELACK is not a big deal after all. 376 * ACK when there is nothing else to do in DELACK is not a big
377 * deal after all.
366 */ 378 */
367 379
368 /* Stop the PARTOPEN timer */ 380 /* Stop the PARTOPEN timer */
@@ -374,7 +386,8 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
374 386
375 if (dh->dccph_type == DCCP_PKT_DATAACK) { 387 if (dh->dccph_type == DCCP_PKT_DATAACK) {
376 dccp_rcv_established(sk, skb, dh, len); 388 dccp_rcv_established(sk, skb, dh, len);
377 queued = 1; /* packet was queued (by dccp_rcv_established) */ 389 queued = 1; /* packet was queued
390 (by dccp_rcv_established) */
378 } 391 }
379 break; 392 break;
380 } 393 }
@@ -399,7 +412,8 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
399 if (dccp_parse_options(sk, skb)) 412 if (dccp_parse_options(sk, skb))
400 goto discard; 413 goto discard;
401 414
402 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) 415 if (DCCP_SKB_CB(skb)->dccpd_ack_seq !=
416 DCCP_PKT_WITHOUT_ACK_SEQ)
403 dccp_event_ack_recv(sk, skb); 417 dccp_event_ack_recv(sk, skb);
404 418
405 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); 419 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
@@ -415,14 +429,17 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
415 DCCP_ACKPKTS_STATE_RECEIVED)) 429 DCCP_ACKPKTS_STATE_RECEIVED))
416 goto discard; 430 goto discard;
417 /* 431 /*
418 * FIXME: this activation is probably wrong, have to study more 432 * FIXME: this activation is probably wrong, have to
419 * TCP delack machinery and how it fits into DCCP draft, but 433 * study more TCP delack machinery and how it fits into
420 * for now it kinda "works" 8) 434 * DCCP draft, but for now it kinda "works" 8)
421 */ 435 */
422 if (dp->dccps_hc_rx_ackpkts->dccpap_ack_seqno == DCCP_MAX_SEQNO + 1 && 436 if ((dp->dccps_hc_rx_ackpkts->dccpap_ack_seqno ==
437 DCCP_MAX_SEQNO + 1) &&
423 !inet_csk_ack_scheduled(sk)) { 438 !inet_csk_ack_scheduled(sk)) {
424 inet_csk_schedule_ack(sk); 439 inet_csk_schedule_ack(sk);
425 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, TCP_DELACK_MIN, TCP_RTO_MAX); 440 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
441 TCP_DELACK_MIN,
442 DCCP_RTO_MAX);
426 } 443 }
427 } 444 }
428 } 445 }
@@ -436,7 +453,10 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
436 * Drop packet and return 453 * Drop packet and return
437 */ 454 */
438 if (dh->dccph_type == DCCP_PKT_RESET) { 455 if (dh->dccph_type == DCCP_PKT_RESET) {
439 /* Queue the equivalent of TCP fin so that dccp_recvmsg exits the loop */ 456 /*
457 * Queue the equivalent of TCP fin so that dccp_recvmsg
458 * exits the loop
459 */
440 dccp_fin(sk, skb); 460 dccp_fin(sk, skb);
441 dccp_time_wait(sk, DCCP_TIME_WAIT, 0); 461 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
442 return 0; 462 return 0;
@@ -450,10 +470,12 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
450 * Drop packet and return 470 * Drop packet and return
451 */ 471 */
452 } else if ((dp->dccps_role != DCCP_ROLE_CLIENT && 472 } else if ((dp->dccps_role != DCCP_ROLE_CLIENT &&
453 (dh->dccph_type == DCCP_PKT_RESPONSE || dh->dccph_type == DCCP_PKT_CLOSEREQ)) || 473 (dh->dccph_type == DCCP_PKT_RESPONSE ||
474 dh->dccph_type == DCCP_PKT_CLOSEREQ)) ||
454 (dp->dccps_role == DCCP_ROLE_CLIENT && 475 (dp->dccps_role == DCCP_ROLE_CLIENT &&
455 dh->dccph_type == DCCP_PKT_REQUEST) || 476 dh->dccph_type == DCCP_PKT_REQUEST) ||
456 (sk->sk_state == DCCP_RESPOND && dh->dccph_type == DCCP_PKT_DATA)) { 477 (sk->sk_state == DCCP_RESPOND &&
478 dh->dccph_type == DCCP_PKT_DATA)) {
457 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq); 479 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq);
458 goto discard; 480 goto discard;
459 } 481 }
@@ -491,11 +513,13 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
491 513
492 case DCCP_RESPOND: 514 case DCCP_RESPOND:
493 case DCCP_PARTOPEN: 515 case DCCP_PARTOPEN:
494 queued = dccp_rcv_respond_partopen_state_process(sk, skb, dh, len); 516 queued = dccp_rcv_respond_partopen_state_process(sk, skb,
517 dh, len);
495 break; 518 break;
496 } 519 }
497 520
498 if (dh->dccph_type == DCCP_PKT_ACK || dh->dccph_type == DCCP_PKT_DATAACK) { 521 if (dh->dccph_type == DCCP_PKT_ACK ||
522 dh->dccph_type == DCCP_PKT_DATAACK) {
499 switch (old_state) { 523 switch (old_state) {
500 case DCCP_PARTOPEN: 524 case DCCP_PARTOPEN:
501 sk->sk_state_change(sk); 525 sk->sk_state_change(sk);