[DCCP]: Just reflow the source code to fit in 80 columns
Andrew Morton should be happy now 8) Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c173437669
commit
7690af3fff
@ -30,21 +30,26 @@ struct ccid {
|
||||
int (*ccid_hc_tx_init)(struct sock *sk);
|
||||
void (*ccid_hc_rx_exit)(struct sock *sk);
|
||||
void (*ccid_hc_tx_exit)(struct sock *sk);
|
||||
void (*ccid_hc_rx_packet_recv)(struct sock *sk, struct sk_buff *skb);
|
||||
void (*ccid_hc_rx_packet_recv)(struct sock *sk,
|
||||
struct sk_buff *skb);
|
||||
int (*ccid_hc_rx_parse_options)(struct sock *sk,
|
||||
unsigned char option,
|
||||
unsigned char len, u16 idx,
|
||||
unsigned char* value);
|
||||
void (*ccid_hc_rx_insert_options)(struct sock *sk, struct sk_buff *skb);
|
||||
void (*ccid_hc_tx_insert_options)(struct sock *sk, struct sk_buff *skb);
|
||||
void (*ccid_hc_tx_packet_recv)(struct sock *sk, struct sk_buff *skb);
|
||||
void (*ccid_hc_rx_insert_options)(struct sock *sk,
|
||||
struct sk_buff *skb);
|
||||
void (*ccid_hc_tx_insert_options)(struct sock *sk,
|
||||
struct sk_buff *skb);
|
||||
void (*ccid_hc_tx_packet_recv)(struct sock *sk,
|
||||
struct sk_buff *skb);
|
||||
int (*ccid_hc_tx_parse_options)(struct sock *sk,
|
||||
unsigned char option,
|
||||
unsigned char len, u16 idx,
|
||||
unsigned char* value);
|
||||
int (*ccid_hc_tx_send_packet)(struct sock *sk,
|
||||
struct sk_buff *skb, int len);
|
||||
void (*ccid_hc_tx_packet_sent)(struct sock *sk, int more, int len);
|
||||
void (*ccid_hc_tx_packet_sent)(struct sock *sk, int more,
|
||||
int len);
|
||||
};
|
||||
|
||||
extern int ccid_register(struct ccid *ccid);
|
||||
@ -123,7 +128,8 @@ static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk,
|
||||
{
|
||||
int rc = 0;
|
||||
if (ccid->ccid_hc_tx_parse_options != NULL)
|
||||
rc = ccid->ccid_hc_tx_parse_options(sk, option, len, idx, value);
|
||||
rc = ccid->ccid_hc_tx_parse_options(sk, option, len, idx,
|
||||
value);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,8 @@ extern int dccp_debug;
|
||||
do { if (dccp_debug) \
|
||||
printk(KERN_DEBUG "%s: " format, __FUNCTION__ , ##a); \
|
||||
} while (0)
|
||||
#define dccp_pr_debug_cat(format, a...) do { if (dccp_debug) printk(format, ##a); } while (0)
|
||||
#define dccp_pr_debug_cat(format, a...) do { if (dccp_debug) \
|
||||
printk(format, ##a); } while (0)
|
||||
#else
|
||||
#define dccp_pr_debug(format, a...)
|
||||
#define dccp_pr_debug_cat(format, a...)
|
||||
@ -72,7 +73,8 @@ static inline const int after48(const u64 seq1, const u64 seq2)
|
||||
}
|
||||
|
||||
/* is seq2 <= seq1 <= seq3 ? */
|
||||
static inline const int between48(const u64 seq1, const u64 seq2, const u64 seq3)
|
||||
static inline const int between48(const u64 seq1, const u64 seq2,
|
||||
const u64 seq3)
|
||||
{
|
||||
return (seq3 << 16) - (seq2 << 16) >= (seq1 << 16) - (seq2 << 16);
|
||||
}
|
||||
@ -107,12 +109,14 @@ struct dccp_mib {
|
||||
} __SNMP_MIB_ALIGN__;
|
||||
|
||||
DECLARE_SNMP_STAT(struct dccp_mib, dccp_statistics);
|
||||
#define DCCP_INC_STATS(field) SNMP_INC_STATS(dccp_statistics, field)
|
||||
#define DCCP_INC_STATS_BH(field) SNMP_INC_STATS_BH(dccp_statistics, field)
|
||||
#define DCCP_INC_STATS_USER(field) SNMP_INC_STATS_USER(dccp_statistics, field)
|
||||
#define DCCP_DEC_STATS(field) SNMP_DEC_STATS(dccp_statistics, field)
|
||||
#define DCCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(dccp_statistics, field, val)
|
||||
#define DCCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(dccp_statistics, field, val)
|
||||
#define DCCP_INC_STATS(field) SNMP_INC_STATS(dccp_statistics, field)
|
||||
#define DCCP_INC_STATS_BH(field) SNMP_INC_STATS_BH(dccp_statistics, field)
|
||||
#define DCCP_INC_STATS_USER(field) SNMP_INC_STATS_USER(dccp_statistics, field)
|
||||
#define DCCP_DEC_STATS(field) SNMP_DEC_STATS(dccp_statistics, field)
|
||||
#define DCCP_ADD_STATS_BH(field, val) \
|
||||
SNMP_ADD_STATS_BH(dccp_statistics, field, val)
|
||||
#define DCCP_ADD_STATS_USER(field, val) \
|
||||
SNMP_ADD_STATS_USER(dccp_statistics, field, val)
|
||||
|
||||
extern int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb);
|
||||
extern int dccp_retransmit_skb(struct sock *sk, struct sk_buff *skb);
|
||||
@ -234,8 +238,8 @@ extern int dccp_disconnect(struct sock *sk, int flags);
|
||||
extern int dccp_getsockopt(struct sock *sk, int level, int optname,
|
||||
char *optval, int *optlen);
|
||||
extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg);
|
||||
extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
||||
size_t size);
|
||||
extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk,
|
||||
struct msghdr *msg, size_t size);
|
||||
extern int dccp_recvmsg(struct kiocb *iocb, struct sock *sk,
|
||||
struct msghdr *msg, size_t len, int nonblock,
|
||||
int flags, int *addr_len);
|
||||
@ -246,7 +250,8 @@ extern void dccp_shutdown(struct sock *sk, int how);
|
||||
extern int dccp_v4_checksum(const struct sk_buff *skb,
|
||||
const u32 saddr, const u32 daddr);
|
||||
|
||||
extern int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code);
|
||||
extern int dccp_v4_send_reset(struct sock *sk,
|
||||
enum dccp_reset_codes code);
|
||||
extern void dccp_send_close(struct sock *sk);
|
||||
|
||||
struct dccp_skb_cb {
|
||||
@ -303,7 +308,8 @@ static inline void dccp_inc_seqno(u64 *seqno)
|
||||
|
||||
static inline void dccp_hdr_set_seq(struct dccp_hdr *dh, const u64 gss)
|
||||
{
|
||||
struct dccp_hdr_ext *dhx = (struct dccp_hdr_ext *)((void *)dh + sizeof(*dh));
|
||||
struct dccp_hdr_ext *dhx = (struct dccp_hdr_ext *)((void *)dh +
|
||||
sizeof(*dh));
|
||||
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
dh->dccph_seq = htonl((gss >> 32)) >> 8;
|
||||
@ -315,7 +321,8 @@ static inline void dccp_hdr_set_seq(struct dccp_hdr *dh, const u64 gss)
|
||||
dhx->dccph_seq_low = htonl(gss & 0xffffffff);
|
||||
}
|
||||
|
||||
static inline void dccp_hdr_set_ack(struct dccp_hdr_ack_bits *dhack, const u64 gsr)
|
||||
static inline void dccp_hdr_set_ack(struct dccp_hdr_ack_bits *dhack,
|
||||
const u64 gsr)
|
||||
{
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
dhack->dccph_ack_nr_high = htonl((gsr >> 32)) >> 8;
|
||||
@ -332,11 +339,14 @@ static inline void dccp_update_gsr(struct sock *sk, u64 seq)
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
u64 tmp_gsr;
|
||||
|
||||
dccp_set_seqno(&tmp_gsr, dp->dccps_gsr + 1 - (dp->dccps_options.dccpo_sequence_window / 4));
|
||||
dccp_set_seqno(&tmp_gsr,
|
||||
(dp->dccps_gsr + 1 -
|
||||
(dp->dccps_options.dccpo_sequence_window / 4)));
|
||||
dp->dccps_gsr = seq;
|
||||
dccp_set_seqno(&dp->dccps_swl, max48(tmp_gsr, dp->dccps_isr));
|
||||
dccp_set_seqno(&dp->dccps_swh,
|
||||
dp->dccps_gsr + (3 * dp->dccps_options.dccpo_sequence_window) / 4);
|
||||
(dp->dccps_gsr +
|
||||
(3 * dp->dccps_options.dccpo_sequence_window) / 4));
|
||||
}
|
||||
|
||||
static inline void dccp_update_gss(struct sock *sk, u64 seq)
|
||||
@ -344,7 +354,9 @@ static inline void dccp_update_gss(struct sock *sk, u64 seq)
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
u64 tmp_gss;
|
||||
|
||||
dccp_set_seqno(&tmp_gss, dp->dccps_gss - dp->dccps_options.dccpo_sequence_window + 1);
|
||||
dccp_set_seqno(&tmp_gss,
|
||||
(dp->dccps_gss -
|
||||
dp->dccps_options.dccpo_sequence_window + 1));
|
||||
dp->dccps_awl = max48(tmp_gss, dp->dccps_iss);
|
||||
dp->dccps_awh = dp->dccps_gss = seq;
|
||||
}
|
||||
@ -373,16 +385,20 @@ extern struct socket *dccp_ctl_socket;
|
||||
*
|
||||
* @dccpap_buf_head - circular buffer head
|
||||
* @dccpap_buf_tail - circular buffer tail
|
||||
* @dccpap_buf_ackno - ack # of the most recent packet acknoldgeable in the buffer (i.e. %dccpap_buf_head)
|
||||
* @dccpap_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked by the buffer with State 0
|
||||
* @dccpap_buf_ackno - ack # of the most recent packet acknowledgeable in the
|
||||
* buffer (i.e. %dccpap_buf_head)
|
||||
* @dccpap_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked
|
||||
* by the buffer with State 0
|
||||
*
|
||||
* Additionally, the HC-Receiver must keep some information about the
|
||||
* Ack Vectors it has recently sent. For each packet sent carrying an
|
||||
* Ack Vector, it remembers four variables:
|
||||
*
|
||||
* @dccpap_ack_seqno - the Sequence Number used for the packet (HC-Receiver seqno)
|
||||
* @dccpap_ack_seqno - the Sequence Number used for the packet
|
||||
* (HC-Receiver seqno)
|
||||
* @dccpap_ack_ptr - the value of buf_head at the time of acknowledgement.
|
||||
* @dccpap_ack_ackno - the Acknowledgement Number used for the packet (HC-Sender seqno)
|
||||
* @dccpap_ack_ackno - the Acknowledgement Number used for the packet
|
||||
* (HC-Sender seqno)
|
||||
* @dccpap_ack_nonce - the one-bit sum of the ECN Nonces for all State 0.
|
||||
*
|
||||
* @dccpap_buf_len - circular buffer length
|
||||
|
100
net/dccp/input.c
100
net/dccp/input.c
@ -93,7 +93,8 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
|
||||
*/
|
||||
if (dh->dccph_type == DCCP_PKT_SYNC ||
|
||||
dh->dccph_type == DCCP_PKT_SYNCACK) {
|
||||
if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, dp->dccps_awl, dp->dccps_awh) &&
|
||||
if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
dp->dccps_awl, dp->dccps_awh) &&
|
||||
!before48(DCCP_SKB_CB(skb)->dccpd_seq, dp->dccps_swl))
|
||||
dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
|
||||
else
|
||||
@ -122,11 +123,13 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
if (between48(DCCP_SKB_CB(skb)->dccpd_seq, lswl, dp->dccps_swh) &&
|
||||
(DCCP_SKB_CB(skb)->dccpd_ack_seq == DCCP_PKT_WITHOUT_ACK_SEQ ||
|
||||
between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, lawl, dp->dccps_awh))) {
|
||||
between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
lawl, dp->dccps_awh))) {
|
||||
dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
|
||||
|
||||
if (dh->dccph_type != DCCP_PKT_SYNC &&
|
||||
DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
|
||||
(DCCP_SKB_CB(skb)->dccpd_ack_seq !=
|
||||
DCCP_PKT_WITHOUT_ACK_SEQ))
|
||||
dp->dccps_gar = DCCP_SKB_CB(skb)->dccpd_ack_seq;
|
||||
} else {
|
||||
dccp_pr_debug("Step 6 failed, sending SYNC...\n");
|
||||
@ -161,10 +164,13 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
|
||||
if (dccp_ackpkts_add(dp->dccps_hc_rx_ackpkts,
|
||||
DCCP_SKB_CB(skb)->dccpd_seq,
|
||||
DCCP_ACKPKTS_STATE_RECEIVED)) {
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: acknowledgeable packets buffer full!\n");
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: acknowledgeable "
|
||||
"packets buffer full!\n");
|
||||
ap->dccpap_ack_seqno = DCCP_MAX_SEQNO + 1;
|
||||
inet_csk_schedule_ack(sk);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, TCP_DELACK_MIN, TCP_RTO_MAX);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
|
||||
TCP_DELACK_MIN,
|
||||
DCCP_RTO_MAX);
|
||||
goto discard;
|
||||
}
|
||||
|
||||
@ -175,7 +181,8 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
|
||||
*/
|
||||
if (!inet_csk_ack_scheduled(sk)) {
|
||||
inet_csk_schedule_ack(sk);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 5 * HZ, TCP_RTO_MAX);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 5 * HZ,
|
||||
DCCP_RTO_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +193,8 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
|
||||
case DCCP_PKT_DATAACK:
|
||||
case DCCP_PKT_DATA:
|
||||
/*
|
||||
* FIXME: check if sk_receive_queue is full, schedule DATA_DROPPED option
|
||||
* if it is.
|
||||
* FIXME: check if sk_receive_queue is full, schedule DATA_DROPPED
|
||||
* option if it is.
|
||||
*/
|
||||
__skb_pull(skb, dh->dccph_doff * 4);
|
||||
__skb_queue_tail(&sk->sk_receive_queue, skb);
|
||||
@ -272,11 +279,13 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
|
||||
__kfree_skb(sk->sk_send_head);
|
||||
sk->sk_send_head = NULL;
|
||||
|
||||
if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, dp->dccps_awl, dp->dccps_awh)) {
|
||||
dccp_pr_debug("invalid ackno: S.AWL=%llu, P.ackno=%llu, S.AWH=%llu \n",
|
||||
(unsigned long long) dp->dccps_awl,
|
||||
(unsigned long long) DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
(unsigned long long) dp->dccps_awh);
|
||||
if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
dp->dccps_awl, dp->dccps_awh)) {
|
||||
dccp_pr_debug("invalid ackno: S.AWL=%llu, "
|
||||
"P.ackno=%llu, S.AWH=%llu \n",
|
||||
(unsigned long long)dp->dccps_awl,
|
||||
(unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
(unsigned long long)dp->dccps_awh);
|
||||
goto out_invalid_packet;
|
||||
}
|
||||
|
||||
@ -296,16 +305,17 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
|
||||
/*
|
||||
* Step 10: Process REQUEST state (second part)
|
||||
* If S.state == REQUEST,
|
||||
* / * If we get here, P is a valid Response from the server (see
|
||||
* Step 4), and we should move to PARTOPEN state. PARTOPEN
|
||||
* means send an Ack, don't send Data packets, retransmit
|
||||
* Acks periodically, and always include any Init Cookie from
|
||||
* the Response * /
|
||||
* / * If we get here, P is a valid Response from the
|
||||
* server (see Step 4), and we should move to
|
||||
* PARTOPEN state. PARTOPEN means send an Ack,
|
||||
* don't send Data packets, retransmit Acks
|
||||
* periodically, and always include any Init Cookie
|
||||
* from the Response * /
|
||||
* S.state := PARTOPEN
|
||||
* Set PARTOPEN timer
|
||||
* Continue with S.state == PARTOPEN
|
||||
* / * Step 12 will send the Ack completing the three-way
|
||||
* handshake * /
|
||||
* / * Step 12 will send the Ack completing the
|
||||
* three-way handshake * /
|
||||
*/
|
||||
dccp_set_state(sk, DCCP_PARTOPEN);
|
||||
|
||||
@ -341,7 +351,8 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
|
||||
|
||||
out_invalid_packet:
|
||||
return 1; /* dccp_v4_do_rcv will send a reset, but...
|
||||
FIXME: the reset code should be DCCP_RESET_CODE_PACKET_ERROR */
|
||||
FIXME: the reset code should be
|
||||
DCCP_RESET_CODE_PACKET_ERROR */
|
||||
}
|
||||
|
||||
static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
|
||||
@ -358,11 +369,12 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
|
||||
case DCCP_PKT_DATAACK:
|
||||
case DCCP_PKT_ACK:
|
||||
/*
|
||||
* FIXME: we should be reseting the PARTOPEN (DELACK) timer here,
|
||||
* but only if we haven't used the DELACK timer for something else,
|
||||
* like sending a delayed ack for a TIMESTAMP echo, etc, for now
|
||||
* were not clearing it, sending an extra ACK when there is nothing
|
||||
* else to do in DELACK is not a big deal after all.
|
||||
* FIXME: we should be reseting the PARTOPEN (DELACK) timer
|
||||
* here but only if we haven't used the DELACK timer for
|
||||
* something else, like sending a delayed ack for a TIMESTAMP
|
||||
* echo, etc, for now were not clearing it, sending an extra
|
||||
* ACK when there is nothing else to do in DELACK is not a big
|
||||
* deal after all.
|
||||
*/
|
||||
|
||||
/* Stop the PARTOPEN timer */
|
||||
@ -374,7 +386,8 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
|
||||
|
||||
if (dh->dccph_type == DCCP_PKT_DATAACK) {
|
||||
dccp_rcv_established(sk, skb, dh, len);
|
||||
queued = 1; /* packet was queued (by dccp_rcv_established) */
|
||||
queued = 1; /* packet was queued
|
||||
(by dccp_rcv_established) */
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -399,7 +412,8 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
|
||||
if (dccp_parse_options(sk, skb))
|
||||
goto discard;
|
||||
|
||||
if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
|
||||
if (DCCP_SKB_CB(skb)->dccpd_ack_seq !=
|
||||
DCCP_PKT_WITHOUT_ACK_SEQ)
|
||||
dccp_event_ack_recv(sk, skb);
|
||||
|
||||
ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
|
||||
@ -415,14 +429,17 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
|
||||
DCCP_ACKPKTS_STATE_RECEIVED))
|
||||
goto discard;
|
||||
/*
|
||||
* FIXME: this activation is probably wrong, have to study more
|
||||
* TCP delack machinery and how it fits into DCCP draft, but
|
||||
* for now it kinda "works" 8)
|
||||
* FIXME: this activation is probably wrong, have to
|
||||
* study more TCP delack machinery and how it fits into
|
||||
* DCCP draft, but for now it kinda "works" 8)
|
||||
*/
|
||||
if (dp->dccps_hc_rx_ackpkts->dccpap_ack_seqno == DCCP_MAX_SEQNO + 1 &&
|
||||
if ((dp->dccps_hc_rx_ackpkts->dccpap_ack_seqno ==
|
||||
DCCP_MAX_SEQNO + 1) &&
|
||||
!inet_csk_ack_scheduled(sk)) {
|
||||
inet_csk_schedule_ack(sk);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, TCP_DELACK_MIN, TCP_RTO_MAX);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
|
||||
TCP_DELACK_MIN,
|
||||
DCCP_RTO_MAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -436,7 +453,10 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
|
||||
* Drop packet and return
|
||||
*/
|
||||
if (dh->dccph_type == DCCP_PKT_RESET) {
|
||||
/* Queue the equivalent of TCP fin so that dccp_recvmsg exits the loop */
|
||||
/*
|
||||
* Queue the equivalent of TCP fin so that dccp_recvmsg
|
||||
* exits the loop
|
||||
*/
|
||||
dccp_fin(sk, skb);
|
||||
dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
|
||||
return 0;
|
||||
@ -450,10 +470,12 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
|
||||
* Drop packet and return
|
||||
*/
|
||||
} else if ((dp->dccps_role != DCCP_ROLE_CLIENT &&
|
||||
(dh->dccph_type == DCCP_PKT_RESPONSE || dh->dccph_type == DCCP_PKT_CLOSEREQ)) ||
|
||||
(dh->dccph_type == DCCP_PKT_RESPONSE ||
|
||||
dh->dccph_type == DCCP_PKT_CLOSEREQ)) ||
|
||||
(dp->dccps_role == DCCP_ROLE_CLIENT &&
|
||||
dh->dccph_type == DCCP_PKT_REQUEST) ||
|
||||
(sk->sk_state == DCCP_RESPOND && dh->dccph_type == DCCP_PKT_DATA)) {
|
||||
(sk->sk_state == DCCP_RESPOND &&
|
||||
dh->dccph_type == DCCP_PKT_DATA)) {
|
||||
dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq);
|
||||
goto discard;
|
||||
}
|
||||
@ -491,11 +513,13 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
|
||||
|
||||
case DCCP_RESPOND:
|
||||
case DCCP_PARTOPEN:
|
||||
queued = dccp_rcv_respond_partopen_state_process(sk, skb, dh, len);
|
||||
queued = dccp_rcv_respond_partopen_state_process(sk, skb,
|
||||
dh, len);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dh->dccph_type == DCCP_PKT_ACK || dh->dccph_type == DCCP_PKT_DATAACK) {
|
||||
if (dh->dccph_type == DCCP_PKT_ACK ||
|
||||
dh->dccph_type == DCCP_PKT_DATAACK) {
|
||||
switch (old_state) {
|
||||
case DCCP_PARTOPEN:
|
||||
sk->sk_state_change(sk);
|
||||
|
114
net/dccp/ipv4.c
114
net/dccp/ipv4.c
@ -29,7 +29,7 @@
|
||||
struct inet_hashinfo __cacheline_aligned dccp_hashinfo = {
|
||||
.lhash_lock = RW_LOCK_UNLOCKED,
|
||||
.lhash_users = ATOMIC_INIT(0),
|
||||
.lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(dccp_hashinfo.lhash_wait),
|
||||
.lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(dccp_hashinfo.lhash_wait),
|
||||
.portalloc_lock = SPIN_LOCK_UNLOCKED,
|
||||
.port_rover = 1024 - 1,
|
||||
};
|
||||
@ -61,7 +61,8 @@ static int __dccp_v4_check_established(struct sock *sk, const __u16 lport,
|
||||
const int dif = sk->sk_bound_dev_if;
|
||||
INET_ADDR_COOKIE(acookie, saddr, daddr)
|
||||
const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport);
|
||||
const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport, dccp_hashinfo.ehash_size);
|
||||
const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport,
|
||||
dccp_hashinfo.ehash_size);
|
||||
struct inet_ehash_bucket *head = &dccp_hashinfo.ehash[hash];
|
||||
const struct sock *sk2;
|
||||
const struct hlist_node *node;
|
||||
@ -133,11 +134,12 @@ static int dccp_v4_hash_connect(struct sock *sk)
|
||||
local_bh_disable();
|
||||
|
||||
/* TODO. Actually it is not so bad idea to remove
|
||||
* dccp_hashinfo.portalloc_lock before next submission to Linus.
|
||||
* dccp_hashinfo.portalloc_lock before next submission to
|
||||
* Linus.
|
||||
* As soon as we touch this place at all it is time to think.
|
||||
*
|
||||
* Now it protects single _advisory_ variable dccp_hashinfo.port_rover,
|
||||
* hence it is mostly useless.
|
||||
* Now it protects single _advisory_ variable
|
||||
* dccp_hashinfo.port_rover, hence it is mostly useless.
|
||||
* Code will work nicely if we just delete it, but
|
||||
* I am afraid in contented case it will work not better or
|
||||
* even worse: another cpu just will hit the same bucket
|
||||
@ -152,7 +154,8 @@ static int dccp_v4_hash_connect(struct sock *sk)
|
||||
rover++;
|
||||
if ((rover < low) || (rover > high))
|
||||
rover = low;
|
||||
head = &dccp_hashinfo.bhash[inet_bhashfn(rover, dccp_hashinfo.bhash_size)];
|
||||
head = &dccp_hashinfo.bhash[inet_bhashfn(rover,
|
||||
dccp_hashinfo.bhash_size)];
|
||||
spin_lock(&head->lock);
|
||||
|
||||
/* Does not bother with rcv_saddr checks,
|
||||
@ -172,7 +175,8 @@ static int dccp_v4_hash_connect(struct sock *sk)
|
||||
}
|
||||
}
|
||||
|
||||
tb = inet_bind_bucket_create(dccp_hashinfo.bind_bucket_cachep, head, rover);
|
||||
tb = inet_bind_bucket_create(dccp_hashinfo.bind_bucket_cachep,
|
||||
head, rover);
|
||||
if (tb == NULL) {
|
||||
spin_unlock(&head->lock);
|
||||
break;
|
||||
@ -211,7 +215,8 @@ ok:
|
||||
goto out;
|
||||
}
|
||||
|
||||
head = &dccp_hashinfo.bhash[inet_bhashfn(snum, dccp_hashinfo.bhash_size)];
|
||||
head = &dccp_hashinfo.bhash[inet_bhashfn(snum,
|
||||
dccp_hashinfo.bhash_size)];
|
||||
tb = inet_csk(sk)->icsk_bind_hash;
|
||||
spin_lock_bh(&head->lock);
|
||||
if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) {
|
||||
@ -313,7 +318,9 @@ static int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
|
||||
out:
|
||||
return err;
|
||||
failure:
|
||||
/* This unhashes the socket and releases the local port, if necessary. */
|
||||
/*
|
||||
* This unhashes the socket and releases the local port, if necessary.
|
||||
*/
|
||||
dccp_set_state(sk, DCCP_CLOSED);
|
||||
ip_rt_put(rt);
|
||||
sk->sk_route_caps = 0;
|
||||
@ -365,8 +372,9 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
|
||||
/*
|
||||
* From: draft-ietf-dccp-spec-11.txt
|
||||
*
|
||||
* DCCP-Sync packets are the best choice for upward probing,
|
||||
* since DCCP-Sync probes do not risk application data loss.
|
||||
* DCCP-Sync packets are the best choice for upward
|
||||
* probing, since DCCP-Sync probes do not risk application
|
||||
* data loss.
|
||||
*/
|
||||
dccp_send_sync(sk, dp->dccps_gsr);
|
||||
} /* else let the usual retransmit timer handle it */
|
||||
@ -405,11 +413,13 @@ static void dccp_v4_ctl_send_ack(struct sk_buff *rxskb)
|
||||
dh->dccph_x = 1;
|
||||
|
||||
dccp_hdr_set_seq(dh, DCCP_SKB_CB(rxskb)->dccpd_ack_seq);
|
||||
dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq);
|
||||
dccp_hdr_set_ack(dccp_hdr_ack_bits(skb),
|
||||
DCCP_SKB_CB(rxskb)->dccpd_seq);
|
||||
|
||||
bh_lock_sock(dccp_ctl_socket->sk);
|
||||
err = ip_build_and_send_pkt(skb, dccp_ctl_socket->sk,
|
||||
rxskb->nh.iph->daddr, rxskb->nh.iph->saddr, NULL);
|
||||
rxskb->nh.iph->daddr,
|
||||
rxskb->nh.iph->saddr, NULL);
|
||||
bh_unlock_sock(dccp_ctl_socket->sk);
|
||||
|
||||
if (err == NET_XMIT_CN || err == 0) {
|
||||
@ -418,7 +428,8 @@ static void dccp_v4_ctl_send_ack(struct sk_buff *rxskb)
|
||||
}
|
||||
}
|
||||
|
||||
static void dccp_v4_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req)
|
||||
static void dccp_v4_reqsk_send_ack(struct sk_buff *skb,
|
||||
struct request_sock *req)
|
||||
{
|
||||
dccp_v4_ctl_send_ack(skb);
|
||||
}
|
||||
@ -465,7 +476,8 @@ out:
|
||||
void dccp_v4_err(struct sk_buff *skb, u32 info)
|
||||
{
|
||||
const struct iphdr *iph = (struct iphdr *)skb->data;
|
||||
const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + (iph->ihl << 2));
|
||||
const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data +
|
||||
(iph->ihl << 2));
|
||||
struct dccp_sock *dp;
|
||||
struct inet_sock *inet;
|
||||
const int type = skb->h.icmph->type;
|
||||
@ -605,7 +617,8 @@ out:
|
||||
sock_put(sk);
|
||||
}
|
||||
|
||||
extern struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, enum dccp_reset_codes code);
|
||||
extern struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst,
|
||||
enum dccp_reset_codes code);
|
||||
|
||||
int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code)
|
||||
{
|
||||
@ -689,7 +702,8 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
||||
ireq->loc_addr = daddr;
|
||||
ireq->rmt_addr = saddr;
|
||||
/* FIXME: Merge Aristeu's option parsing code when ready */
|
||||
req->rcv_wnd = 100; /* Fake, option parsing will get the right value */
|
||||
req->rcv_wnd = 100; /* Fake, option parsing will get the
|
||||
right value */
|
||||
ireq->opt = NULL;
|
||||
|
||||
/*
|
||||
@ -804,7 +818,8 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
|
||||
return sk;
|
||||
}
|
||||
|
||||
int dccp_v4_checksum(const struct sk_buff *skb, const u32 saddr, const u32 daddr)
|
||||
int dccp_v4_checksum(const struct sk_buff *skb, const u32 saddr,
|
||||
const u32 daddr)
|
||||
{
|
||||
const struct dccp_hdr* dh = dccp_hdr(skb);
|
||||
int checksum_len;
|
||||
@ -814,11 +829,13 @@ int dccp_v4_checksum(const struct sk_buff *skb, const u32 saddr, const u32 daddr
|
||||
checksum_len = skb->len;
|
||||
else {
|
||||
checksum_len = (dh->dccph_cscov + dh->dccph_x) * sizeof(u32);
|
||||
checksum_len = checksum_len < skb->len ? checksum_len : skb->len;
|
||||
checksum_len = checksum_len < skb->len ? checksum_len :
|
||||
skb->len;
|
||||
}
|
||||
|
||||
tmp = csum_partial((unsigned char *)dh, checksum_len, 0);
|
||||
return csum_tcpudp_magic(saddr, daddr, checksum_len, IPPROTO_DCCP, tmp);
|
||||
return csum_tcpudp_magic(saddr, daddr, checksum_len,
|
||||
IPPROTO_DCCP, tmp);
|
||||
}
|
||||
|
||||
static int dccp_v4_verify_checksum(struct sk_buff *skb,
|
||||
@ -832,10 +849,12 @@ static int dccp_v4_verify_checksum(struct sk_buff *skb,
|
||||
checksum_len = skb->len;
|
||||
else {
|
||||
checksum_len = (dh->dccph_cscov + dh->dccph_x) * sizeof(u32);
|
||||
checksum_len = checksum_len < skb->len ? checksum_len : skb->len;
|
||||
checksum_len = checksum_len < skb->len ? checksum_len :
|
||||
skb->len;
|
||||
}
|
||||
tmp = csum_partial((unsigned char *)dh, checksum_len, 0);
|
||||
return csum_tcpudp_magic(saddr, daddr, checksum_len, IPPROTO_DCCP, tmp) == 0 ? 0 : -1;
|
||||
return csum_tcpudp_magic(saddr, daddr, checksum_len,
|
||||
IPPROTO_DCCP, tmp) == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
|
||||
@ -850,7 +869,9 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
|
||||
.proto = sk->sk_protocol,
|
||||
.uli_u = { .ports =
|
||||
{ .sport = dccp_hdr(skb)->dccph_dport,
|
||||
.dport = dccp_hdr(skb)->dccph_sport } } };
|
||||
.dport = dccp_hdr(skb)->dccph_sport }
|
||||
}
|
||||
};
|
||||
|
||||
if (ip_route_output_flow(&rt, &fl, sk, 0)) {
|
||||
IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
|
||||
@ -899,17 +920,20 @@ void dccp_v4_ctl_send_reset(struct sk_buff *rxskb)
|
||||
dh->dccph_dport = rxdh->dccph_sport;
|
||||
dh->dccph_doff = dccp_hdr_reset_len / 4;
|
||||
dh->dccph_x = 1;
|
||||
dccp_hdr_reset(skb)->dccph_reset_code = DCCP_SKB_CB(rxskb)->dccpd_reset_code;
|
||||
dccp_hdr_reset(skb)->dccph_reset_code =
|
||||
DCCP_SKB_CB(rxskb)->dccpd_reset_code;
|
||||
|
||||
dccp_hdr_set_seq(dh, DCCP_SKB_CB(rxskb)->dccpd_ack_seq);
|
||||
dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq);
|
||||
dccp_hdr_set_ack(dccp_hdr_ack_bits(skb),
|
||||
DCCP_SKB_CB(rxskb)->dccpd_seq);
|
||||
|
||||
dh->dccph_checksum = dccp_v4_checksum(skb, rxskb->nh.iph->saddr,
|
||||
rxskb->nh.iph->daddr);
|
||||
|
||||
bh_lock_sock(dccp_ctl_socket->sk);
|
||||
err = ip_build_and_send_pkt(skb, dccp_ctl_socket->sk,
|
||||
rxskb->nh.iph->daddr, rxskb->nh.iph->saddr, NULL);
|
||||
rxskb->nh.iph->daddr,
|
||||
rxskb->nh.iph->saddr, NULL);
|
||||
bh_unlock_sock(dccp_ctl_socket->sk);
|
||||
|
||||
if (err == NET_XMIT_CN || err == 0) {
|
||||
@ -933,7 +957,8 @@ int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
/*
|
||||
* Step 3: Process LISTEN state
|
||||
* If S.state == LISTEN,
|
||||
* If P.type == Request or P contains a valid Init Cookie option,
|
||||
* If P.type == Request or P contains a valid Init Cookie
|
||||
* option,
|
||||
* * Must scan the packet's options to check for an Init
|
||||
* Cookie. Only the Init Cookie is processed here,
|
||||
* however; other options are processed in Step 8. This
|
||||
@ -950,7 +975,8 @@ int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
* Generate Reset(No Connection) unless P.type == Reset
|
||||
* Drop packet and return
|
||||
*
|
||||
* NOTE: the check for the packet types is done in dccp_rcv_state_process
|
||||
* NOTE: the check for the packet types is done in
|
||||
* dccp_rcv_state_process
|
||||
*/
|
||||
if (sk->sk_state == DCCP_LISTEN) {
|
||||
struct sock *nsk = dccp_v4_hnd_req(sk, skb);
|
||||
@ -1007,7 +1033,8 @@ static inline int dccp_invalid_packet(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
if (!pskb_may_pull(skb, dh->dccph_doff * sizeof(u32))) {
|
||||
dccp_pr_debug("P.Data Offset(%u) too small 2\n", dh->dccph_doff);
|
||||
dccp_pr_debug("P.Data Offset(%u) too small 2\n",
|
||||
dh->dccph_doff);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1021,8 +1048,8 @@ static inline int dccp_invalid_packet(struct sk_buff *skb)
|
||||
dh->dccph_type != DCCP_PKT_DATA &&
|
||||
dh->dccph_type != DCCP_PKT_ACK &&
|
||||
dh->dccph_type != DCCP_PKT_DATAACK) {
|
||||
dccp_pr_debug("P.type (%s) not Data, Ack nor DataAck and P.X == 0\n",
|
||||
dccp_packet_name(dh->dccph_type));
|
||||
dccp_pr_debug("P.type (%s) not Data, Ack nor DataAck and "
|
||||
"P.X == 0\n", dccp_packet_name(dh->dccph_type));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1055,10 +1082,11 @@ int dccp_v4_rcv(struct sk_buff *skb)
|
||||
* dccp_ackpkts_add, you'll get something like this on a session that
|
||||
* sends 10 DATA/DATAACK packets:
|
||||
*
|
||||
* dccp_ackpkts_print: 281473596467422 |0,0|3,0|0,0|3,0|0,0|3,0|0,0|3,0|0,1|
|
||||
* ackpkts_print: 281473596467422 |0,0|3,0|0,0|3,0|0,0|3,0|0,0|3,0|0,1|
|
||||
*
|
||||
* 0, 0 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == just this packet
|
||||
* 0, 1 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == two adjacent packets with the same state
|
||||
* 0, 1 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == two adjacent packets
|
||||
* with the same state
|
||||
* 3, 0 means: DCCP_ACKPKTS_STATE_NOT_RECEIVED, RLE == just this packet
|
||||
*
|
||||
* So...
|
||||
@ -1072,10 +1100,12 @@ int dccp_v4_rcv(struct sk_buff *skb)
|
||||
* 281473596467416 was received
|
||||
* 281473596467415 was not received
|
||||
* 281473596467414 was received
|
||||
* 281473596467413 was received (this one was the 3way handshake RESPONSE)
|
||||
* 281473596467413 was received (this one was the 3way handshake
|
||||
* RESPONSE)
|
||||
*
|
||||
*/
|
||||
if (dh->dccph_type == DCCP_PKT_DATA || dh->dccph_type == DCCP_PKT_DATAACK) {
|
||||
if (dh->dccph_type == DCCP_PKT_DATA ||
|
||||
dh->dccph_type == DCCP_PKT_DATAACK) {
|
||||
static int discard = 0;
|
||||
|
||||
if (discard) {
|
||||
@ -1170,7 +1200,8 @@ no_dccp_socket:
|
||||
* Drop packet and return
|
||||
*/
|
||||
if (dh->dccph_type != DCCP_PKT_RESET) {
|
||||
DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION;
|
||||
DCCP_SKB_CB(skb)->dccpd_reset_code =
|
||||
DCCP_RESET_CODE_NO_CONNECTION;
|
||||
dccp_v4_ctl_send_reset(skb);
|
||||
}
|
||||
|
||||
@ -1196,8 +1227,9 @@ static int dccp_v4_init_sock(struct sock *sk)
|
||||
dccp_options_init(&dp->dccps_options);
|
||||
|
||||
if (dp->dccps_options.dccpo_send_ack_vector) {
|
||||
dp->dccps_hc_rx_ackpkts = dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN,
|
||||
GFP_KERNEL);
|
||||
dp->dccps_hc_rx_ackpkts =
|
||||
dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN,
|
||||
GFP_KERNEL);
|
||||
|
||||
if (dp->dccps_hc_rx_ackpkts == NULL)
|
||||
return -ENOMEM;
|
||||
@ -1211,8 +1243,10 @@ static int dccp_v4_init_sock(struct sock *sk)
|
||||
* setsockopt(CCIDs-I-want/accept). -acme
|
||||
*/
|
||||
if (likely(!dccp_ctl_socket_init)) {
|
||||
dp->dccps_hc_rx_ccid = ccid_init(dp->dccps_options.dccpo_ccid, sk);
|
||||
dp->dccps_hc_tx_ccid = ccid_init(dp->dccps_options.dccpo_ccid, sk);
|
||||
dp->dccps_hc_rx_ccid = ccid_init(dp->dccps_options.dccpo_ccid,
|
||||
sk);
|
||||
dp->dccps_hc_tx_ccid = ccid_init(dp->dccps_options.dccpo_ccid,
|
||||
sk);
|
||||
if (dp->dccps_hc_rx_ccid == NULL ||
|
||||
dp->dccps_hc_tx_ccid == NULL) {
|
||||
ccid_exit(dp->dccps_hc_rx_ccid, sk);
|
||||
|
@ -69,8 +69,8 @@ void dccp_time_wait(struct sock *sk, int state, int timeo)
|
||||
* socket up. We've got bigger problems than
|
||||
* non-graceful socket closings.
|
||||
*/
|
||||
if (net_ratelimit())
|
||||
printk(KERN_INFO "DCCP: time wait bucket table overflow\n");
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: time wait bucket "
|
||||
"table overflow\n");
|
||||
}
|
||||
|
||||
dccp_done(sk);
|
||||
@ -98,19 +98,23 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
|
||||
newicsk->icsk_rto = DCCP_TIMEOUT_INIT;
|
||||
|
||||
if (newdp->dccps_options.dccpo_send_ack_vector) {
|
||||
newdp->dccps_hc_rx_ackpkts = dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN,
|
||||
GFP_ATOMIC);
|
||||
newdp->dccps_hc_rx_ackpkts =
|
||||
dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN,
|
||||
GFP_ATOMIC);
|
||||
/*
|
||||
* XXX: We're using the same CCIDs set on the parent, i.e. sk_clone
|
||||
* copied the master sock and left the CCID pointers for this child,
|
||||
* that is why we do the __ccid_get calls.
|
||||
* XXX: We're using the same CCIDs set on the parent,
|
||||
* i.e. sk_clone copied the master sock and left the
|
||||
* CCID pointers for this child, that is why we do the
|
||||
* __ccid_get calls.
|
||||
*/
|
||||
if (unlikely(newdp->dccps_hc_rx_ackpkts == NULL))
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
if (unlikely(ccid_hc_rx_init(newdp->dccps_hc_rx_ccid, newsk) != 0 ||
|
||||
ccid_hc_tx_init(newdp->dccps_hc_tx_ccid, newsk) != 0)) {
|
||||
if (unlikely(ccid_hc_rx_init(newdp->dccps_hc_rx_ccid,
|
||||
newsk) != 0 ||
|
||||
ccid_hc_tx_init(newdp->dccps_hc_tx_ccid,
|
||||
newsk) != 0)) {
|
||||
dccp_ackpkts_free(newdp->dccps_hc_rx_ackpkts);
|
||||
ccid_hc_rx_exit(newdp->dccps_hc_rx_ccid, newsk);
|
||||
ccid_hc_tx_exit(newdp->dccps_hc_tx_ccid, newsk);
|
||||
@ -129,7 +133,8 @@ out_free:
|
||||
* Step 3: Process LISTEN state
|
||||
*
|
||||
* Choose S.ISS (initial seqno) or set from Init Cookie
|
||||
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie
|
||||
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init
|
||||
* Cookie
|
||||
*/
|
||||
|
||||
/* See dccp_v4_conn_request */
|
||||
@ -160,13 +165,15 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
|
||||
|
||||
/* Check for retransmitted REQUEST */
|
||||
if (dccp_hdr(skb)->dccph_type == DCCP_PKT_REQUEST) {
|
||||
if (after48(DCCP_SKB_CB(skb)->dccpd_seq, dccp_rsk(req)->dreq_isr)) {
|
||||
if (after48(DCCP_SKB_CB(skb)->dccpd_seq,
|
||||
dccp_rsk(req)->dreq_isr)) {
|
||||
struct dccp_request_sock *dreq = dccp_rsk(req);
|
||||
|
||||
dccp_pr_debug("Retransmitted REQUEST\n");
|
||||
/* Send another RESPONSE packet */
|
||||
dccp_set_seqno(&dreq->dreq_iss, dreq->dreq_iss + 1);
|
||||
dccp_set_seqno(&dreq->dreq_isr, DCCP_SKB_CB(skb)->dccpd_seq);
|
||||
dccp_set_seqno(&dreq->dreq_isr,
|
||||
DCCP_SKB_CB(skb)->dccpd_seq);
|
||||
req->rsk_ops->rtx_syn_ack(sk, req, NULL);
|
||||
}
|
||||
/* Network Duplicate, discard packet */
|
||||
@ -181,7 +188,8 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
|
||||
|
||||
/* Invalid ACK */
|
||||
if (DCCP_SKB_CB(skb)->dccpd_ack_seq != dccp_rsk(req)->dreq_iss) {
|
||||
dccp_pr_debug("Invalid ACK number: ack_seq=%llu, dreq_iss=%llu\n",
|
||||
dccp_pr_debug("Invalid ACK number: ack_seq=%llu, "
|
||||
"dreq_iss=%llu\n",
|
||||
(unsigned long long)
|
||||
DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
(unsigned long long)
|
||||
@ -223,7 +231,8 @@ int dccp_child_process(struct sock *parent, struct sock *child,
|
||||
const int state = child->sk_state;
|
||||
|
||||
if (!sock_owned_by_user(child)) {
|
||||
ret = dccp_rcv_state_process(child, skb, dccp_hdr(skb), skb->len);
|
||||
ret = dccp_rcv_state_process(child, skb, dccp_hdr(skb),
|
||||
skb->len);
|
||||
|
||||
/* Wakeup parent, send SIGIO */
|
||||
if (state == DCCP_RESPOND && child->sk_state != state)
|
||||
|
@ -59,14 +59,15 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
#ifdef DCCP_DEBUG
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? "CLIENT rx opt: " :
|
||||
"server rx opt: ";
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ?
|
||||
"CLIENT rx opt: " : "server rx opt: ";
|
||||
#endif
|
||||
const struct dccp_hdr *dh = dccp_hdr(skb);
|
||||
const u8 pkt_type = DCCP_SKB_CB(skb)->dccpd_type;
|
||||
unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb);
|
||||
unsigned char *opt_ptr = options;
|
||||
const unsigned char *opt_end = (unsigned char *)dh + (dh->dccph_doff * 4);
|
||||
const unsigned char *opt_end = (unsigned char *)dh +
|
||||
(dh->dccph_doff * 4);
|
||||
struct dccp_options_received *opt_recv = &dp->dccps_options_received;
|
||||
unsigned char opt, len;
|
||||
unsigned char *value;
|
||||
@ -106,7 +107,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
|
||||
goto out_invalid_option;
|
||||
|
||||
opt_recv->dccpor_ndp = dccp_decode_value_var(value, len);
|
||||
dccp_pr_debug("%sNDP count=%d\n", debug_prefix, opt_recv->dccpor_ndp);
|
||||
dccp_pr_debug("%sNDP count=%d\n", debug_prefix,
|
||||
opt_recv->dccpor_ndp);
|
||||
break;
|
||||
case DCCPO_ACK_VECTOR_0:
|
||||
if (len > DCCP_MAX_ACK_VECTOR_LEN)
|
||||
@ -124,8 +126,9 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
|
||||
DCCP_SKB_CB(skb)->dccpd_ack_seq);
|
||||
dccp_ackvector_print(DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
value, len);
|
||||
dccp_ackpkts_check_rcv_ackvector(dp->dccps_hc_rx_ackpkts, sk,
|
||||
DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
dccp_ackpkts_check_rcv_ackvector(dp->dccps_hc_rx_ackpkts,
|
||||
sk,
|
||||
DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
len, value);
|
||||
break;
|
||||
case DCCPO_TIMESTAMP:
|
||||
@ -148,15 +151,21 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
opt_recv->dccpor_timestamp_echo = ntohl(*(u32 *)value);
|
||||
|
||||
dccp_pr_debug("%sTIMESTAMP_ECHO=%u, len=%d, ackno=%llu, diff=%u\n",
|
||||
debug_prefix, opt_recv->dccpor_timestamp_echo,
|
||||
dccp_pr_debug("%sTIMESTAMP_ECHO=%u, len=%d, ackno=%llu, "
|
||||
"diff=%u\n",
|
||||
debug_prefix,
|
||||
opt_recv->dccpor_timestamp_echo,
|
||||
len + 2,
|
||||
(unsigned long long)
|
||||
DCCP_SKB_CB(skb)->dccpd_ack_seq,
|
||||
tcp_time_stamp - opt_recv->dccpor_timestamp_echo);
|
||||
(tcp_time_stamp -
|
||||
opt_recv->dccpor_timestamp_echo));
|
||||
|
||||
opt_recv->dccpor_elapsed_time = dccp_decode_value_var(value + 4, len - 4);
|
||||
dccp_pr_debug("%sTIMESTAMP_ECHO ELAPSED_TIME=%d\n", debug_prefix,
|
||||
opt_recv->dccpor_elapsed_time =
|
||||
dccp_decode_value_var(value + 4,
|
||||
len - 4);
|
||||
dccp_pr_debug("%sTIMESTAMP_ECHO ELAPSED_TIME=%d\n",
|
||||
debug_prefix,
|
||||
opt_recv->dccpor_elapsed_time);
|
||||
break;
|
||||
case DCCPO_ELAPSED_TIME:
|
||||
@ -165,33 +174,41 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
if (pkt_type == DCCP_PKT_DATA)
|
||||
continue;
|
||||
opt_recv->dccpor_elapsed_time = dccp_decode_value_var(value, len);
|
||||
opt_recv->dccpor_elapsed_time =
|
||||
dccp_decode_value_var(value, len);
|
||||
dccp_pr_debug("%sELAPSED_TIME=%d\n", debug_prefix,
|
||||
opt_recv->dccpor_elapsed_time);
|
||||
break;
|
||||
/*
|
||||
* From draft-ietf-dccp-spec-11.txt:
|
||||
*
|
||||
* Option numbers 128 through 191 are for options sent from the HC-
|
||||
* Sender to the HC-Receiver; option numbers 192 through 255 are for
|
||||
* options sent from the HC-Receiver to the HC-Sender.
|
||||
* Option numbers 128 through 191 are for
|
||||
* options sent from the HC-Sender to the
|
||||
* HC-Receiver; option numbers 192 through 255
|
||||
* are for options sent from the HC-Receiver to
|
||||
* the HC-Sender.
|
||||
*/
|
||||
case 128 ... 191: {
|
||||
const u16 idx = value - options;
|
||||
|
||||
if (ccid_hc_rx_parse_options(dp->dccps_hc_rx_ccid, sk, opt, len, idx, value) != 0)
|
||||
if (ccid_hc_rx_parse_options(dp->dccps_hc_rx_ccid, sk,
|
||||
opt, len, idx,
|
||||
value) != 0)
|
||||
goto out_invalid_option;
|
||||
}
|
||||
break;
|
||||
case 192 ... 255: {
|
||||
const u16 idx = value - options;
|
||||
|
||||
if (ccid_hc_tx_parse_options(dp->dccps_hc_tx_ccid, sk, opt, len, idx, value) != 0)
|
||||
if (ccid_hc_tx_parse_options(dp->dccps_hc_tx_ccid, sk,
|
||||
opt, len, idx,
|
||||
value) != 0)
|
||||
goto out_invalid_option;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pr_info("DCCP(%p): option %d(len=%d) not implemented, ignoring\n",
|
||||
pr_info("DCCP(%p): option %d(len=%d) not "
|
||||
"implemented, ignoring\n",
|
||||
sk, opt, len);
|
||||
break;
|
||||
}
|
||||
@ -231,7 +248,8 @@ void dccp_insert_option(struct sock *sk, struct sk_buff *skb,
|
||||
unsigned char *to;
|
||||
|
||||
if (DCCP_SKB_CB(skb)->dccpd_opt_len + len + 2 > DCCP_MAX_OPT_LEN) {
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to insert %d option!\n", option);
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to insert "
|
||||
"%d option!\n", option);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -287,8 +305,8 @@ void dccp_insert_option_elapsed_time(struct sock *sk,
|
||||
{
|
||||
#ifdef DCCP_DEBUG
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? "CLIENT TX opt: " :
|
||||
"server TX opt: ";
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ?
|
||||
"CLIENT TX opt: " : "server TX opt: ";
|
||||
#endif
|
||||
const int elapsed_time_len = dccp_elapsed_time_len(elapsed_time);
|
||||
const int len = 2 + elapsed_time_len;
|
||||
@ -299,7 +317,8 @@ void dccp_insert_option_elapsed_time(struct sock *sk,
|
||||
return;
|
||||
|
||||
if (DCCP_SKB_CB(skb)->dccpd_opt_len + len > DCCP_MAX_OPT_LEN) {
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to insert elapsed time!\n");
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to "
|
||||
"insert elapsed time!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -323,8 +342,8 @@ static void dccp_insert_option_ack_vector(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
#ifdef DCCP_DEBUG
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? "CLIENT TX opt: " :
|
||||
"server TX opt: ";
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ?
|
||||
"CLIENT TX opt: " : "server TX opt: ";
|
||||
#endif
|
||||
struct dccp_ackpkts *ap = dp->dccps_hc_rx_ackpkts;
|
||||
int len = ap->dccpap_buf_vector_len + 2;
|
||||
@ -335,7 +354,8 @@ static void dccp_insert_option_ack_vector(struct sock *sk, struct sk_buff *skb)
|
||||
dccp_insert_option_elapsed_time(sk, skb, elapsed_time);
|
||||
|
||||
if (DCCP_SKB_CB(skb)->dccpd_opt_len + len > DCCP_MAX_OPT_LEN) {
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to insert ACK Vector!\n");
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to "
|
||||
"insert ACK Vector!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -360,7 +380,8 @@ static void dccp_insert_option_ack_vector(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
/* Check if buf_head wraps */
|
||||
if (ap->dccpap_buf_head + len > ap->dccpap_buf_len) {
|
||||
const unsigned int tailsize = ap->dccpap_buf_len - ap->dccpap_buf_head;
|
||||
const unsigned int tailsize = (ap->dccpap_buf_len -
|
||||
ap->dccpap_buf_head);
|
||||
|
||||
memcpy(to, from, tailsize);
|
||||
to += tailsize;
|
||||
@ -375,8 +396,8 @@ static void dccp_insert_option_ack_vector(struct sock *sk, struct sk_buff *skb)
|
||||
* For each acknowledgement it sends, the HC-Receiver will add an
|
||||
* acknowledgement record. ack_seqno will equal the HC-Receiver
|
||||
* sequence number it used for the ack packet; ack_ptr will equal
|
||||
* buf_head; ack_ackno will equal buf_ackno; and ack_nonce will equal
|
||||
* buf_nonce.
|
||||
* buf_head; ack_ackno will equal buf_ackno; and ack_nonce will
|
||||
* equal buf_nonce.
|
||||
*
|
||||
* This implemention uses just one ack record for now.
|
||||
*/
|
||||
@ -386,33 +407,38 @@ static void dccp_insert_option_ack_vector(struct sock *sk, struct sk_buff *skb)
|
||||
ap->dccpap_ack_nonce = ap->dccpap_buf_nonce;
|
||||
ap->dccpap_ack_vector_len = ap->dccpap_buf_vector_len;
|
||||
|
||||
dccp_pr_debug("%sACK Vector 0, len=%d, ack_seqno=%llu, ack_ackno=%llu\n",
|
||||
dccp_pr_debug("%sACK Vector 0, len=%d, ack_seqno=%llu, "
|
||||
"ack_ackno=%llu\n",
|
||||
debug_prefix, ap->dccpap_ack_vector_len,
|
||||
(unsigned long long) ap->dccpap_ack_seqno,
|
||||
(unsigned long long) ap->dccpap_ack_ackno);
|
||||
}
|
||||
|
||||
static inline void dccp_insert_option_timestamp(struct sock *sk, struct sk_buff *skb)
|
||||
static inline void dccp_insert_option_timestamp(struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
const u32 now = htonl(tcp_time_stamp);
|
||||
dccp_insert_option(sk, skb, DCCPO_TIMESTAMP, &now, sizeof(now));
|
||||
}
|
||||
|
||||
static void dccp_insert_option_timestamp_echo(struct sock *sk, struct sk_buff *skb)
|
||||
static void dccp_insert_option_timestamp_echo(struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
#ifdef DCCP_DEBUG
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? "CLIENT TX opt: " :
|
||||
"server TX opt: ";
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ?
|
||||
"CLIENT TX opt: " : "server TX opt: ";
|
||||
#endif
|
||||
u32 tstamp_echo;
|
||||
const u32 elapsed_time = jiffies_to_usecs(jiffies - dp->dccps_timestamp_time) / 10;
|
||||
const u32 elapsed_time = jiffies_to_usecs(jiffies -
|
||||
dp->dccps_timestamp_time) / 10;
|
||||
const int elapsed_time_len = dccp_elapsed_time_len(elapsed_time);
|
||||
const int len = 6 + elapsed_time_len;
|
||||
unsigned char *to;
|
||||
|
||||
if (DCCP_SKB_CB(skb)->dccpd_opt_len + len > DCCP_MAX_OPT_LEN) {
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to insert timestamp echo!\n");
|
||||
LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small to insert "
|
||||
"timestamp echo!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -447,7 +473,8 @@ void dccp_insert_options(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
if (!dccp_packet_without_ack(skb)) {
|
||||
if (dp->dccps_options.dccpo_send_ack_vector &&
|
||||
dp->dccps_hc_rx_ackpkts->dccpap_buf_ackno != DCCP_MAX_SEQNO + 1)
|
||||
(dp->dccps_hc_rx_ackpkts->dccpap_buf_ackno !=
|
||||
DCCP_MAX_SEQNO + 1))
|
||||
dccp_insert_option_ack_vector(sk, skb);
|
||||
|
||||
dccp_insert_option_timestamp(sk, skb);
|
||||
@ -480,12 +507,16 @@ struct dccp_ackpkts *dccp_ackpkts_alloc(unsigned int len, int priority)
|
||||
#ifdef DCCP_DEBUG
|
||||
memset(ap->dccpap_buf, 0xFF, len);
|
||||
#endif
|
||||
ap->dccpap_buf_len = len;
|
||||
ap->dccpap_buf_head = ap->dccpap_buf_tail = ap->dccpap_buf_len - 1;
|
||||
ap->dccpap_buf_ackno = ap->dccpap_ack_ackno = ap->dccpap_ack_seqno = DCCP_MAX_SEQNO + 1;
|
||||
ap->dccpap_buf_nonce = ap->dccpap_buf_nonce = 0;
|
||||
ap->dccpap_ack_ptr = 0;
|
||||
ap->dccpap_time = 0;
|
||||
ap->dccpap_buf_len = len;
|
||||
ap->dccpap_buf_head =
|
||||
ap->dccpap_buf_tail =
|
||||
ap->dccpap_buf_len - 1;
|
||||
ap->dccpap_buf_ackno =
|
||||
ap->dccpap_ack_ackno =
|
||||
ap->dccpap_ack_seqno = DCCP_MAX_SEQNO + 1;
|
||||
ap->dccpap_buf_nonce = ap->dccpap_buf_nonce = 0;
|
||||
ap->dccpap_ack_ptr = 0;
|
||||
ap->dccpap_time = 0;
|
||||
ap->dccpap_buf_vector_len = ap->dccpap_ack_vector_len = 0;
|
||||
}
|
||||
|
||||
@ -567,15 +598,16 @@ int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state)
|
||||
*
|
||||
* From Appendix A:
|
||||
*
|
||||
* Of course, the circular buffer may overflow, either when the HC-
|
||||
* Sender is sending data at a very high rate, when the HC-Receiver's
|
||||
* acknowledgements are not reaching the HC-Sender, or when the HC-
|
||||
* Sender is forgetting to acknowledge those acks (so the HC-Receiver
|
||||
* is unable to clean up old state). In this case, the HC-Receiver
|
||||
* should either compress the buffer (by increasing run lengths when
|
||||
* possible), transfer its state to a larger buffer, or, as a last
|
||||
* resort, drop all received packets, without processing them
|
||||
* whatsoever, until its buffer shrinks again.
|
||||
* Of course, the circular buffer may overflow, either when the
|
||||
* HC-Sender is sending data at a very high rate, when the
|
||||
* HC-Receiver's acknowledgements are not reaching the HC-Sender,
|
||||
* or when the HC-Sender is forgetting to acknowledge those acks
|
||||
* (so the HC-Receiver is unable to clean up old state). In this
|
||||
* case, the HC-Receiver should either compress the buffer (by
|
||||
* increasing run lengths when possible), transfer its state to
|
||||
* a larger buffer, or, as a last resort, drop all received
|
||||
* packets, without processing them whatsoever, until its buffer
|
||||
* shrinks again.
|
||||
*/
|
||||
|
||||
/* See if this is the first ackno being inserted */
|
||||
@ -583,15 +615,17 @@ int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state)
|
||||
ap->dccpap_buf[ap->dccpap_buf_head] = state;
|
||||
ap->dccpap_buf_vector_len = 1;
|
||||
} else if (after48(ackno, ap->dccpap_buf_ackno)) {
|
||||
const u64 delta = dccp_delta_seqno(ap->dccpap_buf_ackno, ackno);
|
||||
const u64 delta = dccp_delta_seqno(ap->dccpap_buf_ackno,
|
||||
ackno);
|
||||
|
||||
/*
|
||||
* Look if the state of this packet is the same as the previous ackno
|
||||
* and if so if we can bump the head len.
|
||||
* Look if the state of this packet is the same as the
|
||||
* previous ackno and if so if we can bump the head len.
|
||||
*/
|
||||
if (delta == 1 &&
|
||||
dccp_ackpkts_state(ap, ap->dccpap_buf_head) == state &&
|
||||
dccp_ackpkts_len(ap, ap->dccpap_buf_head) < DCCP_ACKPKTS_LEN_MASK)
|
||||
(dccp_ackpkts_len(ap, ap->dccpap_buf_head) <
|
||||
DCCP_ACKPKTS_LEN_MASK))
|
||||
ap->dccpap_buf[ap->dccpap_buf_head]++;
|
||||
else if (dccp_ackpkts_set_buf_head_state(ap, delta, state))
|
||||
return -ENOBUFS;
|
||||
@ -599,9 +633,10 @@ int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state)
|
||||
/*
|
||||
* A.1.2. Old Packets
|
||||
*
|
||||
* When a packet with Sequence Number S arrives, and S <= buf_ackno,
|
||||
* the HC-Receiver will scan the table for the byte corresponding to S.
|
||||
* (Indexing structures could reduce the complexity of this scan.)
|
||||
* When a packet with Sequence Number S arrives, and
|
||||
* S <= buf_ackno, the HC-Receiver will scan the table
|
||||
* for the byte corresponding to S. (Indexing structures
|
||||
* could reduce the complexity of this scan.)
|
||||
*/
|
||||
u64 delta = dccp_delta_seqno(ackno, ap->dccpap_buf_ackno);
|
||||
unsigned int index = ap->dccpap_buf_head;
|
||||
@ -610,11 +645,12 @@ int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state)
|
||||
const u8 len = dccp_ackpkts_len(ap, index);
|
||||
const u8 state = dccp_ackpkts_state(ap, index);
|
||||
/*
|
||||
* valid packets not yet in dccpap_buf have a reserved entry, with
|
||||
* a len equal to 0
|
||||
* valid packets not yet in dccpap_buf have a reserved
|
||||
* entry, with a len equal to 0.
|
||||
*/
|
||||
if (state == DCCP_ACKPKTS_STATE_NOT_RECEIVED &&
|
||||
len == 0 && delta == 0) { /* Found our reserved seat! */
|
||||
len == 0 && delta == 0) { /* Found our
|
||||
reserved seat! */
|
||||
dccp_pr_debug("Found %llu reserved seat!\n",
|
||||
(unsigned long long) ackno);
|
||||
ap->dccpap_buf[index] = state;
|
||||
@ -639,13 +675,14 @@ out:
|
||||
|
||||
out_duplicate:
|
||||
/* Duplicate packet */
|
||||
dccp_pr_debug("Received a dup or already considered lost packet: %llu\n",
|
||||
(unsigned long long) ackno);
|
||||
dccp_pr_debug("Received a dup or already considered lost "
|
||||
"packet: %llu\n", (unsigned long long) ackno);
|
||||
return -EILSEQ;
|
||||
}
|
||||
|
||||
#ifdef DCCP_DEBUG
|
||||
void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len)
|
||||
void dccp_ackvector_print(const u64 ackno, const unsigned char *vector,
|
||||
int len)
|
||||
{
|
||||
if (!dccp_debug)
|
||||
return;
|
||||
@ -678,8 +715,9 @@ static void dccp_ackpkts_trow_away_ack_record(struct dccp_ackpkts *ap)
|
||||
* As we're keeping track of the ack vector size
|
||||
* (dccpap_buf_vector_len) and the sent ack vector size
|
||||
* (dccpap_ack_vector_len) we don't need dccpap_buf_tail at all, but
|
||||
* keep this code here as in the future we'll implement a vector of ack
|
||||
* records, as suggested in draft-ietf-dccp-spec-11.txt Appendix A. -acme
|
||||
* keep this code here as in the future we'll implement a vector of
|
||||
* ack records, as suggested in draft-ietf-dccp-spec-11.txt
|
||||
* Appendix A. -acme
|
||||
*/
|
||||
#if 0
|
||||
ap->dccpap_buf_tail = ap->dccpap_ack_ptr + 1;
|
||||
@ -699,10 +737,11 @@ void dccp_ackpkts_check_rcv_ackno(struct dccp_ackpkts *ap, struct sock *sk,
|
||||
if (ackno == ap->dccpap_ack_seqno) {
|
||||
#ifdef DCCP_DEBUG
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? "CLIENT rx ack: " :
|
||||
"server rx ack: ";
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ?
|
||||
"CLIENT rx ack: " : "server rx ack: ";
|
||||
#endif
|
||||
dccp_pr_debug("%sACK packet 0, len=%d, ack_seqno=%llu, ack_ackno=%llu, ACKED!\n",
|
||||
dccp_pr_debug("%sACK packet 0, len=%d, ack_seqno=%llu, "
|
||||
"ack_ackno=%llu, ACKED!\n",
|
||||
debug_prefix, 1,
|
||||
(unsigned long long) ap->dccpap_ack_seqno,
|
||||
(unsigned long long) ap->dccpap_ack_ackno);
|
||||
@ -722,20 +761,21 @@ static void dccp_ackpkts_check_rcv_ackvector(struct dccp_ackpkts *ap,
|
||||
if (ap->dccpap_ack_seqno == DCCP_MAX_SEQNO + 1)
|
||||
return;
|
||||
/*
|
||||
* We're in the receiver half connection, so if the received an ACK vector
|
||||
* ackno (e.g. 50) before dccpap_ack_seqno (e.g. 52), we're not interested.
|
||||
* We're in the receiver half connection, so if the received an ACK
|
||||
* vector ackno (e.g. 50) before dccpap_ack_seqno (e.g. 52), we're
|
||||
* not interested.
|
||||
*
|
||||
* Extra explanation with example:
|
||||
*
|
||||
* if we received an ACK vector with ackno 50, it can only be acking
|
||||
* 50, 49, 48, etc, not 52 (the seqno for the ACK vector we sent).
|
||||
*/
|
||||
// dccp_pr_debug("is %llu < %llu? ", ackno, ap->dccpap_ack_seqno);
|
||||
/* dccp_pr_debug("is %llu < %llu? ", ackno, ap->dccpap_ack_seqno); */
|
||||
if (before48(ackno, ap->dccpap_ack_seqno)) {
|
||||
// dccp_pr_debug_cat("yes\n");
|
||||
/* dccp_pr_debug_cat("yes\n"); */
|
||||
return;
|
||||
}
|
||||
// dccp_pr_debug_cat("no\n");
|
||||
/* dccp_pr_debug_cat("no\n"); */
|
||||
|
||||
i = len;
|
||||
while (i--) {
|
||||
@ -744,18 +784,25 @@ static void dccp_ackpkts_check_rcv_ackvector(struct dccp_ackpkts *ap,
|
||||
|
||||
dccp_set_seqno(&ackno_end_rl, ackno - rl);
|
||||
|
||||
// dccp_pr_debug("is %llu <= %llu <= %llu? ", ackno_end_rl, ap->dccpap_ack_seqno, ackno);
|
||||
/*
|
||||
* dccp_pr_debug("is %llu <= %llu <= %llu? ", ackno_end_rl,
|
||||
* ap->dccpap_ack_seqno, ackno);
|
||||
*/
|
||||
if (between48(ap->dccpap_ack_seqno, ackno_end_rl, ackno)) {
|
||||
const u8 state = (*vector & DCCP_ACKPKTS_STATE_MASK) >> 6;
|
||||
// dccp_pr_debug_cat("yes\n");
|
||||
const u8 state = (*vector &
|
||||
DCCP_ACKPKTS_STATE_MASK) >> 6;
|
||||
/* dccp_pr_debug_cat("yes\n"); */
|
||||
|
||||
if (state != DCCP_ACKPKTS_STATE_NOT_RECEIVED) {
|
||||
#ifdef DCCP_DEBUG
|
||||
struct dccp_sock *dp = dccp_sk(sk);
|
||||
const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? "CLIENT rx ack: " :
|
||||
"server rx ack: ";
|
||||
const char *debug_prefix =
|
||||
dp->dccps_role == DCCP_ROLE_CLIENT ?
|
||||
"CLIENT rx ack: " : "server rx ack: ";
|
||||
#endif
|
||||
dccp_pr_debug("%sACK vector 0, len=%d, ack_seqno=%llu, ack_ackno=%llu, ACKED!\n",
|
||||
dccp_pr_debug("%sACK vector 0, len=%d, "
|
||||
"ack_seqno=%llu, ack_ackno=%llu, "
|
||||
"ACKED!\n",
|
||||
debug_prefix, len,
|
||||
(unsigned long long)
|
||||
ap->dccpap_ack_seqno,
|
||||
@ -764,13 +811,13 @@ static void dccp_ackpkts_check_rcv_ackvector(struct dccp_ackpkts *ap,
|
||||
dccp_ackpkts_trow_away_ack_record(ap);
|
||||
}
|
||||
/*
|
||||
* If dccpap_ack_seqno was not received, no problem we'll
|
||||
* send another ACK vector.
|
||||
* If dccpap_ack_seqno was not received, no problem
|
||||
* we'll send another ACK vector.
|
||||
*/
|
||||
ap->dccpap_ack_seqno = DCCP_MAX_SEQNO + 1;
|
||||
break;
|
||||
}
|
||||
// dccp_pr_debug_cat("no\n");
|
||||
/* dccp_pr_debug_cat("no\n"); */
|
||||
|
||||
dccp_set_seqno(&ackno, ackno_end_rl - 1);
|
||||
++vector;
|
||||
|
@ -40,13 +40,13 @@ int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
|
||||
/* XXX For now we're using only 48 bits sequence numbers */
|
||||
const int dccp_header_size = sizeof(*dh) +
|
||||
sizeof(struct dccp_hdr_ext) +
|
||||
dccp_packet_hdr_len(dcb->dccpd_type);
|
||||
dccp_packet_hdr_len(dcb->dccpd_type);
|
||||
int err, set_ack = 1;
|
||||
u64 ackno = dp->dccps_gsr;
|
||||
|
||||
/*
|
||||
* FIXME: study DCCP_PKT_SYNC[ACK] to see what is the right thing
|
||||
* to do here...
|
||||
* FIXME: study DCCP_PKT_SYNC[ACK] to see what is the right
|
||||
* thing to do here...
|
||||
*/
|
||||
dccp_inc_seqno(&dp->dccps_gss);
|
||||
|
||||
@ -65,7 +65,9 @@ int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
skb->h.raw = skb_push(skb, dccp_header_size);
|
||||
dh = dccp_hdr(skb);
|
||||
/* Data packets are not cloned as they are never retransmitted */
|
||||
/*
|
||||
* Data packets are not cloned as they are never retransmitted
|
||||
*/
|
||||
if (skb_cloned(skb))
|
||||
skb_set_owner_w(skb, sk);
|
||||
|
||||
@ -86,10 +88,12 @@ int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
switch (dcb->dccpd_type) {
|
||||
case DCCP_PKT_REQUEST:
|
||||
dccp_hdr_request(skb)->dccph_req_service = dcb->dccpd_service;
|
||||
dccp_hdr_request(skb)->dccph_req_service =
|
||||
dcb->dccpd_service;
|
||||
break;
|
||||
case DCCP_PKT_RESET:
|
||||
dccp_hdr_reset(skb)->dccph_reset_code = dcb->dccpd_reset_code;
|
||||
dccp_hdr_reset(skb)->dccph_reset_code =
|
||||
dcb->dccpd_reset_code;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -123,10 +127,13 @@ unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu)
|
||||
int mss_now;
|
||||
|
||||
/*
|
||||
* FIXME: we really should be using the af_specific thing to support IPv6.
|
||||
* mss_now = pmtu - tp->af_specific->net_header_len - sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext);
|
||||
* FIXME: we really should be using the af_specific thing to support
|
||||
* IPv6.
|
||||
* mss_now = pmtu - tp->af_specific->net_header_len -
|
||||
* sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext);
|
||||
*/
|
||||
mss_now = pmtu - sizeof(struct iphdr) - sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext);
|
||||
mss_now = pmtu - sizeof(struct iphdr) - sizeof(struct dccp_hdr) -
|
||||
sizeof(struct dccp_hdr_ext);
|
||||
|
||||
/* Now subtract optional transport overhead */
|
||||
mss_now -= dp->dccps_ext_header_len;
|
||||
@ -223,7 +230,8 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
|
||||
|
||||
dh->dccph_sport = inet_sk(sk)->sport;
|
||||
dh->dccph_dport = inet_rsk(req)->rmt_port;
|
||||
dh->dccph_doff = (dccp_header_size + DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;
|
||||
dh->dccph_doff = (dccp_header_size +
|
||||
DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;
|
||||
dh->dccph_type = DCCP_PKT_RESPONSE;
|
||||
dh->dccph_x = 1;
|
||||
dccp_hdr_set_seq(dh, dccp_rsk(req)->dreq_iss);
|
||||
@ -271,7 +279,8 @@ struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst,
|
||||
|
||||
dh->dccph_sport = inet_sk(sk)->sport;
|
||||
dh->dccph_dport = inet_sk(sk)->dport;
|
||||
dh->dccph_doff = (dccp_header_size + DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;
|
||||
dh->dccph_doff = (dccp_header_size +
|
||||
DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;
|
||||
dh->dccph_type = DCCP_PKT_RESET;
|
||||
dh->dccph_x = 1;
|
||||
dccp_hdr_set_seq(dh, dp->dccps_gss);
|
||||
@ -348,7 +357,9 @@ void dccp_send_ack(struct sock *sk)
|
||||
if (skb == NULL) {
|
||||
inet_csk_schedule_ack(sk);
|
||||
inet_csk(sk)->icsk_ack.ato = TCP_ATO_MIN;
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, TCP_DELACK_MAX, TCP_RTO_MAX);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
|
||||
TCP_DELACK_MAX,
|
||||
DCCP_RTO_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -416,8 +427,10 @@ void dccp_send_sync(struct sock *sk, u64 seq)
|
||||
dccp_transmit_skb(sk, skb);
|
||||
}
|
||||
|
||||
/* Send a DCCP_PKT_CLOSE/CLOSEREQ. The caller locks the socket for us. This cannot be
|
||||
* allowed to fail queueing a DCCP_PKT_CLOSE/CLOSEREQ frame under any circumstances.
|
||||
/*
|
||||
* Send a DCCP_PKT_CLOSE/CLOSEREQ. The caller locks the socket for us. This
|
||||
* cannot be allowed to fail queueing a DCCP_PKT_CLOSE/CLOSEREQ frame under
|
||||
* any circumstances.
|
||||
*/
|
||||
void dccp_send_close(struct sock *sk)
|
||||
{
|
||||
@ -435,7 +448,8 @@ void dccp_send_close(struct sock *sk)
|
||||
/* Reserve space for headers and prepare control bits. */
|
||||
skb_reserve(skb, sk->sk_prot->max_header);
|
||||
skb->csum = 0;
|
||||
DCCP_SKB_CB(skb)->dccpd_type = dp->dccps_role == DCCP_ROLE_CLIENT ? DCCP_PKT_CLOSE : DCCP_PKT_CLOSEREQ;
|
||||
DCCP_SKB_CB(skb)->dccpd_type = dp->dccps_role == DCCP_ROLE_CLIENT ?
|
||||
DCCP_PKT_CLOSE : DCCP_PKT_CLOSEREQ;
|
||||
|
||||
skb_set_owner_w(skb, sk);
|
||||
dccp_transmit_skb(sk, skb);
|
||||
|
@ -55,7 +55,7 @@ struct dccp_rx_hist *dccp_rx_hist_new(const char *name)
|
||||
|
||||
sprintf(slab_name, dccp_rx_hist_mask, name);
|
||||
hist->dccprxh_slab = kmem_cache_create(slab_name,
|
||||
sizeof(struct dccp_rx_hist_entry),
|
||||
sizeof(struct dccp_rx_hist_entry),
|
||||
0, SLAB_HWCACHE_ALIGN,
|
||||
NULL, NULL);
|
||||
if (hist->dccprxh_slab == NULL)
|
||||
@ -128,7 +128,7 @@ struct dccp_tx_hist *dccp_tx_hist_new(const char *name)
|
||||
|
||||
sprintf(slab_name, dccp_tx_hist_mask, name);
|
||||
hist->dccptxh_slab = kmem_cache_create(slab_name,
|
||||
sizeof(struct dccp_tx_hist_entry),
|
||||
sizeof(struct dccp_tx_hist_entry),
|
||||
0, SLAB_HWCACHE_ALIGN,
|
||||
NULL, NULL);
|
||||
if (hist->dccptxh_slab == NULL)
|
||||
@ -156,8 +156,8 @@ void dccp_tx_hist_delete(struct dccp_tx_hist *hist)
|
||||
|
||||
EXPORT_SYMBOL_GPL(dccp_tx_hist_delete);
|
||||
|
||||
struct dccp_tx_hist_entry *dccp_tx_hist_find_entry(const struct list_head *list,
|
||||
const u64 seq)
|
||||
struct dccp_tx_hist_entry *
|
||||
dccp_tx_hist_find_entry(const struct list_head *list, const u64 seq)
|
||||
{
|
||||
struct dccp_tx_hist_entry *packet = NULL, *entry;
|
||||
|
||||
@ -172,7 +172,8 @@ struct dccp_tx_hist_entry *dccp_tx_hist_find_entry(const struct list_head *list,
|
||||
|
||||
EXPORT_SYMBOL_GPL(dccp_tx_hist_find_entry);
|
||||
|
||||
void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist, struct list_head *list,
|
||||
void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist,
|
||||
struct list_head *list,
|
||||
struct dccp_tx_hist_entry *packet)
|
||||
{
|
||||
struct dccp_tx_hist_entry *next;
|
||||
|
@ -115,7 +115,8 @@ extern void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist,
|
||||
extern void dccp_tx_hist_purge(struct dccp_tx_hist *hist,
|
||||
struct list_head *list);
|
||||
|
||||
static inline struct dccp_tx_hist_entry *dccp_tx_hist_head(struct list_head *list)
|
||||
static inline struct dccp_tx_hist_entry *
|
||||
dccp_tx_hist_head(struct list_head *list)
|
||||
{
|
||||
struct dccp_tx_hist_entry *head = NULL;
|
||||
|
||||
@ -163,7 +164,8 @@ static inline void dccp_rx_hist_add_entry(struct list_head *list,
|
||||
list_add(&entry->dccphrx_node, list);
|
||||
}
|
||||
|
||||
static inline struct dccp_rx_hist_entry *dccp_rx_hist_head(struct list_head *list)
|
||||
static inline struct dccp_rx_hist_entry *
|
||||
dccp_rx_hist_head(struct list_head *list)
|
||||
{
|
||||
struct dccp_rx_hist_entry *head = NULL;
|
||||
|
||||
|
@ -255,12 +255,16 @@ int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
||||
|
||||
/* FIXME */
|
||||
#if 0
|
||||
/* Are we at urgent data? Stop if we have read anything or have SIGURG pending. */
|
||||
/*
|
||||
* Are we at urgent data? Stop if we have read anything or
|
||||
* have SIGURG pending.
|
||||
*/
|
||||
if (tp->urg_data && tp->urg_seq == *seq) {
|
||||
if (copied)
|
||||
break;
|
||||
if (signal_pending(current)) {
|
||||
copied = timeo ? sock_intr_errno(timeo) : -EAGAIN;
|
||||
copied = timeo ? sock_intr_errno(timeo) :
|
||||
-EAGAIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -285,7 +289,8 @@ int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
||||
dccp_pr_debug("found fin ok!\n");
|
||||
goto found_fin_ok;
|
||||
}
|
||||
dccp_pr_debug("packet_type=%s\n", dccp_packet_name(dh->dccph_type));
|
||||
dccp_pr_debug("packet_type=%s\n",
|
||||
dccp_packet_name(dh->dccph_type));
|
||||
BUG_TRAP(flags & MSG_PEEK);
|
||||
skb = skb->next;
|
||||
} while (skb != (struct sk_buff *)&sk->sk_receive_queue);
|
||||
@ -439,16 +444,16 @@ out:
|
||||
}
|
||||
|
||||
static const unsigned char dccp_new_state[] = {
|
||||
/* current state: new state: action: */
|
||||
[0] = DCCP_CLOSED,
|
||||
[DCCP_OPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
|
||||
[DCCP_REQUESTING] = DCCP_CLOSED,
|
||||
[DCCP_PARTOPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
|
||||
[DCCP_LISTEN] = DCCP_CLOSED,
|
||||
[DCCP_RESPOND] = DCCP_CLOSED,
|
||||
[DCCP_CLOSING] = DCCP_CLOSED,
|
||||
[DCCP_TIME_WAIT] = DCCP_CLOSED,
|
||||
[DCCP_CLOSED] = DCCP_CLOSED,
|
||||
/* current state: new state: action: */
|
||||
[0] = DCCP_CLOSED,
|
||||
[DCCP_OPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
|
||||
[DCCP_REQUESTING] = DCCP_CLOSED,
|
||||
[DCCP_PARTOPEN] = DCCP_CLOSING | DCCP_ACTION_FIN,
|
||||
[DCCP_LISTEN] = DCCP_CLOSED,
|
||||
[DCCP_RESPOND] = DCCP_CLOSED,
|
||||
[DCCP_CLOSING] = DCCP_CLOSED,
|
||||
[DCCP_TIME_WAIT] = DCCP_CLOSED,
|
||||
[DCCP_CLOSED] = DCCP_CLOSED,
|
||||
};
|
||||
|
||||
static int dccp_close_state(struct sock *sk)
|
||||
@ -541,7 +546,8 @@ struct proto_ops inet_dccp_ops = {
|
||||
.getname = inet_getname,
|
||||
.poll = sock_no_poll,
|
||||
.ioctl = inet_ioctl,
|
||||
.listen = inet_dccp_listen, /* FIXME: work on inet_listen to rename it to sock_common_listen */
|
||||
/* FIXME: work on inet_listen to rename it to sock_common_listen */
|
||||
.listen = inet_dccp_listen,
|
||||
.shutdown = inet_shutdown,
|
||||
.setsockopt = sock_common_setsockopt,
|
||||
.getsockopt = sock_common_getsockopt,
|
||||
@ -638,10 +644,10 @@ static int __init dccp_init(void)
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
dccp_hashinfo.bind_bucket_cachep = kmem_cache_create("dccp_bind_bucket",
|
||||
sizeof(struct inet_bind_bucket),
|
||||
0, SLAB_HWCACHE_ALIGN,
|
||||
NULL, NULL);
|
||||
dccp_hashinfo.bind_bucket_cachep =
|
||||
kmem_cache_create("dccp_bind_bucket",
|
||||
sizeof(struct inet_bind_bucket), 0,
|
||||
SLAB_HWCACHE_ALIGN, NULL, NULL);
|
||||
if (!dccp_hashinfo.bind_bucket_cachep)
|
||||
goto out_proto_unregister;
|
||||
|
||||
@ -657,14 +663,16 @@ static int __init dccp_init(void)
|
||||
goal = num_physpages >> (23 - PAGE_SHIFT);
|
||||
|
||||
if (thash_entries)
|
||||
goal = (thash_entries * sizeof(struct inet_ehash_bucket)) >> PAGE_SHIFT;
|
||||
goal = (thash_entries *
|
||||
sizeof(struct inet_ehash_bucket)) >> PAGE_SHIFT;
|
||||
for (ehash_order = 0; (1UL << ehash_order) < goal; ehash_order++)
|
||||
;
|
||||
do {
|
||||
dccp_hashinfo.ehash_size = (1UL << ehash_order) * PAGE_SIZE /
|
||||
sizeof(struct inet_ehash_bucket);
|
||||
dccp_hashinfo.ehash_size >>= 1;
|
||||
while (dccp_hashinfo.ehash_size & (dccp_hashinfo.ehash_size - 1))
|
||||
while (dccp_hashinfo.ehash_size &
|
||||
(dccp_hashinfo.ehash_size - 1))
|
||||
dccp_hashinfo.ehash_size--;
|
||||
dccp_hashinfo.ehash = (struct inet_ehash_bucket *)
|
||||
__get_free_pages(GFP_ATOMIC, ehash_order);
|
||||
@ -686,7 +694,8 @@ static int __init dccp_init(void)
|
||||
do {
|
||||
dccp_hashinfo.bhash_size = (1UL << bhash_order) * PAGE_SIZE /
|
||||
sizeof(struct inet_bind_hashbucket);
|
||||
if ((dccp_hashinfo.bhash_size > (64 * 1024)) && bhash_order > 0)
|
||||
if ((dccp_hashinfo.bhash_size > (64 * 1024)) &&
|
||||
bhash_order > 0)
|
||||
continue;
|
||||
dccp_hashinfo.bhash = (struct inet_bind_hashbucket *)
|
||||
__get_free_pages(GFP_ATOMIC, bhash_order);
|
||||
|
@ -45,11 +45,13 @@ static int dccp_write_timeout(struct sock *sk)
|
||||
if (sk->sk_state == DCCP_REQUESTING || sk->sk_state == DCCP_PARTOPEN) {
|
||||
if (icsk->icsk_retransmits != 0)
|
||||
dst_negative_advice(&sk->sk_dst_cache);
|
||||
retry_until = icsk->icsk_syn_retries ? : /* FIXME! */ 3 /* FIXME! sysctl_tcp_syn_retries */;
|
||||
retry_until = icsk->icsk_syn_retries ? :
|
||||
/* FIXME! */ 3 /* FIXME! sysctl_tcp_syn_retries */;
|
||||
} else {
|
||||
if (icsk->icsk_retransmits >= /* FIXME! sysctl_tcp_retries1 */ 5 /* FIXME! */) {
|
||||
/* NOTE. draft-ietf-tcpimpl-pmtud-01.txt requires pmtu black
|
||||
hole detection. :-(
|
||||
if (icsk->icsk_retransmits >=
|
||||
/* FIXME! sysctl_tcp_retries1 */ 5 /* FIXME! */) {
|
||||
/* NOTE. draft-ietf-tcpimpl-pmtud-01.txt requires pmtu
|
||||
black hole detection. :-(
|
||||
|
||||
It is place to make it. It is not made. I do not want
|
||||
to make it. It is disguisting. It does not work in any
|
||||
@ -96,14 +98,17 @@ static void dccp_delack_timer(unsigned long data)
|
||||
/* Try again later. */
|
||||
icsk->icsk_ack.blocked = 1;
|
||||
NET_INC_STATS_BH(LINUX_MIB_DELAYEDACKLOCKED);
|
||||
sk_reset_timer(sk, &icsk->icsk_delack_timer, jiffies + TCP_DELACK_MIN);
|
||||
sk_reset_timer(sk, &icsk->icsk_delack_timer,
|
||||
jiffies + TCP_DELACK_MIN);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (sk->sk_state == DCCP_CLOSED || !(icsk->icsk_ack.pending & ICSK_ACK_TIMER))
|
||||
if (sk->sk_state == DCCP_CLOSED ||
|
||||
!(icsk->icsk_ack.pending & ICSK_ACK_TIMER))
|
||||
goto out;
|
||||
if (time_after(icsk->icsk_ack.timeout, jiffies)) {
|
||||
sk_reset_timer(sk, &icsk->icsk_delack_timer, icsk->icsk_ack.timeout);
|
||||
sk_reset_timer(sk, &icsk->icsk_delack_timer,
|
||||
icsk->icsk_ack.timeout);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -112,7 +117,8 @@ static void dccp_delack_timer(unsigned long data)
|
||||
if (inet_csk_ack_scheduled(sk)) {
|
||||
if (!icsk->icsk_ack.pingpong) {
|
||||
/* Delayed ACK missed: inflate ATO. */
|
||||
icsk->icsk_ack.ato = min(icsk->icsk_ack.ato << 1, icsk->icsk_rto);
|
||||
icsk->icsk_ack.ato = min(icsk->icsk_ack.ato << 1,
|
||||
icsk->icsk_rto);
|
||||
} else {
|
||||
/* Delayed ACK missed: leave pingpong mode and
|
||||
* deflate ATO.
|
||||
@ -167,7 +173,7 @@ static void dccp_retransmit_timer(struct sock *sk)
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
|
||||
min(icsk->icsk_rto,
|
||||
TCP_RESOURCE_PROBE_INTERVAL),
|
||||
TCP_RTO_MAX);
|
||||
DCCP_RTO_MAX);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -175,7 +181,8 @@ static void dccp_retransmit_timer(struct sock *sk)
|
||||
icsk->icsk_retransmits++;
|
||||
|
||||
icsk->icsk_rto = min(icsk->icsk_rto << 1, DCCP_RTO_MAX);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, TCP_RTO_MAX);
|
||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto,
|
||||
DCCP_RTO_MAX);
|
||||
if (icsk->icsk_retransmits > 3 /* FIXME: sysctl_dccp_retries1 */)
|
||||
__sk_dst_reset(sk);
|
||||
out:;
|
||||
@ -190,7 +197,8 @@ static void dccp_write_timer(unsigned long data)
|
||||
bh_lock_sock(sk);
|
||||
if (sock_owned_by_user(sk)) {
|
||||
/* Try again later */
|
||||
sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + (HZ / 20));
|
||||
sk_reset_timer(sk, &icsk->icsk_retransmit_timer,
|
||||
jiffies + (HZ / 20));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -198,7 +206,8 @@ static void dccp_write_timer(unsigned long data)
|
||||
goto out;
|
||||
|
||||
if (time_after(icsk->icsk_timeout, jiffies)) {
|
||||
sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout);
|
||||
sk_reset_timer(sk, &icsk->icsk_retransmit_timer,
|
||||
icsk->icsk_timeout);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -220,7 +229,8 @@ out:
|
||||
*/
|
||||
static void dccp_response_timer(struct sock *sk)
|
||||
{
|
||||
inet_csk_reqsk_queue_prune(sk, TCP_SYNQ_INTERVAL, DCCP_TIMEOUT_INIT, DCCP_RTO_MAX);
|
||||
inet_csk_reqsk_queue_prune(sk, TCP_SYNQ_INTERVAL, DCCP_TIMEOUT_INIT,
|
||||
DCCP_RTO_MAX);
|
||||
}
|
||||
|
||||
static void dccp_keepalive_timer(unsigned long data)
|
||||
|
Loading…
Reference in New Issue
Block a user