sctp_input.c (164139) | sctp_input.c (164181) |
---|---|
1/*- 2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 164139 2006-11-09 21:01:07Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 164181 2006-11-11 15:59:01Z rrs $"); |
35 36#include "opt_ipsec.h" 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_inet.h" 40#include "opt_sctp.h" 41 42#include <sys/param.h> --- 175 unchanged lines hidden (view full) --- 218 lnet->ssthresh = asoc->peers_rwnd; 219 220#if defined(SCTP_CWND_MONITOR) || defined(SCTP_CWND_LOGGING) 221 sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION); 222#endif 223 224 } 225 } | 35 36#include "opt_ipsec.h" 37#include "opt_compat.h" 38#include "opt_inet6.h" 39#include "opt_inet.h" 40#include "opt_sctp.h" 41 42#include <sys/param.h> --- 175 unchanged lines hidden (view full) --- 218 lnet->ssthresh = asoc->peers_rwnd; 219 220#if defined(SCTP_CWND_MONITOR) || defined(SCTP_CWND_LOGGING) 221 sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION); 222#endif 223 224 } 225 } |
226 SCTP_TCB_SEND_LOCK(stcb); |
|
226 if (asoc->pre_open_streams > ntohs(init->num_inbound_streams)) { 227 unsigned int newcnt; 228 struct sctp_stream_out *outs; 229 struct sctp_stream_queue_pending *sp; 230 231 /* cut back on number of streams */ 232 newcnt = ntohs(init->num_inbound_streams); 233 /* This if is probably not needed but I am cautious */ --- 22 unchanged lines hidden (view full) --- 256 sctp_free_a_strmoq(stcb, sp); 257 sp = TAILQ_FIRST(&outs->outqueue); 258 } 259 } 260 } 261 /* cut back the count and abandon the upper streams */ 262 asoc->pre_open_streams = newcnt; 263 } | 227 if (asoc->pre_open_streams > ntohs(init->num_inbound_streams)) { 228 unsigned int newcnt; 229 struct sctp_stream_out *outs; 230 struct sctp_stream_queue_pending *sp; 231 232 /* cut back on number of streams */ 233 newcnt = ntohs(init->num_inbound_streams); 234 /* This if is probably not needed but I am cautious */ --- 22 unchanged lines hidden (view full) --- 257 sctp_free_a_strmoq(stcb, sp); 258 sp = TAILQ_FIRST(&outs->outqueue); 259 } 260 } 261 } 262 /* cut back the count and abandon the upper streams */ 263 asoc->pre_open_streams = newcnt; 264 } |
264 asoc->streamincnt = ntohs(init->num_outbound_streams); 265 if (asoc->streamincnt > MAX_SCTP_STREAMS) { 266 asoc->streamincnt = MAX_SCTP_STREAMS; 267 } | 265 SCTP_TCB_SEND_UNLOCK(stcb); |
268 asoc->streamoutcnt = asoc->pre_open_streams; 269 /* init tsn's */ 270 asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1; 271#ifdef SCTP_MAP_LOGGING 272 sctp_log_map(0, 5, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 273#endif 274 /* This is the next one we expect */ 275 asoc->str_reset_seq_in = asoc->asconf_seq_in + 1; 276 277 asoc->mapping_array_base_tsn = ntohl(init->initial_tsn); 278 asoc->cumulative_tsn = asoc->asconf_seq_in; 279 asoc->last_echo_tsn = asoc->asconf_seq_in; 280 asoc->advanced_peer_ack_point = asoc->last_acked_seq; 281 /* open the requested streams */ 282 if (asoc->strmin != NULL) { 283 /* Free the old ones */ | 266 asoc->streamoutcnt = asoc->pre_open_streams; 267 /* init tsn's */ 268 asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1; 269#ifdef SCTP_MAP_LOGGING 270 sctp_log_map(0, 5, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); 271#endif 272 /* This is the next one we expect */ 273 asoc->str_reset_seq_in = asoc->asconf_seq_in + 1; 274 275 asoc->mapping_array_base_tsn = ntohl(init->initial_tsn); 276 asoc->cumulative_tsn = asoc->asconf_seq_in; 277 asoc->last_echo_tsn = asoc->asconf_seq_in; 278 asoc->advanced_peer_ack_point = asoc->last_acked_seq; 279 /* open the requested streams */ 280 if (asoc->strmin != NULL) { 281 /* Free the old ones */ |
282 struct sctp_queued_to_read *ctl; 283 284 for (i = 0; i < asoc->streamincnt; i++) { 285 ctl = TAILQ_FIRST(&asoc->strmin[i].inqueue); 286 while (ctl) { 287 TAILQ_REMOVE(&asoc->strmin[i].inqueue, ctl, next); 288 sctp_free_remote_addr(ctl->whoFrom); 289 sctp_m_freem(ctl->data); 290 ctl->data = NULL; 291 sctp_free_a_readq(stcb, ctl); 292 ctl = TAILQ_FIRST(&asoc->strmin[i].inqueue); 293 } 294 } |
|
284 SCTP_FREE(asoc->strmin); 285 } | 295 SCTP_FREE(asoc->strmin); 296 } |
297 asoc->streamincnt = ntohs(init->num_outbound_streams); 298 if (asoc->streamincnt > MAX_SCTP_STREAMS) { 299 asoc->streamincnt = MAX_SCTP_STREAMS; 300 } |
|
286 SCTP_MALLOC(asoc->strmin, struct sctp_stream_in *, asoc->streamincnt * 287 sizeof(struct sctp_stream_in), "StreamsIn"); 288 if (asoc->strmin == NULL) { 289 /* we didn't get memory for the streams! */ 290#ifdef SCTP_DEBUG 291 if (sctp_debug_on & SCTP_DEBUG_INPUT2) { 292 printf("process_init: couldn't get memory for the streams!\n"); 293 } --- 957 unchanged lines hidden (view full) --- 1251 * things 1252 */ 1253 net->hb_responded = 1; 1254 if (stcb->asoc.sctp_autoclose_ticks && 1255 sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) { 1256 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, 1257 NULL); 1258 } | 301 SCTP_MALLOC(asoc->strmin, struct sctp_stream_in *, asoc->streamincnt * 302 sizeof(struct sctp_stream_in), "StreamsIn"); 303 if (asoc->strmin == NULL) { 304 /* we didn't get memory for the streams! */ 305#ifdef SCTP_DEBUG 306 if (sctp_debug_on & SCTP_DEBUG_INPUT2) { 307 printf("process_init: couldn't get memory for the streams!\n"); 308 } --- 957 unchanged lines hidden (view full) --- 1266 * things 1267 */ 1268 net->hb_responded = 1; 1269 if (stcb->asoc.sctp_autoclose_ticks && 1270 sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) { 1271 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, 1272 NULL); 1273 } |
1274 /* 1275 * FIX? Should we go out, in this case (if the seq numbers 1276 * changed on the peer) and set any data to RETRANSMIT? 1277 */ |
|
1259 asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd); 1260 asoc->pre_open_streams = 1261 ntohs(initack_cp->init.num_outbound_streams); | 1278 asoc->my_rwnd = ntohl(initack_cp->init.a_rwnd); 1279 asoc->pre_open_streams = 1280 ntohs(initack_cp->init.num_outbound_streams); |
1262 asoc->init_seq_number = ntohl(initack_cp->init.initial_tsn); 1263 asoc->sending_seq = asoc->asconf_seq_out = asoc->str_reset_seq_out = 1264 asoc->init_seq_number; | |
1265 asoc->last_cwr_tsn = asoc->init_seq_number - 1; 1266 asoc->asconf_seq_in = asoc->last_acked_seq = asoc->init_seq_number - 1; 1267 asoc->str_reset_seq_in = asoc->init_seq_number; 1268 asoc->advanced_peer_ack_point = asoc->last_acked_seq; 1269 1270 /* process the INIT info (peer's info) */ 1271 retval = sctp_process_init(init_cp, stcb, net); 1272 if (retval < 0) { --- 3482 unchanged lines hidden --- | 1281 asoc->last_cwr_tsn = asoc->init_seq_number - 1; 1282 asoc->asconf_seq_in = asoc->last_acked_seq = asoc->init_seq_number - 1; 1283 asoc->str_reset_seq_in = asoc->init_seq_number; 1284 asoc->advanced_peer_ack_point = asoc->last_acked_seq; 1285 1286 /* process the INIT info (peer's info) */ 1287 retval = sctp_process_init(init_cp, stcb, net); 1288 if (retval < 0) { --- 3482 unchanged lines hidden --- |