diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-03-20 22:21:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 22:21:44 -0500 |
commit | 91f0ebf7b6d5cb2b6e818d48587566144821babe (patch) | |
tree | 505c66f36bd72014d7eacb7a04ea011bae2e9a3a /net/dccp/ipv4.c | |
parent | f38c39d6ce8226519455a6dfe91c2ad84f363f6f (diff) |
[DCCP] CCID: Improve CCID infrastructure
1. No need for ->ccid_init nor ->ccid_exit, this is what module_{init,exit}
does and anynways neither ccid2 nor ccid3 were using it.
2. Rename struct ccid to struct ccid_operations and introduce struct ccid
with a pointer to ccid_operations and rigth after it the rx or tx
private state.
3. Remove the pointer to the state of the half connections from struct
dccp_sock, now its derived thru ccid_priv() from the ccid pointer.
Now we also can implement the setsockopt for changing the CCID easily as
no ccid init routines can affect struct dccp_sock in any way that prevents
other CCIDs from working if a CCID switch operation is asked by apps.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r-- | net/dccp/ipv4.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index fcfb486f90c2..aa7708fed32e 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -1058,14 +1058,16 @@ int dccp_v4_init_sock(struct sock *sk) | |||
1058 | if (dp->dccps_hc_rx_ackvec == NULL) | 1058 | if (dp->dccps_hc_rx_ackvec == NULL) |
1059 | return -ENOMEM; | 1059 | return -ENOMEM; |
1060 | } | 1060 | } |
1061 | dp->dccps_hc_rx_ccid = ccid_init(dp->dccps_options.dccpo_rx_ccid, | 1061 | dp->dccps_hc_rx_ccid = |
1062 | sk); | 1062 | ccid_hc_rx_new(dp->dccps_options.dccpo_rx_ccid, |
1063 | dp->dccps_hc_tx_ccid = ccid_init(dp->dccps_options.dccpo_tx_ccid, | 1063 | sk, GFP_KERNEL); |
1064 | sk); | 1064 | dp->dccps_hc_tx_ccid = |
1065 | if (dp->dccps_hc_rx_ccid == NULL || | 1065 | ccid_hc_tx_new(dp->dccps_options.dccpo_tx_ccid, |
1066 | dp->dccps_hc_tx_ccid == NULL) { | 1066 | sk, GFP_KERNEL); |
1067 | ccid_exit(dp->dccps_hc_rx_ccid, sk); | 1067 | if (unlikely(dp->dccps_hc_rx_ccid == NULL || |
1068 | ccid_exit(dp->dccps_hc_tx_ccid, sk); | 1068 | dp->dccps_hc_tx_ccid == NULL)) { |
1069 | ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); | ||
1070 | ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); | ||
1069 | if (dp->dccps_options.dccpo_send_ack_vector) { | 1071 | if (dp->dccps_options.dccpo_send_ack_vector) { |
1070 | dccp_ackvec_free(dp->dccps_hc_rx_ackvec); | 1072 | dccp_ackvec_free(dp->dccps_hc_rx_ackvec); |
1071 | dp->dccps_hc_rx_ackvec = NULL; | 1073 | dp->dccps_hc_rx_ackvec = NULL; |
@@ -1120,14 +1122,12 @@ int dccp_v4_destroy_sock(struct sock *sk) | |||
1120 | kfree(dp->dccps_service_list); | 1122 | kfree(dp->dccps_service_list); |
1121 | dp->dccps_service_list = NULL; | 1123 | dp->dccps_service_list = NULL; |
1122 | 1124 | ||
1123 | ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk); | ||
1124 | ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk); | ||
1125 | if (dp->dccps_options.dccpo_send_ack_vector) { | 1125 | if (dp->dccps_options.dccpo_send_ack_vector) { |
1126 | dccp_ackvec_free(dp->dccps_hc_rx_ackvec); | 1126 | dccp_ackvec_free(dp->dccps_hc_rx_ackvec); |
1127 | dp->dccps_hc_rx_ackvec = NULL; | 1127 | dp->dccps_hc_rx_ackvec = NULL; |
1128 | } | 1128 | } |
1129 | ccid_exit(dp->dccps_hc_rx_ccid, sk); | 1129 | ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); |
1130 | ccid_exit(dp->dccps_hc_tx_ccid, sk); | 1130 | ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); |
1131 | dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL; | 1131 | dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL; |
1132 | 1132 | ||
1133 | /* clean up feature negotiation state */ | 1133 | /* clean up feature negotiation state */ |