sctp_input.c (ceaad40ae729dea2c5d8ffcfdd45bb96fb8969d2) sctp_input.c (851b7298b3f8f09d1a337bcd5bbe7222543872f5)
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.

--- 31 unchanged lines hidden (view full) ---

40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>
43#include <netinet/sctp_input.h>
44#include <netinet/sctp_auth.h>
45#include <netinet/sctp_indata.h>
46#include <netinet/sctp_asconf.h>
47#include <netinet/sctp_bsd_addr.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.

--- 31 unchanged lines hidden (view full) ---

40#include <netinet/sctp_header.h>
41#include <netinet/sctputil.h>
42#include <netinet/sctp_output.h>
43#include <netinet/sctp_input.h>
44#include <netinet/sctp_auth.h>
45#include <netinet/sctp_indata.h>
46#include <netinet/sctp_asconf.h>
47#include <netinet/sctp_bsd_addr.h>
48#include <netinet/sctp_timer.h>
48
49
50
51static void
52sctp_stop_all_cookie_timers(struct sctp_tcb *stcb)
53{
54 struct sctp_nets *net;
55

--- 487 unchanged lines hidden (view full) ---

543 * first one on the list is NOT the primary
544 * sctp_cmpaddr() is much more efficent if
545 * the primary is the first on the list,
546 * make it so.
547 */
548 TAILQ_REMOVE(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
549 TAILQ_INSERT_HEAD(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
550 }
49
50
51
52static void
53sctp_stop_all_cookie_timers(struct sctp_tcb *stcb)
54{
55 struct sctp_nets *net;
56

--- 487 unchanged lines hidden (view full) ---

544 * first one on the list is NOT the primary
545 * sctp_cmpaddr() is much more efficent if
546 * the primary is the first on the list,
547 * make it so.
548 */
549 TAILQ_REMOVE(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
550 TAILQ_INSERT_HEAD(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
551 }
552 /* Mobility adaptation */
553 if ((sctp_is_mobility_feature_on(stcb->sctp_ep,
554 SCTP_MOBILITY_BASE) ||
555 sctp_is_mobility_feature_on(stcb->sctp_ep,
556 SCTP_MOBILITY_FASTHANDOFF)) &&
557 sctp_is_mobility_feature_on(stcb->sctp_ep,
558 SCTP_MOBILITY_PRIM_DELETED)) {
559
560 sctp_timer_stop(SCTP_TIMER_TYPE_PRIM_DELETED, stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_TIMER + SCTP_LOC_7);
561 if (sctp_is_mobility_feature_on(stcb->sctp_ep,
562 SCTP_MOBILITY_FASTHANDOFF)) {
563 sctp_assoc_immediate_retrans(stcb,
564 stcb->asoc.primary_destination);
565 }
566 if (sctp_is_mobility_feature_on(stcb->sctp_ep,
567 SCTP_MOBILITY_BASE)) {
568 sctp_move_chunks_from_deleted_prim(stcb,
569 stcb->asoc.primary_destination);
570 }
571 sctp_delete_prim_timer(stcb->sctp_ep, stcb,
572 stcb->asoc.deleted_primary);
573 }
551 }
552 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED,
553 stcb, 0, (void *)r_net, SCTP_SO_NOT_LOCKED);
554 }
555 r_net->error_count = 0;
556 r_net->hb_responded = 1;
557 tv.tv_sec = cp->heartbeat.hb_info.time_value_1;
558 tv.tv_usec = cp->heartbeat.hb_info.time_value_2;

--- 691 unchanged lines hidden (view full) ---

1250 }
1251 if ((ntohl(initack_cp->init.initiate_tag) == asoc->my_vtag) &&
1252 (ntohl(init_cp->init.initiate_tag) == asoc->peer_vtag)) {
1253 /*
1254 * case D in Section 5.2.4 Table 2: MMAA process accordingly
1255 * to get into the OPEN state
1256 */
1257 if (ntohl(initack_cp->init.initial_tsn) != asoc->init_seq_number) {
574 }
575 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_CONFIRMED,
576 stcb, 0, (void *)r_net, SCTP_SO_NOT_LOCKED);
577 }
578 r_net->error_count = 0;
579 r_net->hb_responded = 1;
580 tv.tv_sec = cp->heartbeat.hb_info.time_value_1;
581 tv.tv_usec = cp->heartbeat.hb_info.time_value_2;

--- 691 unchanged lines hidden (view full) ---

