Lines Matching +full:no +full:- +full:reset +full:- +full:on +full:- +full:init

1 // SPDX-License-Identifier: GPL-2.0-or-later
19 /* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
24 __skb_pull(skb, dccp_hdr(skb)->dccph_doff * 4); in dccp_enqueue_skb()
25 __skb_queue_tail(&sk->sk_receive_queue, skb); in dccp_enqueue_skb()
27 sk->sk_data_ready(sk); in dccp_enqueue_skb()
33 * On receiving Close/CloseReq, both RD/WR shutdown are performed. in dccp_fin()
35 * receiving the closing segment, but there is no guarantee that such in dccp_fin()
38 sk->sk_shutdown = SHUTDOWN_MASK; in dccp_fin()
47 switch (sk->sk_state) { in dccp_rcv_close()
50 * - CLOSED (may be a late or duplicate packet) in dccp_rcv_close()
51 * - PASSIVE_CLOSEREQ (the peer has sent a CloseReq earlier) in dccp_rcv_close()
52 * - RESPOND (already handled by dccp_check_req) in dccp_rcv_close()
56 * Simultaneous-close: receiving a Close after sending one. This in dccp_rcv_close()
57 * can happen if both client and server perform active-close and in dccp_rcv_close()
58 * will result in an endless ping-pong of crossing and retrans- in dccp_rcv_close()
61 * achieved when one of the nodes acts as tie-breaker. in dccp_rcv_close()
65 if (dccp_sk(sk)->dccps_role != DCCP_ROLE_CLIENT) in dccp_rcv_close()
99 if (dccp_sk(sk)->dccps_role != DCCP_ROLE_CLIENT) { in dccp_rcv_closereq()
100 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC); in dccp_rcv_closereq()
105 switch (sk->sk_state) { in dccp_rcv_closereq()
147 u16 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code); in dccp_rcv_reset()
149 sk->sk_err = err; in dccp_rcv_reset()
161 struct dccp_ackvec *av = dccp_sk(sk)->dccps_hc_rx_ackvec; in dccp_handle_ackvec_processing()
165 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) in dccp_handle_ackvec_processing()
166 dccp_ackvec_clear_state(av, DCCP_SKB_CB(skb)->dccpd_ack_seq); in dccp_handle_ackvec_processing()
175 if (!(sk->sk_shutdown & RCV_SHUTDOWN)) in dccp_deliver_input_to_ccids()
176 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); in dccp_deliver_input_to_ccids()
181 if (sk->sk_write_queue.qlen > 0 || !(sk->sk_shutdown & SEND_SHUTDOWN)) in dccp_deliver_input_to_ccids()
182 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb); in dccp_deliver_input_to_ccids()
189 u64 lswl, lawl, seqno = DCCP_SKB_CB(skb)->dccpd_seq, in dccp_check_seqno()
190 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq; in dccp_check_seqno()
204 if (dh->dccph_type == DCCP_PKT_SYNC || in dccp_check_seqno()
205 dh->dccph_type == DCCP_PKT_SYNCACK) { in dccp_check_seqno()
206 if (between48(ackno, dp->dccps_awl, dp->dccps_awh) && in dccp_check_seqno()
207 dccp_delta_seqno(dp->dccps_swl, seqno) >= 0) in dccp_check_seqno()
210 return -1; in dccp_check_seqno()
216 * If P.type == CloseReq or P.type == Close or P.type == Reset, in dccp_check_seqno()
224 lswl = dp->dccps_swl; in dccp_check_seqno()
225 lawl = dp->dccps_awl; in dccp_check_seqno()
227 if (dh->dccph_type == DCCP_PKT_CLOSEREQ || in dccp_check_seqno()
228 dh->dccph_type == DCCP_PKT_CLOSE || in dccp_check_seqno()
229 dh->dccph_type == DCCP_PKT_RESET) { in dccp_check_seqno()
230 lswl = ADD48(dp->dccps_gsr, 1); in dccp_check_seqno()
231 lawl = dp->dccps_gar; in dccp_check_seqno()
234 if (between48(seqno, lswl, dp->dccps_swh) && in dccp_check_seqno()
236 between48(ackno, lawl, dp->dccps_awh))) { in dccp_check_seqno()
239 if (dh->dccph_type != DCCP_PKT_SYNC && in dccp_check_seqno()
241 after48(ackno, dp->dccps_gar)) in dccp_check_seqno()
242 dp->dccps_gar = ackno; in dccp_check_seqno()
248 * If P.type == Reset, in dccp_check_seqno()
254 * These Syncs are rate-limited as per RFC 4340, 7.5.4: in dccp_check_seqno()
257 if (time_before(now, (dp->dccps_rate_last + in dccp_check_seqno()
259 return -1; in dccp_check_seqno()
264 "sending SYNC...\n", dccp_packet_name(dh->dccph_type), in dccp_check_seqno()
266 (unsigned long long) dp->dccps_swh, in dccp_check_seqno()
270 (unsigned long long) dp->dccps_awh); in dccp_check_seqno()
272 dp->dccps_rate_last = now; in dccp_check_seqno()
274 if (dh->dccph_type == DCCP_PKT_RESET) in dccp_check_seqno()
275 seqno = dp->dccps_gsr; in dccp_check_seqno()
277 return -1; in dccp_check_seqno()
288 switch (dccp_hdr(skb)->dccph_type) { in __dccp_rcv_established()
293 * - sk_shutdown == RCV_SHUTDOWN, use Code 1, "Not Listening" in __dccp_rcv_established()
294 * - sk_receive_queue is full, use Code 2, "Receive Buffer" in __dccp_rcv_established()
302 * Step 9: Process Reset in __dccp_rcv_established()
303 * If P.type == Reset, in __dccp_rcv_established()
331 if (dp->dccps_role != DCCP_ROLE_LISTEN) in __dccp_rcv_established()
335 if (dp->dccps_role != DCCP_ROLE_CLIENT) in __dccp_rcv_established()
338 if (dccp_delta_seqno(dp->dccps_osr, in __dccp_rcv_established()
339 DCCP_SKB_CB(skb)->dccpd_seq) >= 0) { in __dccp_rcv_established()
341 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, in __dccp_rcv_established()
346 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, in __dccp_rcv_established()
351 * As with DCCP-Ack packets, DCCP-Sync and DCCP-SyncAck packets in __dccp_rcv_established()
352 * MAY have non-zero-length application data areas, whose in __dccp_rcv_established()
392 * If (P.type == Response or P.type == Reset) in dccp_rcv_request_sent_state_process()
397 * / * Response processing continues in Step 10; Reset in dccp_rcv_request_sent_state_process()
400 if (dh->dccph_type == DCCP_PKT_RESPONSE) { in dccp_rcv_request_sent_state_process()
405 if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, in dccp_rcv_request_sent_state_process()
406 dp->dccps_awl, dp->dccps_awh)) { in dccp_rcv_request_sent_state_process()
409 (unsigned long long)dp->dccps_awl, in dccp_rcv_request_sent_state_process()
410 (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, in dccp_rcv_request_sent_state_process()
411 (unsigned long long)dp->dccps_awh); in dccp_rcv_request_sent_state_process()
417 * dccp_v4_do_rcv() sends a Reset. The Reset code depends on in dccp_rcv_request_sent_state_process()
424 if (likely(dp->dccps_options_received.dccpor_timestamp_echo)) in dccp_rcv_request_sent_state_process()
425 dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp - in dccp_rcv_request_sent_state_process()
426 dp->dccps_options_received.dccpor_timestamp_echo)); in dccp_rcv_request_sent_state_process()
430 WARN_ON(sk->sk_send_head == NULL); in dccp_rcv_request_sent_state_process()
431 kfree_skb(sk->sk_send_head); in dccp_rcv_request_sent_state_process()
432 sk->sk_send_head = NULL; in dccp_rcv_request_sent_state_process()
438 * these settings depend on the local/remote Sequence Window in dccp_rcv_request_sent_state_process()
441 dp->dccps_gsr = dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq; in dccp_rcv_request_sent_state_process()
443 dccp_sync_mss(sk, icsk->icsk_pmtu_cookie); in dccp_rcv_request_sent_state_process()
452 * periodically, and always include any Init Cookie in dccp_rcv_request_sent_state_process()
458 * three-way handshake * / in dccp_rcv_request_sent_state_process()
468 if (dccp_feat_activate_values(sk, &dp->dccps_featneg)) in dccp_rcv_request_sent_state_process()
472 icsk->icsk_af_ops->rebuild_header(sk); in dccp_rcv_request_sent_state_process()
475 sk->sk_state_change(sk); in dccp_rcv_request_sent_state_process()
479 if (sk->sk_write_pending || inet_csk_in_pingpong_mode(sk) || in dccp_rcv_request_sent_state_process()
480 icsk->icsk_accept_queue.rskq_defer_accept) { in dccp_rcv_request_sent_state_process()
486 * to stand against the temptation 8) --ANK in dccp_rcv_request_sent_state_process()
490 * even in the draft, but there is no need for us to in dccp_rcv_request_sent_state_process()
492 * us, also stated in the draft. -acme in dccp_rcv_request_sent_state_process()
498 return -1; in dccp_rcv_request_sent_state_process()
502 /* dccp_v4_do_rcv will send a reset */ in dccp_rcv_request_sent_state_process()
503 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR; in dccp_rcv_request_sent_state_process()
507 DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_ABORTED; in dccp_rcv_request_sent_state_process()
509 * We mark this socket as no longer usable, so that the loop in in dccp_rcv_request_sent_state_process()
513 sk->sk_err = ECOMM; in dccp_rcv_request_sent_state_process()
523 u32 sample = dp->dccps_options_received.dccpor_timestamp_echo; in dccp_rcv_respond_partopen_state_process()
526 switch (dh->dccph_type) { in dccp_rcv_respond_partopen_state_process()
531 if (sk->sk_state == DCCP_RESPOND) in dccp_rcv_respond_partopen_state_process()
546 if (sk->sk_state == DCCP_PARTOPEN) in dccp_rcv_respond_partopen_state_process()
551 long delta = dccp_timestamp() - sample; in dccp_rcv_respond_partopen_state_process()
553 dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * delta); in dccp_rcv_respond_partopen_state_process()
556 dp->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; in dccp_rcv_respond_partopen_state_process()
559 if (dh->dccph_type == DCCP_PKT_DATAACK || in dccp_rcv_respond_partopen_state_process()
560 dh->dccph_type == DCCP_PKT_DATA) { in dccp_rcv_respond_partopen_state_process()
576 const int old_state = sk->sk_state; in dccp_rcv_state_process()
584 * If P.type == Request or P contains a valid Init Cookie option, in dccp_rcv_state_process()
585 * (* Must scan the packet's options to check for Init in dccp_rcv_state_process()
586 * Cookies. Only Init Cookies are processed here, in dccp_rcv_state_process()
588 * scan need only be performed if the endpoint uses Init in dccp_rcv_state_process()
593 * Choose S.ISS (initial seqno) or set from Init Cookies in dccp_rcv_state_process()
595 * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init in dccp_rcv_state_process()
599 * Generate Reset(No Connection) unless P.type == Reset in dccp_rcv_state_process()
602 if (sk->sk_state == DCCP_LISTEN) { in dccp_rcv_state_process()
603 if (dh->dccph_type == DCCP_PKT_REQUEST) { in dccp_rcv_state_process()
609 acceptable = inet_csk(sk)->icsk_af_ops->conn_request(sk, skb) >= 0; in dccp_rcv_state_process()
617 if (dh->dccph_type == DCCP_PKT_RESET) in dccp_rcv_state_process()
620 /* Caller (dccp_v4_do_rcv) will send Reset */ in dccp_rcv_state_process()
621 dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; in dccp_rcv_state_process()
623 } else if (sk->sk_state == DCCP_CLOSED) { in dccp_rcv_state_process()
624 dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; in dccp_rcv_state_process()
629 if (sk->sk_state != DCCP_REQUESTING && dccp_check_seqno(sk, skb)) in dccp_rcv_state_process()
640 if ((dp->dccps_role != DCCP_ROLE_CLIENT && in dccp_rcv_state_process()
641 dh->dccph_type == DCCP_PKT_RESPONSE) || in dccp_rcv_state_process()
642 (dp->dccps_role == DCCP_ROLE_CLIENT && in dccp_rcv_state_process()
643 dh->dccph_type == DCCP_PKT_REQUEST) || in dccp_rcv_state_process()
644 (sk->sk_state == DCCP_RESPOND && dh->dccph_type == DCCP_PKT_DATA)) { in dccp_rcv_state_process()
645 dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNC); in dccp_rcv_state_process()
654 * Step 9: Process Reset in dccp_rcv_state_process()
655 * If P.type == Reset, in dccp_rcv_state_process()
661 if (dh->dccph_type == DCCP_PKT_RESET) { in dccp_rcv_state_process()
664 } else if (dh->dccph_type == DCCP_PKT_CLOSEREQ) { /* Step 13 */ in dccp_rcv_state_process()
668 } else if (dh->dccph_type == DCCP_PKT_CLOSE) { /* Step 14 */ in dccp_rcv_state_process()
674 switch (sk->sk_state) { in dccp_rcv_state_process()
694 if (dh->dccph_type == DCCP_PKT_ACK || in dccp_rcv_state_process()
695 dh->dccph_type == DCCP_PKT_DATAACK) { in dccp_rcv_state_process()
698 sk->sk_state_change(sk); in dccp_rcv_state_process()
702 } else if (unlikely(dh->dccph_type == DCCP_PKT_SYNC)) { in dccp_rcv_state_process()
703 dccp_send_sync(sk, dcb->dccpd_seq, DCCP_PKT_SYNCACK); in dccp_rcv_state_process()
717 * dccp_sample_rtt - Validate and finalise computation of RTT sample
727 delta -= dccp_sk(sk)->dccps_options_received.dccpor_elapsed_time * 10; in dccp_sample_rtt()