diff options
Diffstat (limited to 'net/dccp/input.c')
| -rw-r--r-- | net/dccp/input.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c index 7648f316310f..10c957a88f4f 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/dccp.h> | 13 | #include <linux/dccp.h> |
| 14 | #include <linux/skbuff.h> | 14 | #include <linux/skbuff.h> |
| 15 | #include <linux/slab.h> | ||
| 15 | 16 | ||
| 16 | #include <net/sock.h> | 17 | #include <net/sock.h> |
| 17 | 18 | ||
| @@ -123,9 +124,9 @@ static int dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb) | |||
| 123 | return queued; | 124 | return queued; |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | static u8 dccp_reset_code_convert(const u8 code) | 127 | static u16 dccp_reset_code_convert(const u8 code) |
| 127 | { | 128 | { |
| 128 | const u8 error_code[] = { | 129 | const u16 error_code[] = { |
| 129 | [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */ | 130 | [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */ |
| 130 | [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */ | 131 | [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */ |
| 131 | [DCCP_RESET_CODE_ABORTED] = ECONNRESET, | 132 | [DCCP_RESET_CODE_ABORTED] = ECONNRESET, |
| @@ -147,7 +148,7 @@ static u8 dccp_reset_code_convert(const u8 code) | |||
| 147 | 148 | ||
| 148 | static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) | 149 | static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) |
| 149 | { | 150 | { |
| 150 | u8 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code); | 151 | u16 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code); |
| 151 | 152 | ||
| 152 | sk->sk_err = err; | 153 | sk->sk_err = err; |
| 153 | 154 | ||
| @@ -414,7 +415,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, | |||
| 414 | if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, | 415 | if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, |
| 415 | dp->dccps_awl, dp->dccps_awh)) { | 416 | dp->dccps_awl, dp->dccps_awh)) { |
| 416 | dccp_pr_debug("invalid ackno: S.AWL=%llu, " | 417 | dccp_pr_debug("invalid ackno: S.AWL=%llu, " |
| 417 | "P.ackno=%llu, S.AWH=%llu \n", | 418 | "P.ackno=%llu, S.AWH=%llu\n", |
| 418 | (unsigned long long)dp->dccps_awl, | 419 | (unsigned long long)dp->dccps_awl, |
| 419 | (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, | 420 | (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, |
| 420 | (unsigned long long)dp->dccps_awh); | 421 | (unsigned long long)dp->dccps_awh); |
| @@ -429,7 +430,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, | |||
| 429 | if (dccp_parse_options(sk, NULL, skb)) | 430 | if (dccp_parse_options(sk, NULL, skb)) |
| 430 | return 1; | 431 | return 1; |
| 431 | 432 | ||
| 432 | /* Obtain usec RTT sample from SYN exchange (used by CCID 3) */ | 433 | /* Obtain usec RTT sample from SYN exchange (used by TFRC). */ |
| 433 | if (likely(dp->dccps_options_received.dccpor_timestamp_echo)) | 434 | if (likely(dp->dccps_options_received.dccpor_timestamp_echo)) |
| 434 | dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp - | 435 | dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp - |
| 435 | dp->dccps_options_received.dccpor_timestamp_echo)); | 436 | dp->dccps_options_received.dccpor_timestamp_echo)); |
| @@ -534,6 +535,8 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk, | |||
| 534 | const struct dccp_hdr *dh, | 535 | const struct dccp_hdr *dh, |
| 535 | const unsigned len) | 536 | const unsigned len) |
| 536 | { | 537 | { |
| 538 | struct dccp_sock *dp = dccp_sk(sk); | ||
| 539 | u32 sample = dp->dccps_options_received.dccpor_timestamp_echo; | ||
| 537 | int queued = 0; | 540 | int queued = 0; |
| 538 | 541 | ||
| 539 | switch (dh->dccph_type) { | 542 | switch (dh->dccph_type) { |
| @@ -558,7 +561,14 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk, | |||
| 558 | if (sk->sk_state == DCCP_PARTOPEN) | 561 | if (sk->sk_state == DCCP_PARTOPEN) |
| 559 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); | 562 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); |
| 560 | 563 | ||
| 561 | dccp_sk(sk)->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; | 564 | /* Obtain usec RTT sample from SYN exchange (used by TFRC). */ |
| 565 | if (likely(sample)) { | ||
| 566 | long delta = dccp_timestamp() - sample; | ||
| 567 | |||
| 568 | dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * delta); | ||
| 569 | } | ||
| 570 | |||
| 571 | dp->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; | ||
| 562 | dccp_set_state(sk, DCCP_OPEN); | 572 | dccp_set_state(sk, DCCP_OPEN); |
| 563 | 573 | ||
| 564 | if (dh->dccph_type == DCCP_PKT_DATAACK || | 574 | if (dh->dccph_type == DCCP_PKT_DATAACK || |
