aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/input.c')
-rw-r--r--net/dccp/input.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 7371a2f3acf4..565bc80557ce 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/dccp/input.c 2 * net/dccp/input.c
3 * 3 *
4 * An implementation of the DCCP protocol 4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 * 6 *
@@ -82,7 +82,7 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
82 * Otherwise, 82 * Otherwise,
83 * Drop packet and return 83 * Drop packet and return
84 */ 84 */
85 if (dh->dccph_type == DCCP_PKT_SYNC || 85 if (dh->dccph_type == DCCP_PKT_SYNC ||
86 dh->dccph_type == DCCP_PKT_SYNCACK) { 86 dh->dccph_type == DCCP_PKT_SYNCACK) {
87 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, 87 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
88 dp->dccps_awl, dp->dccps_awh) && 88 dp->dccps_awl, dp->dccps_awh) &&
@@ -185,8 +185,8 @@ static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
185 dccp_rcv_close(sk, skb); 185 dccp_rcv_close(sk, skb);
186 return 0; 186 return 0;
187 case DCCP_PKT_REQUEST: 187 case DCCP_PKT_REQUEST:
188 /* Step 7 188 /* Step 7
189 * or (S.is_server and P.type == Response) 189 * or (S.is_server and P.type == Response)
190 * or (S.is_client and P.type == Request) 190 * or (S.is_client and P.type == Request)
191 * or (S.state >= OPEN and P.type == Request 191 * or (S.state >= OPEN and P.type == Request
192 * and P.seqno >= S.OSR) 192 * and P.seqno >= S.OSR)
@@ -248,8 +248,18 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
248 DCCP_ACKVEC_STATE_RECEIVED)) 248 DCCP_ACKVEC_STATE_RECEIVED))
249 goto discard; 249 goto discard;
250 250
251 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); 251 /*
252 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb); 252 * Deliver to the CCID module in charge.
253 * FIXME: Currently DCCP operates one-directional only, i.e. a listening
254 * server is not at the same time a connecting client. There is
255 * not much sense in delivering to both rx/tx sides at the moment
256 * (only one is active at a time); when moving to bidirectional
257 * service, this needs to be revised.
258 */
259 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER)
260 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
261 else
262 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
253 263
254 return __dccp_rcv_established(sk, skb, dh, len); 264 return __dccp_rcv_established(sk, skb, dh, len);
255discard: 265discard:
@@ -264,7 +274,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
264 const struct dccp_hdr *dh, 274 const struct dccp_hdr *dh,
265 const unsigned len) 275 const unsigned len)
266{ 276{
267 /* 277 /*
268 * Step 4: Prepare sequence numbers in REQUEST 278 * Step 4: Prepare sequence numbers in REQUEST
269 * If S.state == REQUEST, 279 * If S.state == REQUEST,
270 * If (P.type == Response or P.type == Reset) 280 * If (P.type == Response or P.type == Reset)
@@ -332,7 +342,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
332 * from the Response * / 342 * from the Response * /
333 * S.state := PARTOPEN 343 * S.state := PARTOPEN
334 * Set PARTOPEN timer 344 * Set PARTOPEN timer
335 * Continue with S.state == PARTOPEN 345 * Continue with S.state == PARTOPEN
336 * / * Step 12 will send the Ack completing the 346 * / * Step 12 will send the Ack completing the
337 * three-way handshake * / 347 * three-way handshake * /
338 */ 348 */
@@ -363,7 +373,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
363 */ 373 */
364 __kfree_skb(skb); 374 __kfree_skb(skb);
365 return 0; 375 return 0;
366 } 376 }
367 dccp_send_ack(sk); 377 dccp_send_ack(sk);
368 return -1; 378 return -1;
369 } 379 }
@@ -371,7 +381,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
371out_invalid_packet: 381out_invalid_packet:
372 /* dccp_v4_do_rcv will send a reset */ 382 /* dccp_v4_do_rcv will send a reset */
373 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR; 383 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
374 return 1; 384 return 1;
375} 385}
376 386
377static int dccp_rcv_respond_partopen_state_process(struct sock *sk, 387static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
@@ -478,14 +488,17 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
478 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) 488 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
479 dccp_event_ack_recv(sk, skb); 489 dccp_event_ack_recv(sk, skb);
480 490
481 if (dccp_msk(sk)->dccpms_send_ack_vector && 491 if (dccp_msk(sk)->dccpms_send_ack_vector &&
482 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, 492 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
483 DCCP_SKB_CB(skb)->dccpd_seq, 493 DCCP_SKB_CB(skb)->dccpd_seq,
484 DCCP_ACKVEC_STATE_RECEIVED)) 494 DCCP_ACKVEC_STATE_RECEIVED))
485 goto discard; 495 goto discard;
486 496
487 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); 497 /* XXX see the comments in dccp_rcv_established about this */
488 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb); 498 if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER)
499 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
500 else
501 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
489 } 502 }
490 503
491 /* 504 /*
@@ -567,7 +580,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
567 } 580 }
568 } 581 }
569 582
570 if (!queued) { 583 if (!queued) {
571discard: 584discard:
572 __kfree_skb(skb); 585 __kfree_skb(skb);
573 } 586 }