sctp_input.c (171440) | sctp_input.c (171477) |
---|---|
1/*- 2 * Copyright (c) 2001-2007, by 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-2007, by 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 171440 2007-07-14 09:36:28Z rrs $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctp_input.c 171477 2007-07-17 20:58:26Z rrs $"); |
35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_sysctl.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp_output.h> --- 358 unchanged lines hidden (view full) --- 401 SCTPDBG(SCTP_DEBUG_INPUT1, 402 "Load addresses from INIT causes an abort %d\n", 403 retval); 404 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, 405 NULL, 0); 406 *abort_no_unlock = 1; 407 return (-1); 408 } | 35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_var.h> 38#include <netinet/sctp_sysctl.h> 39#include <netinet/sctp_pcb.h> 40#include <netinet/sctp_header.h> 41#include <netinet/sctputil.h> 42#include <netinet/sctp_output.h> --- 358 unchanged lines hidden (view full) --- 401 SCTPDBG(SCTP_DEBUG_INPUT1, 402 "Load addresses from INIT causes an abort %d\n", 403 retval); 404 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, 405 NULL, 0); 406 *abort_no_unlock = 1; 407 return (-1); 408 } |
409 /* if the peer doesn't support asconf, flush the asconf queue */ 410 if (asoc->peer_supports_asconf == 0) { 411 struct sctp_asconf_addr *aparam; 412 413 while (!TAILQ_EMPTY(&asoc->asconf_queue)) { 414 /* sa_ignore FREED_MEMORY */ 415 aparam = TAILQ_FIRST(&asoc->asconf_queue); 416 TAILQ_REMOVE(&asoc->asconf_queue, aparam, next); 417 SCTP_FREE(aparam, SCTP_M_ASC_ADDR); 418 } 419 } |
|
409 stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs, 410 stcb->asoc.local_hmacs); 411 if (op_err) { 412 sctp_queue_op_err(stcb, op_err); 413 /* queuing will steal away the mbuf chain to the out queue */ 414 op_err = NULL; 415 } 416 /* extract the cookie and queue it to "echo" it back... */ --- 5 unchanged lines hidden (view full) --- 422 * cookie. We always cancel at the primary to assue that we are 423 * canceling the timer started by the INIT which always goes to the 424 * primary. 425 */ 426 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, stcb->sctp_ep, stcb, 427 asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_4); 428 429 /* calculate the RTO */ | 420 stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs, 421 stcb->asoc.local_hmacs); 422 if (op_err) { 423 sctp_queue_op_err(stcb, op_err); 424 /* queuing will steal away the mbuf chain to the out queue */ 425 op_err = NULL; 426 } 427 /* extract the cookie and queue it to "echo" it back... */ --- 5 unchanged lines hidden (view full) --- 433 * cookie. We always cancel at the primary to assue that we are 434 * canceling the timer started by the INIT which always goes to the 435 * primary. 436 */ 437 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, stcb->sctp_ep, stcb, 438 asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_4); 439 440 /* calculate the RTO */ |
430 net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered); | 441 net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, sctp_align_safe_nocopy); |
431 432 retval = sctp_send_cookie_echo(m, offset, stcb, net); 433 if (retval < 0) { 434 /* 435 * No cookie, we probably should send a op error. But in any 436 * case if there is no cookie in the INIT-ACK, we can 437 * abandon the peer, its broke. 438 */ --- 111 unchanged lines hidden (view full) --- 550 } 551 /* 552 * JRS 5/14/07 - If CMT PF is on and the destination is in PF state, 553 * set the destination to active state and set the cwnd to one or 554 * two MTU's based on whether PF1 or PF2 is being used. If a T3 555 * timer is running, for the destination, stop the timer because a 556 * PF-heartbeat was received. 557 */ | 442 443 retval = sctp_send_cookie_echo(m, offset, stcb, net); 444 if (retval < 0) { 445 /* 446 * No cookie, we probably should send a op error. But in any 447 * case if there is no cookie in the INIT-ACK, we can 448 * abandon the peer, its broke. 449 */ --- 111 unchanged lines hidden (view full) --- 561 } 562 /* 563 * JRS 5/14/07 - If CMT PF is on and the destination is in PF state, 564 * set the destination to active state and set the cwnd to one or 565 * two MTU's based on whether PF1 or PF2 is being used. If a T3 566 * timer is running, for the destination, stop the timer because a 567 * PF-heartbeat was received. 568 */ |
558 if (sctp_cmt_pf && (net->dest_state & SCTP_ADDR_PF) == | 569 if (sctp_cmt_on_off && sctp_cmt_pf && (net->dest_state & SCTP_ADDR_PF) == |
559 SCTP_ADDR_PF) { 560 if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { 561 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 562 stcb, net, 563 SCTP_FROM_SCTP_INPUT + SCTP_LOC_5); 564 } 565 net->dest_state &= ~SCTP_ADDR_PF; 566 net->cwnd = net->mtu * sctp_cmt_pf; 567 SCTPDBG(SCTP_DEBUG_INPUT1, "Destination %p moved from PF to reachable with cwnd %d.\n", 568 net, net->cwnd); 569 } 570 /* Now lets do a RTO with this */ | 570 SCTP_ADDR_PF) { 571 if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { 572 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, 573 stcb, net, 574 SCTP_FROM_SCTP_INPUT + SCTP_LOC_5); 575 } 576 net->dest_state &= ~SCTP_ADDR_PF; 577 net->cwnd = net->mtu * sctp_cmt_pf; 578 SCTPDBG(SCTP_DEBUG_INPUT1, "Destination %p moved from PF to reachable with cwnd %d.\n", 579 net, net->cwnd); 580 } 581 /* Now lets do a RTO with this */ |
571 r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv); | 582 r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy); |
572} 573 574static void 575sctp_handle_abort(struct sctp_abort_chunk *cp, 576 struct sctp_tcb *stcb, struct sctp_nets *net) 577{ 578 SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: handling ABORT\n"); 579 if (stcb == NULL) --- 632 unchanged lines hidden (view full) --- 1212 /* notify upper layer */ 1213 *notification = SCTP_NOTIFY_ASSOC_UP; 1214 /* 1215 * since we did not send a HB make sure we don't 1216 * double things 1217 */ 1218 net->hb_responded = 1; 1219 net->RTO = sctp_calculate_rto(stcb, asoc, net, | 583} 584 585static void 586sctp_handle_abort(struct sctp_abort_chunk *cp, 587 struct sctp_tcb *stcb, struct sctp_nets *net) 588{ 589 SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: handling ABORT\n"); 590 if (stcb == NULL) --- 632 unchanged lines hidden (view full) --- 1223 /* notify upper layer */ 1224 *notification = SCTP_NOTIFY_ASSOC_UP; 1225 /* 1226 * since we did not send a HB make sure we don't 1227 * double things 1228 */ 1229 net->hb_responded = 1; 1230 net->RTO = sctp_calculate_rto(stcb, asoc, net, |
1220 &cookie->time_entered); | 1231 &cookie->time_entered, sctp_align_unsafe_makecopy); |
1221 1222 if (stcb->asoc.sctp_autoclose_ticks && 1223 (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE))) { 1224 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, 1225 inp, stcb, NULL); 1226 } 1227 break; 1228 default: --- 567 unchanged lines hidden (view full) --- 1796 sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) { 1797 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL); 1798 } 1799 /* respond with a COOKIE-ACK */ 1800 /* calculate the RTT */ 1801 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); 1802 if ((netp) && (*netp)) { 1803 (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp, | 1232 1233 if (stcb->asoc.sctp_autoclose_ticks && 1234 (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE))) { 1235 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, 1236 inp, stcb, NULL); 1237 } 1238 break; 1239 default: --- 567 unchanged lines hidden (view full) --- 1807 sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) { 1808 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL); 1809 } 1810 /* respond with a COOKIE-ACK */ 1811 /* calculate the RTT */ 1812 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); 1813 if ((netp) && (*netp)) { 1814 (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp, |
1804 &cookie->time_entered); | 1815 &cookie->time_entered, sctp_align_unsafe_makecopy); |
1805 } 1806 sctp_send_cookie_ack(stcb); 1807 return (stcb); 1808} 1809 1810 1811/* 1812 * handles a COOKIE-ECHO message stcb: modified to either a new or left as --- 484 unchanged lines hidden (view full) --- 2297 } else { 2298 asoc->state = SCTP_STATE_OPEN; 2299 } 2300 /* update RTO */ 2301 SCTP_STAT_INCR_COUNTER32(sctps_activeestab); 2302 SCTP_STAT_INCR_GAUGE32(sctps_currestab); 2303 if (asoc->overall_error_count == 0) { 2304 net->RTO = sctp_calculate_rto(stcb, asoc, net, | 1816 } 1817 sctp_send_cookie_ack(stcb); 1818 return (stcb); 1819} 1820 1821 1822/* 1823 * handles a COOKIE-ECHO message stcb: modified to either a new or left as --- 484 unchanged lines hidden (view full) --- 2308 } else { 2309 asoc->state = SCTP_STATE_OPEN; 2310 } 2311 /* update RTO */ 2312 SCTP_STAT_INCR_COUNTER32(sctps_activeestab); 2313 SCTP_STAT_INCR_GAUGE32(sctps_currestab); 2314 if (asoc->overall_error_count == 0) { 2315 net->RTO = sctp_calculate_rto(stcb, asoc, net, |
2305 &asoc->time_entered); | 2316 &asoc->time_entered, sctp_align_safe_nocopy); |
2306 } 2307 (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered); 2308 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL); 2309 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || 2310 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { 2311 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; 2312 soisconnected(stcb->sctp_ep->sctp_socket); 2313 } --- 2604 unchanged lines hidden --- | 2317 } 2318 (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered); 2319 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL); 2320 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || 2321 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { 2322 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; 2323 soisconnected(stcb->sctp_ep->sctp_socket); 2324 } --- 2604 unchanged lines hidden --- |