input.c (21f130a2370ba837cdfc5204ebe52e7c664fec3d) | input.c (ae31c3399d17b1f7bc1742724f70476b5417744f) |
---|---|
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 | 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 |
19#include "ackvec.h" |
|
19#include "ccid.h" 20#include "dccp.h" 21 22static void dccp_fin(struct sock *sk, struct sk_buff *skb) 23{ 24 sk->sk_shutdown |= RCV_SHUTDOWN; 25 sock_set_flag(sk, SOCK_DONE); 26 __skb_pull(skb, dccp_hdr(skb)->dccph_doff * 4); --- 28 unchanged lines hidden (view full) --- 55 dccp_send_close(sk, 0); 56} 57 58static inline void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb) 59{ 60 struct dccp_sock *dp = dccp_sk(sk); 61 62 if (dp->dccps_options.dccpo_send_ack_vector) | 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 unchanged lines hidden (view full) --- 56 dccp_send_close(sk, 0); 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) |
63 dccp_ackpkts_check_rcv_ackno(dp->dccps_hc_rx_ackpkts, sk, 64 DCCP_SKB_CB(skb)->dccpd_ack_seq); | 64 dccp_ackvec_check_rcv_ackno(dp->dccps_hc_rx_ackvec, sk, 65 DCCP_SKB_CB(skb)->dccpd_ack_seq); |
65} 66 67static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb) 68{ 69 const struct dccp_hdr *dh = dccp_hdr(skb); 70 struct dccp_sock *dp = dccp_sk(sk); 71 u64 lswl, lawl; 72 --- 86 unchanged lines hidden (view full) --- 159 goto discard; 160 161 if (dccp_parse_options(sk, skb)) 162 goto discard; 163 164 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) 165 dccp_event_ack_recv(sk, skb); 166 | 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); 72 u64 lswl, lawl; 73 --- 86 unchanged lines hidden (view full) --- 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 |
167 /* 168 * FIXME: check ECN to see if we should use 169 * DCCP_ACKPKTS_STATE_ECN_MARKED 170 */ 171 if (dp->dccps_options.dccpo_send_ack_vector) { 172 struct dccp_ackpkts *ap = dp->dccps_hc_rx_ackpkts; | 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; |
173 | 173 |
174 if (dccp_ackpkts_add(dp->dccps_hc_rx_ackpkts, sk, 175 DCCP_SKB_CB(skb)->dccpd_seq, 176 DCCP_ACKPKTS_STATE_RECEIVED)) { 177 LIMIT_NETDEBUG(KERN_WARNING "DCCP: acknowledgeable " 178 "packets buffer full!\n"); 179 ap->dccpap_ack_seqno = DCCP_MAX_SEQNO + 1; 180 inet_csk_schedule_ack(sk); 181 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 182 TCP_DELACK_MIN, 183 DCCP_RTO_MAX); 184 goto discard; 185 } 186 187 /* 188 * FIXME: this activation is probably wrong, have to study more 189 * TCP delack machinery and how it fits into DCCP draft, but 190 * for now it kinda "works" 8) 191 */ 192 if (!inet_csk_ack_scheduled(sk)) { 193 inet_csk_schedule_ack(sk); 194 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 5 * HZ, 195 DCCP_RTO_MAX); 196 } 197 } 198 | |
199 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); 200 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb); 201 202 switch (dccp_hdr(skb)->dccph_type) { 203 case DCCP_PKT_DATAACK: 204 case DCCP_PKT_DATA: 205 /* 206 * FIXME: check if sk_receive_queue is full, schedule DATA_DROPPED --- 283 unchanged lines hidden (view full) --- 490 goto discard; 491 492 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) 493 dccp_event_ack_recv(sk, skb); 494 495 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); 496 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb); 497 | 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 /* 181 * FIXME: check if sk_receive_queue is full, schedule DATA_DROPPED --- 283 unchanged lines hidden (view full) --- 465 goto discard; 466 467 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ) 468 dccp_event_ack_recv(sk, skb); 469 470 ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb); 471 ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb); 472 |
498 /* 499 * FIXME: check ECN to see if we should use 500 * DCCP_ACKPKTS_STATE_ECN_MARKED 501 */ 502 if (dp->dccps_options.dccpo_send_ack_vector) { 503 if (dccp_ackpkts_add(dp->dccps_hc_rx_ackpkts, sk, 504 dcb->dccpd_seq, 505 DCCP_ACKPKTS_STATE_RECEIVED)) 506 goto discard; 507 /* 508 * FIXME: this activation is probably wrong, have to 509 * study more TCP delack machinery and how it fits into 510 * DCCP draft, but for now it kinda "works" 8) 511 */ 512 if ((dp->dccps_hc_rx_ackpkts->dccpap_ack_seqno == 513 DCCP_MAX_SEQNO + 1) && 514 !inet_csk_ack_scheduled(sk)) { 515 inet_csk_schedule_ack(sk); 516 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 517 TCP_DELACK_MIN, 518 DCCP_RTO_MAX); 519 } 520 } | 473 if (dp->dccps_options.dccpo_send_ack_vector && 474 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, 475 DCCP_SKB_CB(skb)->dccpd_seq, 476 DCCP_ACKVEC_STATE_RECEIVED)) 477 goto discard; |
521 } 522 523 /* 524 * Step 9: Process Reset 525 * If P.type == Reset, 526 * Tear down connection 527 * S.state := TIMEWAIT 528 * Set TIMEWAIT timer --- 79 unchanged lines hidden --- | 478 } 479 480 /* 481 * Step 9: Process Reset 482 * If P.type == Reset, 483 * Tear down connection 484 * S.state := TIMEWAIT 485 * Set TIMEWAIT timer --- 79 unchanged lines hidden --- |