[DCCP]: Introduce dccp_ipv4_af_ops
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / dccp / input.c
CommitLineData
7c657876
ACM
1/*
2 * net/dccp/input.c
3 *
4 * An implementation of the DCCP protocol
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/config.h>
14#include <linux/dccp.h>
15#include <linux/skbuff.h>
16
17#include <net/sock.h>
18
ae31c339 19#include "ackvec.h"
7c657876
ACM
20#include "ccid.h"
21#include "dccp.h"
22
23static void dccp_fin(struct sock *sk, struct sk_buff *skb)
24{
25 sk->sk_shutdown |= RCV_SHUTDOWN;
26 sock_set_flag(sk, SOCK_DONE);
27 __skb_pull(skb, dccp_hdr(skb)->dccph_doff * 4);
28 __skb_queue_tail(&sk->sk_receive_queue, skb);
29 skb_set_owner_r(skb, sk);
30 sk->sk_data_ready(sk, 0);
31}
32
33static void dccp_rcv_close(struct sock *sk, struct sk_buff *skb)
34{
7ad07e7c
ACM
35 dccp_v4_send_reset(sk, DCCP_RESET_CODE_CLOSED);
36 dccp_fin(sk, skb);
37 dccp_set_state(sk, DCCP_CLOSED);
331968bd 38 sk_wake_async(sk, 1, POLL_HUP);
7c657876
ACM
39}
40
41static void dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
42{
43 /*
44 * Step 7: Check for unexpected packet types
45 * If (S.is_server and P.type == CloseReq)
46 * Send Sync packet acknowledging P.seqno
47 * Drop packet and return
48 */
49 if (dccp_sk(sk)->dccps_role != DCCP_ROLE_CLIENT) {
e92ae93a 50 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC);
7c657876
ACM
51 return;
52 }
53
811265b8
ACM
54 if (sk->sk_state != DCCP_CLOSING)
55 dccp_set_state(sk, DCCP_CLOSING);
7ad07e7c 56 dccp_send_close(sk, 0);
7c657876
ACM
57}
58
59static inline void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
60{
61 struct dccp_sock *dp = dccp_sk(sk);
62
63 if (dp->dccps_options.dccpo_send_ack_vector)
ae31c339
ACM
64 dccp_ackvec_check_rcv_ackno(dp->dccps_hc_rx_ackvec, sk,
65 DCCP_SKB_CB(skb)->dccpd_ack_seq);
7c657876
ACM
66}
67
68static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
69{
70 const struct dccp_hdr *dh = dccp_hdr(skb);
71 struct dccp_sock *dp = dccp_sk(sk);
e92ae93a 72 u64 lswl, lawl;
7c657876
ACM
73
74 /*
75 * Step 5: Prepare sequence numbers for Sync
76 * If P.type == Sync or P.type == SyncAck,
77 * If S.AWL <= P.ackno <= S.AWH and P.seqno >= S.SWL,
78 * / * P is valid, so update sequence number variables
79 * accordingly. After this update, P will pass the tests
80 * in Step 6. A SyncAck is generated if necessary in
81 * Step 15 * /
82 * Update S.GSR, S.SWL, S.SWH
83 * Otherwise,
84 * Drop packet and return
85 */
86 if (dh->dccph_type == DCCP_PKT_SYNC ||
87 dh->dccph_type == DCCP_PKT_SYNCACK) {
7690af3f
ACM
88 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
89 dp->dccps_awl, dp->dccps_awh) &&
7c657876
ACM
90 !before48(DCCP_SKB_CB(skb)->dccpd_seq, dp->dccps_swl))
91 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
92 else
93 return -1;
e92ae93a
ACM
94 }
95
7c657876
ACM
96 /*
97 * Step 6: Check sequence numbers
98 * Let LSWL = S.SWL and LAWL = S.AWL
99 * If P.type == CloseReq or P.type == Close or P.type == Reset,
100 * LSWL := S.GSR + 1, LAWL := S.GAR
101 * If LSWL <= P.seqno <= S.SWH
102 * and (P.ackno does not exist or LAWL <= P.ackno <= S.AWH),
103 * Update S.GSR, S.SWL, S.SWH
104 * If P.type != Sync,
105 * Update S.GAR
106 * Otherwise,
107 * Send Sync packet acknowledging P.seqno
108 * Drop packet and return
109 */
e92ae93a
ACM
110 lswl = dp->dccps_swl;
111 lawl = dp->dccps_awl;
112
113 if (dh->dccph_type == DCCP_PKT_CLOSEREQ ||
c59eab46
ACM
114 dh->dccph_type == DCCP_PKT_CLOSE ||
115 dh->dccph_type == DCCP_PKT_RESET) {
7c657876
ACM
116 lswl = dp->dccps_gsr;
117 dccp_inc_seqno(&lswl);
118 lawl = dp->dccps_gar;
119 }
120
121 if (between48(DCCP_SKB_CB(skb)->dccpd_seq, lswl, dp->dccps_swh) &&
122 (DCCP_SKB_CB(skb)->dccpd_ack_seq == DCCP_PKT_WITHOUT_ACK_SEQ ||
7690af3f
ACM
123 between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
124 lawl, dp->dccps_awh))) {
7c657876
ACM
125 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
126
127 if (dh->dccph_type != DCCP_PKT_SYNC &&
7690af3f
ACM
128 (DCCP_SKB_CB(skb)->dccpd_ack_seq !=
129 DCCP_PKT_WITHOUT_ACK_SEQ))
7c657876
ACM
130 dp->dccps_gar = DCCP_SKB_CB(skb)->dccpd_ack_seq;
131 } else {
a3054d48
ACM
132 LIMIT_NETDEBUG(KERN_WARNING "DCCP: Step 6 failed for %s packet, "
133 "(LSWL(%llu) <= P.seqno(%llu) <= S.SWH(%llu)) and "
134 "(P.ackno %s or LAWL(%llu) <= P.ackno(%llu) <= S.AWH(%llu), "
135 "sending SYNC...\n",
136 dccp_packet_name(dh->dccph_type),
58e45131
DM
137 (unsigned long long) lswl,
138 (unsigned long long)
139 DCCP_SKB_CB(skb)->dccpd_seq,
140 (unsigned long long) dp->dccps_swh,
a3054d48
ACM
141 (DCCP_SKB_CB(skb)->dccpd_ack_seq ==
142 DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist" : "exists",
58e45131
DM
143 (unsigned long long) lawl,
144 (unsigned long long)
145 DCCP_SKB_CB(skb)->dccpd_ack_seq,
146 (unsigned long long) dp->dccps_awh);
e92ae93a 147 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC);
7c657876
ACM
148 return -1;
149 }
150
151 return 0;
152}
153
154int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
155 const struct dccp_hdr *dh, const unsigned len)
156{
157 struct dccp_sock *dp = dccp_sk(sk);
158
159 if (dccp_check_seqno(sk, skb))
160 goto discard;
161
162 if (dccp_parse_options(sk, skb))
163 goto discard;
164
165 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
166 dccp_event_ack_recv(sk, skb);
167
ae31c339
ACM
168 if (dp->dccps_options.dccpo_send_ack_vector &&
169 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
170 DCCP_SKB_CB(skb)->dccpd_seq,
171 DCCP_ACKVEC_STATE_RECEIVED))
172 goto discard;
7c657876
ACM
173
174 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
175 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
176
177 switch (dccp_hdr(skb)->dccph_type) {
178 case DCCP_PKT_DATAACK:
179 case DCCP_PKT_DATA:
180 /*
7690af3f
ACM
181 * FIXME: check if sk_receive_queue is full, schedule DATA_DROPPED
182 * option if it is.
7c657876
ACM
183 */
184 __skb_pull(skb, dh->dccph_doff * 4);
185 __skb_queue_tail(&sk->sk_receive_queue, skb);
186 skb_set_owner_r(skb, sk);
187 sk->sk_data_ready(sk, 0);
188 return 0;
189 case DCCP_PKT_ACK:
190 goto discard;
191 case DCCP_PKT_RESET:
192 /*
193 * Step 9: Process Reset
194 * If P.type == Reset,
195 * Tear down connection
196 * S.state := TIMEWAIT
197 * Set TIMEWAIT timer
198 * Drop packet and return
199 */
200 dccp_fin(sk, skb);
201 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
202 return 0;
203 case DCCP_PKT_CLOSEREQ:
204 dccp_rcv_closereq(sk, skb);
205 goto discard;
206 case DCCP_PKT_CLOSE:
207 dccp_rcv_close(sk, skb);
208 return 0;
209 case DCCP_PKT_REQUEST:
210 /* Step 7
211 * or (S.is_server and P.type == Response)
212 * or (S.is_client and P.type == Request)
213 * or (S.state >= OPEN and P.type == Request
214 * and P.seqno >= S.OSR)
215 * or (S.state >= OPEN and P.type == Response
216 * and P.seqno >= S.OSR)
217 * or (S.state == RESPOND and P.type == Data),
218 * Send Sync packet acknowledging P.seqno
219 * Drop packet and return
220 */
221 if (dp->dccps_role != DCCP_ROLE_LISTEN)
222 goto send_sync;
223 goto check_seq;
224 case DCCP_PKT_RESPONSE:
225 if (dp->dccps_role != DCCP_ROLE_CLIENT)
226 goto send_sync;
227check_seq:
228 if (!before48(DCCP_SKB_CB(skb)->dccpd_seq, dp->dccps_osr)) {
229send_sync:
e92ae93a
ACM
230 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq,
231 DCCP_PKT_SYNC);
7c657876
ACM
232 }
233 break;
e92ae93a
ACM
234 case DCCP_PKT_SYNC:
235 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq,
236 DCCP_PKT_SYNCACK);
237 /*
238 * From the draft:
239 *
240 * As with DCCP-Ack packets, DCCP-Sync and DCCP-SyncAck packets
241 * MAY have non-zero-length application data areas, whose
242 * contents * receivers MUST ignore.
243 */
244 goto discard;
7c657876
ACM
245 }
246
247 DCCP_INC_STATS_BH(DCCP_MIB_INERRS);
248discard:
249 __kfree_skb(skb);
250 return 0;
251}
252
253static int dccp_rcv_request_sent_state_process(struct sock *sk,
254 struct sk_buff *skb,
255 const struct dccp_hdr *dh,
256 const unsigned len)
257{
258 /*
259 * Step 4: Prepare sequence numbers in REQUEST
260 * If S.state == REQUEST,
261 * If (P.type == Response or P.type == Reset)
262 * and S.AWL <= P.ackno <= S.AWH,
263 * / * Set sequence number variables corresponding to the
264 * other endpoint, so P will pass the tests in Step 6 * /
265 * Set S.GSR, S.ISR, S.SWL, S.SWH
266 * / * Response processing continues in Step 10; Reset
267 * processing continues in Step 9 * /
268 */
269 if (dh->dccph_type == DCCP_PKT_RESPONSE) {
270 const struct inet_connection_sock *icsk = inet_csk(sk);
271 struct dccp_sock *dp = dccp_sk(sk);
272
273 /* Stop the REQUEST timer */
274 inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS);
275 BUG_TRAP(sk->sk_send_head != NULL);
276 __kfree_skb(sk->sk_send_head);
277 sk->sk_send_head = NULL;
278
7690af3f
ACM
279 if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
280 dp->dccps_awl, dp->dccps_awh)) {
281 dccp_pr_debug("invalid ackno: S.AWL=%llu, "
282 "P.ackno=%llu, S.AWH=%llu \n",
283 (unsigned long long)dp->dccps_awl,
284 (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq,
285 (unsigned long long)dp->dccps_awh);
7c657876
ACM
286 goto out_invalid_packet;
287 }
288
289 dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq;
03ace394
ACM
290 dccp_update_gsr(sk, dp->dccps_isr);
291 /*
292 * SWL and AWL are initially adjusted so that they are not less than
293 * the initial Sequence Numbers received and sent, respectively:
294 * SWL := max(GSR + 1 - floor(W/4), ISR),
295 * AWL := max(GSS - W' + 1, ISS).
296 * These adjustments MUST be applied only at the beginning of the
297 * connection.
298 *
299 * AWL was adjusted in dccp_v4_connect -acme
300 */
301 dccp_set_seqno(&dp->dccps_swl,
302 max48(dp->dccps_swl, dp->dccps_isr));
7c657876
ACM
303
304 if (ccid_hc_rx_init(dp->dccps_hc_rx_ccid, sk) != 0 ||
305 ccid_hc_tx_init(dp->dccps_hc_tx_ccid, sk) != 0) {
306 ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk);
307 ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk);
308 /* FIXME: send appropriate RESET code */
309 goto out_invalid_packet;
310 }
311
312 dccp_sync_mss(sk, dp->dccps_pmtu_cookie);
313
314 /*
315 * Step 10: Process REQUEST state (second part)
316 * If S.state == REQUEST,
7690af3f
ACM
317 * / * If we get here, P is a valid Response from the
318 * server (see Step 4), and we should move to
319 * PARTOPEN state. PARTOPEN means send an Ack,
320 * don't send Data packets, retransmit Acks
321 * periodically, and always include any Init Cookie
322 * from the Response * /
7c657876
ACM
323 * S.state := PARTOPEN
324 * Set PARTOPEN timer
325 * Continue with S.state == PARTOPEN
7690af3f
ACM
326 * / * Step 12 will send the Ack completing the
327 * three-way handshake * /
7c657876
ACM
328 */
329 dccp_set_state(sk, DCCP_PARTOPEN);
330
331 /* Make sure socket is routed, for correct metrics. */
57cca05a 332 icsk->icsk_af_ops->rebuild_header(sk);
7c657876
ACM
333
334 if (!sock_flag(sk, SOCK_DEAD)) {
335 sk->sk_state_change(sk);
336 sk_wake_async(sk, 0, POLL_OUT);
337 }
338
339 if (sk->sk_write_pending || icsk->icsk_ack.pingpong ||
340 icsk->icsk_accept_queue.rskq_defer_accept) {
341 /* Save one ACK. Data will be ready after
342 * several ticks, if write_pending is set.
343 *
344 * It may be deleted, but with this feature tcpdumps
345 * look so _wonderfully_ clever, that I was not able
346 * to stand against the temptation 8) --ANK
347 */
348 /*
349 * OK, in DCCP we can as well do a similar trick, its
350 * even in the draft, but there is no need for us to
351 * schedule an ack here, as dccp_sendmsg does this for
352 * us, also stated in the draft. -acme
353 */
354 __kfree_skb(skb);
355 return 0;
356 }
357 dccp_send_ack(sk);
358 return -1;
359 }
360
361out_invalid_packet:
0c10c5d9
ACM
362 /* dccp_v4_do_rcv will send a reset */
363 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
364 return 1;
7c657876
ACM
365}
366
367static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
368 struct sk_buff *skb,
369 const struct dccp_hdr *dh,
370 const unsigned len)
371{
372 int queued = 0;
373
374 switch (dh->dccph_type) {
375 case DCCP_PKT_RESET:
376 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
377 break;
2a9bc9bb
ACM
378 case DCCP_PKT_DATA:
379 if (sk->sk_state == DCCP_RESPOND)
380 break;
7c657876
ACM
381 case DCCP_PKT_DATAACK:
382 case DCCP_PKT_ACK:
383 /*
7690af3f
ACM
384 * FIXME: we should be reseting the PARTOPEN (DELACK) timer
385 * here but only if we haven't used the DELACK timer for
386 * something else, like sending a delayed ack for a TIMESTAMP
387 * echo, etc, for now were not clearing it, sending an extra
388 * ACK when there is nothing else to do in DELACK is not a big
389 * deal after all.
7c657876
ACM
390 */
391
392 /* Stop the PARTOPEN timer */
393 if (sk->sk_state == DCCP_PARTOPEN)
394 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
395
396 dccp_sk(sk)->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq;
397 dccp_set_state(sk, DCCP_OPEN);
398
2a9bc9bb
ACM
399 if (dh->dccph_type == DCCP_PKT_DATAACK ||
400 dh->dccph_type == DCCP_PKT_DATA) {
7c657876 401 dccp_rcv_established(sk, skb, dh, len);
7690af3f
ACM
402 queued = 1; /* packet was queued
403 (by dccp_rcv_established) */
7c657876
ACM
404 }
405 break;
406 }
407
408 return queued;
409}
410
411int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
412 struct dccp_hdr *dh, unsigned len)
413{
414 struct dccp_sock *dp = dccp_sk(sk);
0c10c5d9 415 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
7c657876
ACM
416 const int old_state = sk->sk_state;
417 int queued = 0;
418
8649b0d4
ACM
419 /*
420 * Step 3: Process LISTEN state
421 * (Continuing from dccp_v4_do_rcv and dccp_v6_do_rcv)
422 *
423 * If S.state == LISTEN,
424 * If P.type == Request or P contains a valid Init Cookie
425 * option,
426 * * Must scan the packet's options to check for an Init
427 * Cookie. Only the Init Cookie is processed here,
428 * however; other options are processed in Step 8. This
429 * scan need only be performed if the endpoint uses Init
430 * Cookies *
431 * * Generate a new socket and switch to that socket *
432 * Set S := new socket for this port pair
433 * S.state = RESPOND
434 * Choose S.ISS (initial seqno) or set from Init Cookie
435 * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie
436 * Continue with S.state == RESPOND
437 * * A Response packet will be generated in Step 11 *
438 * Otherwise,
439 * Generate Reset(No Connection) unless P.type == Reset
440 * Drop packet and return
441 *
442 * NOTE: the check for the packet types is done in
443 * dccp_rcv_state_process
444 */
445 if (sk->sk_state == DCCP_LISTEN) {
446 if (dh->dccph_type == DCCP_PKT_REQUEST) {
57cca05a
ACM
447 if (inet_csk(sk)->icsk_af_ops->conn_request(sk,
448 skb) < 0)
8649b0d4
ACM
449 return 1;
450
451 /* FIXME: do congestion control initialization */
452 goto discard;
453 }
454 if (dh->dccph_type == DCCP_PKT_RESET)
455 goto discard;
456
0c10c5d9
ACM
457 /* Caller (dccp_v4_do_rcv) will send Reset */
458 dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
8649b0d4
ACM
459 return 1;
460 }
461
462 if (sk->sk_state != DCCP_REQUESTING) {
7c657876
ACM
463 if (dccp_check_seqno(sk, skb))
464 goto discard;
465
466 /*
467 * Step 8: Process options and mark acknowledgeable
468 */
469 if (dccp_parse_options(sk, skb))
470 goto discard;
471
0c10c5d9 472 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
7c657876
ACM
473 dccp_event_ack_recv(sk, skb);
474
475 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
476 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
477
ae31c339
ACM
478 if (dp->dccps_options.dccpo_send_ack_vector &&
479 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
480 DCCP_SKB_CB(skb)->dccpd_seq,
481 DCCP_ACKVEC_STATE_RECEIVED))
482 goto discard;
7c657876
ACM
483 }
484
485 /*
486 * Step 9: Process Reset
487 * If P.type == Reset,
488 * Tear down connection
489 * S.state := TIMEWAIT
490 * Set TIMEWAIT timer
491 * Drop packet and return
492 */
493 if (dh->dccph_type == DCCP_PKT_RESET) {
7690af3f
ACM
494 /*
495 * Queue the equivalent of TCP fin so that dccp_recvmsg
496 * exits the loop
497 */
7c657876
ACM
498 dccp_fin(sk, skb);
499 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
500 return 0;
501 /*
502 * Step 7: Check for unexpected packet types
503 * If (S.is_server and P.type == CloseReq)
504 * or (S.is_server and P.type == Response)
505 * or (S.is_client and P.type == Request)
506 * or (S.state == RESPOND and P.type == Data),
507 * Send Sync packet acknowledging P.seqno
508 * Drop packet and return
509 */
510 } else if ((dp->dccps_role != DCCP_ROLE_CLIENT &&
7690af3f
ACM
511 (dh->dccph_type == DCCP_PKT_RESPONSE ||
512 dh->dccph_type == DCCP_PKT_CLOSEREQ)) ||
7c657876
ACM
513 (dp->dccps_role == DCCP_ROLE_CLIENT &&
514 dh->dccph_type == DCCP_PKT_REQUEST) ||
7690af3f
ACM
515 (sk->sk_state == DCCP_RESPOND &&
516 dh->dccph_type == DCCP_PKT_DATA)) {
0c10c5d9 517 dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNC);
7c657876 518 goto discard;
7ad07e7c
ACM
519 } else if (dh->dccph_type == DCCP_PKT_CLOSEREQ) {
520 dccp_rcv_closereq(sk, skb);
521 goto discard;
522 } else if (dh->dccph_type == DCCP_PKT_CLOSE) {
523 dccp_rcv_close(sk, skb);
524 return 0;
7c657876
ACM
525 }
526
2b80230a 527 if (unlikely(dh->dccph_type == DCCP_PKT_SYNC)) {
0c10c5d9 528 dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNCACK);
2b80230a
ACM
529 goto discard;
530 }
531
7c657876
ACM
532 switch (sk->sk_state) {
533 case DCCP_CLOSED:
0c10c5d9 534 dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
7c657876
ACM
535 return 1;
536
7c657876
ACM
537 case DCCP_REQUESTING:
538 /* FIXME: do congestion control initialization */
539
540 queued = dccp_rcv_request_sent_state_process(sk, skb, dh, len);
541 if (queued >= 0)
542 return queued;
543
544 __kfree_skb(skb);
545 return 0;
546
547 case DCCP_RESPOND:
548 case DCCP_PARTOPEN:
7690af3f
ACM
549 queued = dccp_rcv_respond_partopen_state_process(sk, skb,
550 dh, len);
7c657876
ACM
551 break;
552 }
553
7690af3f
ACM
554 if (dh->dccph_type == DCCP_PKT_ACK ||
555 dh->dccph_type == DCCP_PKT_DATAACK) {
7c657876
ACM
556 switch (old_state) {
557 case DCCP_PARTOPEN:
558 sk->sk_state_change(sk);
559 sk_wake_async(sk, 0, POLL_OUT);
560 break;
561 }
562 }
563
564 if (!queued) {
565discard:
566 __kfree_skb(skb);
567 }
568 return 0;
569}