input.c 16 KB

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