aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:30:19 -0400
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:45:33 -0400
commitb2e317f4b5ae73733963c702fae0f246d234100b (patch)
tree0c174ee4e9ba342f4bf25c84950582b5a738dcf2 /net/dccp/ccids
parent842d1ef14ff37e9611eab479f31a0d74c1a5c4c0 (diff)
dccp ccid-3: No more CCID control blocks in LISTEN state
The CCIDs are activated as last of the features, at the end of the handshake, were the LISTEN state of the master socket is inherited into the server state of the child socket. Thus, the only states visible to CCIDs now are OPEN/PARTOPEN, and the closing states. This allows to remove tests which were previously necessary to protect against referencing a socket in the listening state (in CCID3), but which now have become redundant. As a further byproduct of enabling the CCIDs only after the connection has been fully established, several typecast-initialisations of ccid3_hc_{rx,tx}_sock can now be eliminated: * the CCID is loaded, so it is not necessary to test if it is NULL, * if it is possible to load a CCID and leave the private area NULL, then this is a bug, which should crash loudly - and earlier, * the test for state==OPEN || state==PARTOPEN now reduces only to the closing phase (e.g. when the node has received an unexpected Reset). Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Diffstat (limited to 'net/dccp/ccids')
-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 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
566static void ccid3_hc_tx_get_info(struct sock *sk, struct tcp_info *info) 566static 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
579static int ccid3_hc_tx_getsockopt(struct sock *sk, const int optname, int len, 572static 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
708static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) 696static 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
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 *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
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 *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))