1273 }
1274 if ((ntohl(initack_cp->init.initiate_tag) == asoc->my_vtag) &&
1275 (ntohl(init_cp->init.initiate_tag) == asoc->peer_vtag)) {
1276 /*
1277 * case D in Section 5.2.4 Table 2: MMAA process accordingly
1278 * to get into the OPEN state
1279 */
1280 if (ntohl(initack_cp->init.initial_tsn) != asoc->init_seq_number) {
1258#ifdef INVARIANTS
1259 panic("Case D and non-match seq?");
1260#else
1261 SCTP_PRINTF("Case D, seq non-match %x vs %x?\n",
1262 ntohl(initack_cp->init.initial_tsn),
1263 asoc->init_seq_number);
1264#endif
1281 /*-
1282 * Opps, this means that we somehow generated two vtag's
1283 * the same. I.e. we did:
1284 * Us Peer
1285 * <---INIT(tag=a)------
1286 * ----INIT-ACK(tag=t)-->
1287 * ----INIT(tag=t)------> *1
1288 * <---INIT-ACK(tag=a)---
1289 * <----CE(tag=t)------------- *2
1290 *
1291 * At point *1 we should be generating a different
1292 * tag t'. Which means we would throw away the CE and send
1293 * ours instead. Basically this is case C (throw away side).
1294 */
1295 if (how_indx < sizeof(asoc->cookie_how))
1296 asoc->cookie_how[how_indx] = 17;
1297 return (NULL);
1298
1265 }
1266 switch SCTP_GET_STATE
1267 (asoc) {
1268 case SCTP_STATE_COOKIE_WAIT:
1269 case SCTP_STATE_COOKIE_ECHOED:
1270 /*
1271 * INIT was sent but got a COOKIE_ECHO with the
1272 * correct tags... just accept it...but we must

--- 1139 unchanged lines hidden (view full) ---

2412 */
2413 inp->sctp_flags = (SCTP_PCB_FLAGS_TCPTYPE |
2414 SCTP_PCB_FLAGS_CONNECTED |
2415 SCTP_PCB_FLAGS_IN_TCPPOOL |
2416 SCTP_PCB_FLAGS_UNBOUND |
2417 (SCTP_PCB_COPY_FLAGS & (*inp_p)->sctp_flags) |
2418 SCTP_PCB_FLAGS_DONT_WAKE);
2419 inp->sctp_features = (*inp_p)->sctp_features;
1299 }
1300 switch SCTP_GET_STATE
1301 (asoc) {
1302 case SCTP_STATE_COOKIE_WAIT:
1303 case SCTP_STATE_COOKIE_ECHOED:
1304 /*
1305 * INIT was sent but got a COOKIE_ECHO with the
1306 * correct tags... just accept it...but we must

--- 1139 unchanged lines hidden (view full) ---

2446 */
2447 inp->sctp_flags = (SCTP_PCB_FLAGS_TCPTYPE |
2448 SCTP_PCB_FLAGS_CONNECTED |
2449 SCTP_PCB_FLAGS_IN_TCPPOOL |
2450 SCTP_PCB_FLAGS_UNBOUND |
2451 (SCTP_PCB_COPY_FLAGS & (*inp_p)->sctp_flags) |
2452 SCTP_PCB_FLAGS_DONT_WAKE);
2453 inp->sctp_features = (*inp_p)->sctp_features;
2454 inp->sctp_mobility_features = (*inp_p)->sctp_mobility_features;
2420 inp->sctp_socket = so;
2421 inp->sctp_frag_point = (*inp_p)->sctp_frag_point;
2422 inp->partial_delivery_point = (*inp_p)->partial_delivery_point;
2423 inp->sctp_context = (*inp_p)->sctp_context;
2424 inp->inp_starting_point_for_iterator = NULL;
2425 /*
2426 * copy in the authentication parameters from the
2427 * original endpoint

--- 2668 unchanged lines hidden (view full) ---

5096 SCTPDBG(SCTP_DEBUG_INPUT1,
5097 "Check for chunk output prw:%d tqe:%d tf=%d\n",
5098 stcb->asoc.peers_rwnd,
5099 TAILQ_EMPTY(&stcb->asoc.control_send_queue),
5100 stcb->asoc.total_flight);
5101 un_sent = (stcb->asoc.total_output_queue_size - stcb->asoc.total_flight);
5102
5103 if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue) ||
2455 inp->sctp_socket = so;
2456 inp->sctp_frag_point = (*inp_p)->sctp_frag_point;
2457 inp->partial_delivery_point = (*inp_p)->partial_delivery_point;
2458 inp->sctp_context = (*inp_p)->sctp_context;
2459 inp->inp_starting_point_for_iterator = NULL;
2460 /*
2461 * copy in the authentication parameters from the
2462 * original endpoint

--- 2668 unchanged lines hidden (view full) ---

5131 SCTPDBG(SCTP_DEBUG_INPUT1,
5132 "Check for chunk output prw:%d tqe:%d tf=%d\n",
5133 stcb->asoc.peers_rwnd,
5134 TAILQ_EMPTY(&stcb->asoc.control_send_queue),
5135 stcb->asoc.total_flight);
5136 un_sent = (stcb->asoc.total_output_queue_size - stcb->asoc.total_flight);
5137
5138 if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue) ||
5104 /* For retransmission to new primary destination (by micchie) */
5105 sctp_is_mobility_feature_on(inp, SCTP_MOBILITY_DO_FASTHANDOFF) ||
5106 ((un_sent) &&
5107 (stcb->asoc.peers_rwnd > 0 ||
5108 (stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0)))) {
5139 ((un_sent) &&
5140 (stcb->asoc.peers_rwnd > 0 ||
5141 (stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0)))) {
5109 sctp_mobility_feature_off(inp, SCTP_MOBILITY_DO_FASTHANDOFF);
5110 SCTPDBG(SCTP_DEBUG_INPUT3, "Calling chunk OUTPUT\n");
5111 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED);
5112 SCTPDBG(SCTP_DEBUG_INPUT3, "chunk OUTPUT returns\n");
5113 }
5114#ifdef SCTP_AUDITING_ENABLED
5115 sctp_audit_log(0xE0, 3);
5116 sctp_auditing(2, inp, stcb, net);
5117#endif

--- 231 unchanged lines hidden ---
5142 SCTPDBG(SCTP_DEBUG_INPUT3, "Calling chunk OUTPUT\n");
5143 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED);
5144 SCTPDBG(SCTP_DEBUG_INPUT3, "chunk OUTPUT returns\n");
5145 }
5146#ifdef SCTP_AUDITING_ENABLED
5147 sctp_audit_log(0xE0, 3);
5148 sctp_auditing(2, inp, stcb, net);
5149#endif

--- 231 unchanged lines hidden ---