diff options
-rw-r--r-- | net/dccp/ccids/ccid3.c | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 2f026ce27148..b4cc62e2e2bb 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -565,29 +565,17 @@ static void ccid3_hc_tx_exit(struct sock *sk) | |||
565 | 565 | ||
566 | static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) | 566 | static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) |
567 | { | 567 | { |
568 | struct ccid3_hc_tx_sock *hctx; | 568 | info->tcpi_rto = ccid3_hc_tx_sk(sk)->t_rto; |
569 | 569 | info->tcpi_rtt = ccid3_hc_tx_sk(sk)->rtt; | |
570 | /* Listen socks doesn't have a private CCID block */ | ||
571 | if (sk->sk_state == DCCP_LISTEN) | ||
572 | return; | ||
573 | |||
574 | hctx = ccid3_hc_tx_sk(sk); | ||
575 | info->tcpi_rto = hctx->t_rto; | ||
576 | info->tcpi_rtt = hctx->rtt; | ||
577 | } | 570 | } |
578 | 571 | ||
579 | static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len, | 572 | static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len, |
580 | u32 __user *optval, int __user *optlen) | 573 | u32 __user *optval, int __user *optlen) |
581 | { | 574 | { |
582 | const struct ccid3_hc_tx_sock *hctx; | 575 | const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
583 | struct tfrc_tx_info tfrc; | 576 | struct tfrc_tx_info tfrc; |
584 | const void *val; | 577 | const void *val; |
585 | 578 | ||
586 | /* Listen socks doesn't have a private CCID block */ | ||
587 | if (sk->sk_state == DCCP_LISTEN) | ||
588 | return -EINVAL; | ||
589 | |||
590 | hctx = ccid3_hc_tx_sk(sk); | ||
591 | switch (optname) { | 579 | switch (optname) { |
592 | case DCCP_SOCKOPT_CCID_TX_INFO: | 580 | case DCCP_SOCKOPT_CCID_TX_INFO: |
593 | if (len < sizeof(tfrc)) | 581 | if (len < sizeof(tfrc)) |
@@ -707,14 +695,12 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk, | |||
707 | 695 | ||
708 | static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) | 696 | static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) |
709 | { | 697 | { |
710 | const struct ccid3_hc_rx_sock *hcrx; | 698 | const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); |
711 | __be32 x_recv, pinv; | 699 | __be32 x_recv, pinv; |
712 | 700 | ||
713 | if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN)) | 701 | if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN)) |
714 | return 0; | 702 | return 0; |
715 | 703 | ||
716 | hcrx = ccid3_hc_rx_sk(sk); | ||
717 | |||
718 | if (dccp_packet_without_ack(skb)) | 704 | if (dccp_packet_without_ack(skb)) |
719 | return 0; | 705 | return 0; |
720 | 706 | ||
@@ -876,30 +862,18 @@ static void ccid3_hc_rx_exit(struct sock *sk) | |||
876 | 862 | ||
877 | static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info) | 863 | static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info) |
878 | { | 864 | { |
879 | const struct ccid3_hc_rx_sock *hcrx; | 865 | info->tcpi_ca_state = ccid3_hc_rx_sk(sk)->state; |
880 | |||
881 | /* Listen socks doesn't have a private CCID block */ | ||
882 | if (sk->sk_state == DCCP_LISTEN) | ||
883 | return; | ||
884 | |||
885 | hcrx = ccid3_hc_rx_sk(sk); | ||
886 | info->tcpi_ca_state = hcrx->state; | ||
887 | info->tcpi_options |= TCPI_OPT_TIMESTAMPS; | 866 | info->tcpi_options |= TCPI_OPT_TIMESTAMPS; |
888 | info->tcpi_rcv_rtt = hcrx->rtt; | 867 | info->tcpi_rcv_rtt = ccid3_hc_rx_sk(sk)->rtt; |
889 | } | 868 | } |
890 | 869 | ||
891 | static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len, | 870 | static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len, |
892 | u32 __user *optval, int __user *optlen) | 871 | u32 __user *optval, int __user *optlen) |
893 | { | 872 | { |
894 | const struct ccid3_hc_rx_sock *hcrx; | 873 | const struct ccid3_hc_rx_sock *hcrx = ccid3_hc_rx_sk(sk); |
895 | struct tfrc_rx_info rx_info; | 874 | struct tfrc_rx_info rx_info; |
896 | const void *val; | 875 | const void *val; |
897 | 876 | ||
898 | /* Listen socks doesn't have a private CCID block */ | ||
899 | if (sk->sk_state == DCCP_LISTEN) | ||
900 | return -EINVAL; | ||
901 | |||
902 | hcrx = ccid3_hc_rx_sk(sk); | ||
903 | switch (optname) { | 877 | switch (optname) { |
904 | case DCCP_SOCKOPT_CCID_RX_INFO: | 878 | case DCCP_SOCKOPT_CCID_RX_INFO: |
905 | if (len < sizeof(rx_info)) | 879 | if (len < sizeof(rx_info)) |