aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/dccp/ccids/ccid3.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index a666f3febf2b..4340672a817c 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -564,29 +564,17 @@ static void ccid3_hc_tx_exit(struct sock *sk)
564 564
565static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) 565static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info)
566{ 566{
567 struct ccid3_hc_tx_sock *hc; 567 info->tcpi_rto = ccid3_hc_tx_sk(sk)->tx_t_rto;
568 568 info->tcpi_rtt = ccid3_hc_tx_sk(sk)->tx_rtt;
569 /* Listen socks doesn't have a private CCID block */
570 if (sk->sk_state == DCCP_LISTEN)
571 return;
572
573 hc = ccid3_hc_tx_sk(sk);
574 info->tcpi_rto = hc->tx_t_rto;
575 info->tcpi_rtt = hc->tx_rtt;
576} 569}
577 570
578static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len, 571static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len,
579 u32 __user *optval, int __user *optlen) 572 u32 __user *optval, int __user *optlen)
580{ 573{
581 const struct ccid3_hc_tx_sock *hc; 574 const struct ccid3_hc_tx_sock *hc = ccid3_hc_tx_sk(sk);
582 struct tfrc_tx_info tfrc; 575 struct tfrc_tx_info tfrc;
583 const void *val; 576 const void *val;
584 577
585 /* Listen socks doesn't have a private CCID block */
586 if (sk->sk_state == DCCP_LISTEN)
587 return -EINVAL;
588
589 hc = ccid3_hc_tx_sk(sk);
590 switch (optname) { 578 switch (optname) {
591 case DCCP_SOCKOPT_CCID_TX_INFO: 579 case DCCP_SOCKOPT_CCID_TX_INFO:
592 if (len < sizeof(tfrc)) 580 if (len < sizeof(tfrc))
@@ -706,14 +694,12 @@ static void ccid3_hc_rx_send_feedback(struct sock *sk,
706 694
707static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) 695static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb)
708{ 696{
709 const struct ccid3_hc_rx_sock *hc; 697 const struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk);
710 __be32 x_recv, pinv; 698 __be32 x_recv, pinv;
711 699
712 if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN)) 700 if (!(sk->sk_state == DCCP_OPEN || sk->sk_state == DCCP_PARTOPEN))
713 return 0; 701 return 0;
714 702
715 hc = ccid3_hc_rx_sk(sk);
716
717 if (dccp_packet_without_ack(skb)) 703 if (dccp_packet_without_ack(skb))
718 return 0; 704 return 0;
719 705
@@ -876,30 +862,18 @@ static void ccid3_hc_rx_exit(struct sock *sk)
876 862
877static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info) 863static void ccid3_hc_rx_get_info(struct sock *sk, struct tcp_info *info)
878{ 864{
879 const struct ccid3_hc_rx_sock *hc; 865 info->tcpi_ca_state = ccid3_hc_rx_sk(sk)->rx_state;
880
881 /* Listen socks doesn't have a private CCID block */
882 if (sk->sk_state == DCCP_LISTEN)
883 return;
884
885 hc = ccid3_hc_rx_sk(sk);
886 info->tcpi_ca_state = hc->rx_state;
887 info->tcpi_options |= TCPI_OPT_TIMESTAMPS; 866 info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
888 info->tcpi_rcv_rtt = hc->rx_rtt; 867 info->tcpi_rcv_rtt = ccid3_hc_rx_sk(sk)->rx_rtt;
889} 868}
890 869
891static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len, 870static 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 *hc; 873 const struct ccid3_hc_rx_sock *hc = 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 hc = 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))