aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ipv4.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r--net/dccp/ipv4.c59
1 files changed, 12 insertions, 47 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 94a440b2685b..82434e4a42df 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -23,6 +23,7 @@
23#include <net/tcp_states.h> 23#include <net/tcp_states.h>
24#include <net/xfrm.h> 24#include <net/xfrm.h>
25 25
26#include "ackvec.h"
26#include "ccid.h" 27#include "ccid.h"
27#include "dccp.h" 28#include "dccp.h"
28 29
@@ -1112,45 +1113,7 @@ int dccp_v4_rcv(struct sk_buff *skb)
1112 goto discard_it; 1113 goto discard_it;
1113 1114
1114 dh = dccp_hdr(skb); 1115 dh = dccp_hdr(skb);
1115#if 0
1116 /*
1117 * Use something like this to simulate some DATA/DATAACK loss to test
1118 * dccp_ackpkts_add, you'll get something like this on a session that
1119 * sends 10 DATA/DATAACK packets:
1120 *
1121 * ackpkts_print: 281473596467422 |0,0|3,0|0,0|3,0|0,0|3,0|0,0|3,0|0,1|
1122 *
1123 * 0, 0 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == just this packet
1124 * 0, 1 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == two adjacent packets
1125 * with the same state
1126 * 3, 0 means: DCCP_ACKPKTS_STATE_NOT_RECEIVED, RLE == just this packet
1127 *
1128 * So...
1129 *
1130 * 281473596467422 was received
1131 * 281473596467421 was not received
1132 * 281473596467420 was received
1133 * 281473596467419 was not received
1134 * 281473596467418 was received
1135 * 281473596467417 was not received
1136 * 281473596467416 was received
1137 * 281473596467415 was not received
1138 * 281473596467414 was received
1139 * 281473596467413 was received (this one was the 3way handshake
1140 * RESPONSE)
1141 *
1142 */
1143 if (dh->dccph_type == DCCP_PKT_DATA ||
1144 dh->dccph_type == DCCP_PKT_DATAACK) {
1145 static int discard = 0;
1146 1116
1147 if (discard) {
1148 discard = 0;
1149 goto discard_it;
1150 }
1151 discard = 1;
1152 }
1153#endif
1154 DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(skb); 1117 DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(skb);
1155 DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type; 1118 DCCP_SKB_CB(skb)->dccpd_type = dh->dccph_type;
1156 1119
@@ -1264,11 +1227,9 @@ static int dccp_v4_init_sock(struct sock *sk)
1264 do_gettimeofday(&dp->dccps_epoch); 1227 do_gettimeofday(&dp->dccps_epoch);
1265 1228
1266 if (dp->dccps_options.dccpo_send_ack_vector) { 1229 if (dp->dccps_options.dccpo_send_ack_vector) {
1267 dp->dccps_hc_rx_ackpkts = 1230 dp->dccps_hc_rx_ackvec = dccp_ackvec_alloc(DCCP_MAX_ACKVEC_LEN,
1268 dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN, 1231 GFP_KERNEL);
1269 GFP_KERNEL); 1232 if (dp->dccps_hc_rx_ackvec == NULL)
1270
1271 if (dp->dccps_hc_rx_ackpkts == NULL)
1272 return -ENOMEM; 1233 return -ENOMEM;
1273 } 1234 }
1274 1235
@@ -1288,8 +1249,10 @@ static int dccp_v4_init_sock(struct sock *sk)
1288 dp->dccps_hc_tx_ccid == NULL) { 1249 dp->dccps_hc_tx_ccid == NULL) {
1289 ccid_exit(dp->dccps_hc_rx_ccid, sk); 1250 ccid_exit(dp->dccps_hc_rx_ccid, sk);
1290 ccid_exit(dp->dccps_hc_tx_ccid, sk); 1251 ccid_exit(dp->dccps_hc_tx_ccid, sk);
1291 dccp_ackpkts_free(dp->dccps_hc_rx_ackpkts); 1252 if (dp->dccps_options.dccpo_send_ack_vector) {
1292 dp->dccps_hc_rx_ackpkts = NULL; 1253 dccp_ackvec_free(dp->dccps_hc_rx_ackvec);
1254 dp->dccps_hc_rx_ackvec = NULL;
1255 }
1293 dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL; 1256 dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL;
1294 return -ENOMEM; 1257 return -ENOMEM;
1295 } 1258 }
@@ -1331,8 +1294,10 @@ static int dccp_v4_destroy_sock(struct sock *sk)
1331 1294
1332 ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk); 1295 ccid_hc_rx_exit(dp->dccps_hc_rx_ccid, sk);
1333 ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk); 1296 ccid_hc_tx_exit(dp->dccps_hc_tx_ccid, sk);
1334 dccp_ackpkts_free(dp->dccps_hc_rx_ackpkts); 1297 if (dp->dccps_options.dccpo_send_ack_vector) {
1335 dp->dccps_hc_rx_ackpkts = NULL; 1298 dccp_ackvec_free(dp->dccps_hc_rx_ackvec);
1299 dp->dccps_hc_rx_ackvec = NULL;
1300 }
1336 ccid_exit(dp->dccps_hc_rx_ccid, sk); 1301 ccid_exit(dp->dccps_hc_rx_ccid, sk);
1337 ccid_exit(dp->dccps_hc_tx_ccid, sk); 1302 ccid_exit(dp->dccps_hc_tx_ccid, sk);
1338 dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL; 1303 dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL;