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. 9 * 10 * b) Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the distribution. 13 * 14 * c) Neither the name of Cisco Systems, Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 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_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */ 32 33 #include <sys/cdefs.h> 34 __FBSDID("$FreeBSD$"); 35 36 #ifndef __sctp_structs_h__ 37 #define __sctp_structs_h__ 38 39 #include <netinet/sctp_os.h> 40 #include <netinet/sctp_header.h> 41 #include <netinet/sctp_auth.h> 42 43 struct sctp_timer { 44 sctp_os_timer_t timer; 45 46 int type; 47 /* 48 * Depending on the timer type these will be setup and cast with the 49 * appropriate entity. 50 */ 51 void *ep; 52 void *tcb; 53 void *net; 54 55 /* for sanity checking */ 56 void *self; 57 uint32_t ticks; 58 uint32_t stopped_from; 59 }; 60 61 62 struct sctp_foo_stuff { 63 struct sctp_inpcb *inp; 64 uint32_t lineno; 65 uint32_t ticks; 66 int updown; 67 }; 68 69 70 /* 71 * This is the information we track on each interface that we know about from 72 * the distant end. 73 */ 74 TAILQ_HEAD(sctpnetlisthead, sctp_nets); 75 76 struct sctp_stream_reset_list { 77 TAILQ_ENTRY(sctp_stream_reset_list) next_resp; 78 uint32_t tsn; 79 int number_entries; 80 struct sctp_stream_reset_out_request req; 81 }; 82 83 TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list); 84 85 /* 86 * Users of the iterator need to malloc a iterator with a call to 87 * sctp_initiate_iterator(inp_func, assoc_func, inp_func, pcb_flags, pcb_features, 88 * asoc_state, void-ptr-arg, uint32-arg, end_func, inp); 89 * 90 * Use the following two defines if you don't care what pcb flags are on the EP 91 * and/or you don't care what state the association is in. 92 * 93 * Note that if you specify an INP as the last argument then ONLY each 94 * association of that single INP will be executed upon. Note that the pcb 95 * flags STILL apply so if the inp you specify has different pcb_flags then 96 * what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS to 97 * assure the inp you specify gets treated. 98 */ 99 #define SCTP_PCB_ANY_FLAGS 0x00000000 100 #define SCTP_PCB_ANY_FEATURES 0x00000000 101 #define SCTP_ASOC_ANY_STATE 0x00000000 102 103 typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr, 104 uint32_t val); 105 typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val); 106 typedef void (*end_func) (void *ptr, uint32_t val); 107 108 struct sctp_iterator { 109 TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr; 110 struct sctp_timer tmr; 111 struct sctp_inpcb *inp; /* current endpoint */ 112 struct sctp_tcb *stcb; /* current* assoc */ 113 asoc_func function_assoc; /* per assoc function */ 114 inp_func function_inp; /* per endpoint function */ 115 inp_func function_inp_end; /* end INP function */ 116 end_func function_atend;/* iterator completion function */ 117 void *pointer; /* pointer for apply func to use */ 118 uint32_t val; /* value for apply func to use */ 119 uint32_t pcb_flags; /* endpoint flags being checked */ 120 uint32_t pcb_features; /* endpoint features being checked */ 121 uint32_t asoc_state; /* assoc state being checked */ 122 uint32_t iterator_flags; 123 uint8_t no_chunk_output; 124 uint8_t done_current_ep; 125 }; 126 127 /* iterator_flags values */ 128 #define SCTP_ITERATOR_DO_ALL_INP 0x00000001 129 #define SCTP_ITERATOR_DO_SINGLE_INP 0x00000002 130 131 TAILQ_HEAD(sctpiterators, sctp_iterator); 132 133 struct sctp_copy_all { 134 struct sctp_inpcb *inp; /* ep */ 135 struct mbuf *m; 136 struct sctp_sndrcvinfo sndrcv; 137 int sndlen; 138 int cnt_sent; 139 int cnt_failed; 140 }; 141 142 struct sctp_asconf_iterator { 143 struct sctpladdr list_of_work; 144 int cnt; 145 }; 146 147 148 struct sctp_net_route { 149 sctp_rtentry_t *ro_rt; 150 union sctp_sockstore _l_addr; /* remote peer addr */ 151 struct sctp_ifa *_s_addr; /* our selected src addr */ 152 }; 153 154 struct sctp_nets { 155 TAILQ_ENTRY(sctp_nets) sctp_next; /* next link */ 156 157 /* 158 * Things on the top half may be able to be split into a common 159 * structure shared by all. 160 */ 161 struct sctp_timer pmtu_timer; 162 163 /* 164 * The following two in combination equate to a route entry for v6 165 * or v4. 166 */ 167 struct sctp_net_route ro; 168 169 /* mtu discovered so far */ 170 uint32_t mtu; 171 uint32_t ssthresh; /* not sure about this one for split */ 172 173 /* smoothed average things for RTT and RTO itself */ 174 int lastsa; 175 int lastsv; 176 unsigned int RTO; 177 178 /* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */ 179 struct sctp_timer rxt_timer; 180 struct sctp_timer fr_timer; /* for early fr */ 181 182 /* last time in seconds I sent to it */ 183 struct timeval last_sent_time; 184 int ref_count; 185 186 /* Congestion stats per destination */ 187 /* 188 * flight size variables and such, sorry Vern, I could not avoid 189 * this if I wanted performance :> 190 */ 191 uint32_t flight_size; 192 uint32_t cwnd; /* actual cwnd */ 193 uint32_t prev_cwnd; /* cwnd before any processing */ 194 uint32_t partial_bytes_acked; /* in CA tracks when to incr a MTU */ 195 uint32_t prev_rtt; 196 /* tracking variables to avoid the aloc/free in sack processing */ 197 unsigned int net_ack; 198 unsigned int net_ack2; 199 200 /* 201 * CMT variables (iyengar@cis.udel.edu) 202 */ 203 uint32_t this_sack_highest_newack; /* tracks highest TSN newly 204 * acked for a given dest in 205 * the current SACK. Used in 206 * SFR and HTNA algos */ 207 uint32_t pseudo_cumack; /* CMT CUC algorithm. Maintains next expected 208 * pseudo-cumack for this destination */ 209 uint32_t rtx_pseudo_cumack; /* CMT CUC algorithm. Maintains next 210 * expected pseudo-cumack for this 211 * destination */ 212 213 /* CMT fast recovery variables */ 214 uint32_t fast_recovery_tsn; 215 uint32_t heartbeat_random1; 216 uint32_t heartbeat_random2; 217 uint32_t tos_flowlabel; 218 219 struct timeval start_time; /* time when this net was created */ 220 221 uint32_t marked_retrans;/* number or DATA chunks marked for timer 222 * based retransmissions */ 223 uint32_t marked_fastretrans; 224 225 /* if this guy is ok or not ... status */ 226 uint16_t dest_state; 227 /* number of transmit failures to down this guy */ 228 uint16_t failure_threshold; 229 /* error stats on destination */ 230 uint16_t error_count; 231 232 uint8_t fast_retran_loss_recovery; 233 uint8_t will_exit_fast_recovery; 234 /* Flags that probably can be combined into dest_state */ 235 uint8_t fast_retran_ip; /* fast retransmit in progress */ 236 uint8_t hb_responded; 237 uint8_t saw_newack; /* CMT's SFR algorithm flag */ 238 uint8_t src_addr_selected; /* if we split we move */ 239 uint8_t indx_of_eligible_next_to_use; 240 uint8_t addr_is_local; /* its a local address (if known) could move 241 * in split */ 242 243 /* 244 * CMT variables (iyengar@cis.udel.edu) 245 */ 246 uint8_t find_pseudo_cumack; /* CMT CUC algorithm. Flag used to 247 * find a new pseudocumack. This flag 248 * is set after a new pseudo-cumack 249 * has been received and indicates 250 * that the sender should find the 251 * next pseudo-cumack expected for 252 * this destination */ 253 uint8_t find_rtx_pseudo_cumack; /* CMT CUCv2 algorithm. Flag used to 254 * find a new rtx-pseudocumack. This 255 * flag is set after a new 256 * rtx-pseudo-cumack has been received 257 * and indicates that the sender 258 * should find the next 259 * rtx-pseudo-cumack expected for this 260 * destination */ 261 uint8_t new_pseudo_cumack; /* CMT CUC algorithm. Flag used to 262 * indicate if a new pseudo-cumack or 263 * rtx-pseudo-cumack has been received */ 264 uint8_t window_probe; /* Doing a window probe? */ 265 uint8_t RTO_measured; /* Have we done the first measure */ 266 #ifdef SCTP_HIGH_SPEED 267 uint8_t last_hs_used; /* index into the last HS table entry we used */ 268 #endif 269 }; 270 271 272 struct sctp_data_chunkrec { 273 uint32_t TSN_seq; /* the TSN of this transmit */ 274 uint16_t stream_seq; /* the stream sequence number of this transmit */ 275 uint16_t stream_number; /* the stream number of this guy */ 276 uint32_t payloadtype; 277 uint32_t context; /* from send */ 278 279 /* ECN Nonce: Nonce Value for this chunk */ 280 uint8_t ect_nonce; 281 282 /* 283 * part of the Highest sacked algorithm to be able to stroke counts 284 * on ones that are FR'd. 285 */ 286 uint32_t fast_retran_tsn; /* sending_seq at the time of FR */ 287 struct timeval timetodrop; /* time we drop it from queue */ 288 uint8_t doing_fast_retransmit; 289 uint8_t rcv_flags; /* flags pulled from data chunk on inbound for 290 * outbound holds sending flags for PR-SCTP. */ 291 uint8_t state_flags; 292 uint8_t chunk_was_revoked; 293 }; 294 295 TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk); 296 297 /* The lower byte is used to enumerate PR_SCTP policies */ 298 #define CHUNK_FLAGS_PR_SCTP_TTL SCTP_PR_SCTP_TTL 299 #define CHUNK_FLAGS_PR_SCTP_BUF SCTP_PR_SCTP_BUF 300 #define CHUNK_FLAGS_PR_SCTP_RTX SCTP_PR_SCTP_RTX 301 302 /* The upper byte is used a a bit mask */ 303 #define CHUNK_FLAGS_FRAGMENT_OK 0x0100 304 305 struct chk_id { 306 uint16_t id; 307 uint16_t can_take_data; 308 }; 309 310 311 struct sctp_tmit_chunk { 312 union { 313 struct sctp_data_chunkrec data; 314 struct chk_id chunk_id; 315 } rec; 316 struct sctp_association *asoc; /* bp to asoc this belongs to */ 317 struct timeval sent_rcv_time; /* filled in if RTT being calculated */ 318 struct mbuf *data; /* pointer to mbuf chain of data */ 319 struct mbuf *last_mbuf; /* pointer to last mbuf in chain */ 320 struct sctp_nets *whoTo; 321 TAILQ_ENTRY(sctp_tmit_chunk) sctp_next; /* next link */ 322 int32_t sent; /* the send status */ 323 uint16_t snd_count; /* number of times I sent */ 324 uint16_t flags; /* flags, such as FRAGMENT_OK */ 325 uint16_t send_size; 326 uint16_t book_size; 327 uint16_t mbcnt; 328 uint8_t pad_inplace; 329 uint8_t do_rtt; 330 uint8_t book_size_scale; 331 uint8_t addr_over; /* flag which is set if the dest address for 332 * this chunk is overridden by user. Used for 333 * CMT (iyengar@cis.udel.edu, 2005/06/21) */ 334 uint8_t no_fr_allowed; 335 uint8_t pr_sctp_on; 336 uint8_t copy_by_ref; 337 uint8_t window_probe; 338 }; 339 340 /* 341 * The first part of this structure MUST be the entire sinfo structure. Maybe 342 * I should have made it a sub structure... we can circle back later and do 343 * that if we want. 344 */ 345 struct sctp_queued_to_read { /* sinfo structure Pluse more */ 346 uint16_t sinfo_stream; /* off the wire */ 347 uint16_t sinfo_ssn; /* off the wire */ 348 uint16_t sinfo_flags; /* SCTP_UNORDERED from wire use SCTP_EOF for 349 * EOR */ 350 uint32_t sinfo_ppid; /* off the wire */ 351 uint32_t sinfo_context; /* pick this up from assoc def context? */ 352 uint32_t sinfo_timetolive; /* not used by kernel */ 353 uint32_t sinfo_tsn; /* Use this in reassembly as first TSN */ 354 uint32_t sinfo_cumtsn; /* Use this in reassembly as last TSN */ 355 sctp_assoc_t sinfo_assoc_id; /* our assoc id */ 356 /* Non sinfo stuff */ 357 uint32_t length; /* length of data */ 358 uint32_t held_length; /* length held in sb */ 359 struct sctp_nets *whoFrom; /* where it came from */ 360 struct mbuf *data; /* front of the mbuf chain of data with 361 * PKT_HDR */ 362 struct mbuf *tail_mbuf; /* used for multi-part data */ 363 struct mbuf *aux_data; /* used to hold/cache control if o/s does not 364 * take it from us */ 365 struct sctp_tcb *stcb; /* assoc, used for window update */ 366 TAILQ_ENTRY(sctp_queued_to_read) next; 367 uint16_t port_from; 368 uint16_t spec_flags; /* Flags to hold the notification field */ 369 uint8_t do_not_ref_stcb; 370 uint8_t end_added; 371 uint8_t pdapi_aborted; 372 uint8_t some_taken; 373 }; 374 375 /* This data structure will be on the outbound 376 * stream queues. Data will be pulled off from 377 * the front of the mbuf data and chunk-ified 378 * by the output routines. We will custom 379 * fit every chunk we pull to the send/sent 380 * queue to make up the next full packet 381 * if we can. An entry cannot be removed 382 * from the stream_out queue until 383 * the msg_is_complete flag is set. This 384 * means at times data/tail_mbuf MIGHT 385 * be NULL.. If that occurs it happens 386 * for one of two reasons. Either the user 387 * is blocked on a send() call and has not 388 * awoken to copy more data down... OR 389 * the user is in the explict MSG_EOR mode 390 * and wrote some data, but has not completed 391 * sending. 392 */ 393 struct sctp_stream_queue_pending { 394 struct mbuf *data; 395 struct mbuf *tail_mbuf; 396 struct timeval ts; 397 struct sctp_nets *net; 398 TAILQ_ENTRY(sctp_stream_queue_pending) next; 399 uint32_t length; 400 uint32_t timetolive; 401 uint32_t ppid; 402 uint32_t context; 403 uint16_t sinfo_flags; 404 uint16_t stream; 405 uint16_t strseq; 406 uint16_t act_flags; 407 uint8_t msg_is_complete; 408 uint8_t some_taken; 409 uint8_t addr_over; 410 uint8_t pr_sctp_on; 411 uint8_t sender_all_done; 412 uint8_t put_last_out; 413 }; 414 415 /* 416 * this struct contains info that is used to track inbound stream data and 417 * help with ordering. 418 */ 419 TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in); 420 struct sctp_stream_in { 421 struct sctp_readhead inqueue; 422 uint16_t stream_no; 423 uint16_t last_sequence_delivered; /* used for re-order */ 424 uint8_t delivery_started; 425 }; 426 427 /* This struct is used to track the traffic on outbound streams */ 428 TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); 429 struct sctp_stream_out { 430 struct sctp_streamhead outqueue; 431 TAILQ_ENTRY(sctp_stream_out) next_spoke; /* next link in wheel */ 432 uint16_t stream_no; 433 uint16_t next_sequence_sent; /* next one I expect to send out */ 434 uint8_t last_msg_incomplete; 435 }; 436 437 /* used to keep track of the addresses yet to try to add/delete */ 438 TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); 439 struct sctp_asconf_addr { 440 TAILQ_ENTRY(sctp_asconf_addr) next; 441 struct sctp_asconf_addr_param ap; 442 struct sctp_ifa *ifa; /* save the ifa for add/del ip */ 443 uint8_t sent; /* has this been sent yet? */ 444 }; 445 446 struct sctp_scoping { 447 uint8_t ipv4_addr_legal; 448 uint8_t ipv6_addr_legal; 449 uint8_t loopback_scope; 450 uint8_t ipv4_local_scope; 451 uint8_t local_scope; 452 uint8_t site_scope; 453 }; 454 455 #define SCTP_TSN_LOG_SIZE 40 456 457 struct sctp_tsn_log { 458 uint32_t tsn; 459 uint16_t strm; 460 uint16_t seq; 461 uint16_t sz; 462 uint16_t flgs; 463 }; 464 465 466 467 /* This struct is here to cut out the compatiabilty 468 * pad that bulks up both the inp and stcb. The non 469 * pad portion MUST stay in complete sync with 470 * sctp_sndrcvinfo... i.e. if sinfo_xxxx is added 471 * this must be done here too. 472 */ 473 struct sctp_nonpad_sndrcvinfo { 474 uint16_t sinfo_stream; 475 uint16_t sinfo_ssn; 476 uint16_t sinfo_flags; 477 uint32_t sinfo_ppid; 478 uint32_t sinfo_context; 479 uint32_t sinfo_timetolive; 480 uint32_t sinfo_tsn; 481 uint32_t sinfo_cumtsn; 482 sctp_assoc_t sinfo_assoc_id; 483 }; 484 485 /* 486 * Here we have information about each individual association that we track. 487 * We probably in production would be more dynamic. But for ease of 488 * implementation we will have a fixed array that we hunt for in a linear 489 * fashion. 490 */ 491 struct sctp_association { 492 /* association state */ 493 int state; 494 /* queue of pending addrs to add/delete */ 495 struct sctp_asconf_addrhead asconf_queue; 496 struct timeval time_entered; /* time we entered state */ 497 struct timeval time_last_rcvd; 498 struct timeval time_last_sent; 499 struct timeval time_last_sat_advance; 500 struct sctp_nonpad_sndrcvinfo def_send; 501 502 /* timers and such */ 503 struct sctp_timer hb_timer; /* hb timer */ 504 struct sctp_timer dack_timer; /* Delayed ack timer */ 505 struct sctp_timer asconf_timer; /* Asconf */ 506 struct sctp_timer strreset_timer; /* stream reset */ 507 struct sctp_timer shut_guard_timer; /* guard */ 508 struct sctp_timer autoclose_timer; /* automatic close timer */ 509 struct sctp_timer delayed_event_timer; /* timer for delayed events */ 510 511 /* list of local addresses when add/del in progress */ 512 struct sctpladdr sctp_restricted_addrs; 513 514 struct sctpnetlisthead nets; 515 516 /* Free chunk list */ 517 struct sctpchunk_listhead free_chunks; 518 519 520 /* Control chunk queue */ 521 struct sctpchunk_listhead control_send_queue; 522 523 /* 524 * Once a TSN hits the wire it is moved to the sent_queue. We 525 * maintain two counts here (don't know if any but retran_cnt is 526 * needed). The idea is that the sent_queue_retran_cnt reflects how 527 * many chunks have been marked for retranmission by either T3-rxt 528 * or FR. 529 */ 530 struct sctpchunk_listhead sent_queue; 531 struct sctpchunk_listhead send_queue; 532 533 534 /* re-assembly queue for fragmented chunks on the inbound path */ 535 struct sctpchunk_listhead reasmqueue; 536 537 /* 538 * this queue is used when we reach a condition that we can NOT put 539 * data into the socket buffer. We track the size of this queue and 540 * set our rwnd to the space in the socket minus also the 541 * size_on_delivery_queue. 542 */ 543 struct sctpwheel_listhead out_wheel; 544 545 /* 546 * This pointer will be set to NULL most of the time. But when we 547 * have a fragmented message, where we could not get out all of the 548 * message at the last send then this will point to the stream to go 549 * get data from. 550 */ 551 struct sctp_stream_out *locked_on_sending; 552 553 /* If an iterator is looking at me, this is it */ 554 struct sctp_iterator *stcb_starting_point_for_iterator; 555 556 /* ASCONF destination address last sent to */ 557 /* struct sctp_nets *asconf_last_sent_to;*/ 558 /* Peter, greppign for the above shows only on strange set 559 * I don't think we need it so I have commented it out. 560 */ 561 562 /* ASCONF save the last ASCONF-ACK so we can resend it if necessary */ 563 struct mbuf *last_asconf_ack_sent; 564 565 /* 566 * pointer to last stream reset queued to control queue by us with 567 * requests. 568 */ 569 struct sctp_tmit_chunk *str_reset; 570 /* 571 * if Source Address Selection happening, this will rotate through 572 * the link list. 573 */ 574 struct sctp_laddr *last_used_address; 575 576 /* stream arrays */ 577 struct sctp_stream_in *strmin; 578 struct sctp_stream_out *strmout; 579 uint8_t *mapping_array; 580 /* primary destination to use */ 581 struct sctp_nets *primary_destination; 582 /* For CMT */ 583 struct sctp_nets *last_net_data_came_from; 584 /* last place I got a data chunk from */ 585 struct sctp_nets *last_data_chunk_from; 586 /* last place I got a control from */ 587 struct sctp_nets *last_control_chunk_from; 588 589 /* circular looking for output selection */ 590 struct sctp_stream_out *last_out_stream; 591 592 /* 593 * wait to the point the cum-ack passes req->send_reset_at_tsn for 594 * any req on the list. 595 */ 596 struct sctp_resethead resetHead; 597 598 /* queue of chunks waiting to be sent into the local stack */ 599 struct sctp_readhead pending_reply_queue; 600 601 uint32_t vrf_id; 602 603 uint32_t cookie_preserve_req; 604 /* ASCONF next seq I am sending out, inits at init-tsn */ 605 uint32_t asconf_seq_out; 606 /* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */ 607 uint32_t asconf_seq_in; 608 609 /* next seq I am sending in str reset messages */ 610 uint32_t str_reset_seq_out; 611 /* next seq I am expecting in str reset messages */ 612 uint32_t str_reset_seq_in; 613 614 /* various verification tag information */ 615 uint32_t my_vtag; /* The tag to be used. if assoc is re-initited 616 * by remote end, and I have unlocked this 617 * will be regenerated to a new random value. */ 618 uint32_t peer_vtag; /* The peers last tag */ 619 620 uint32_t my_vtag_nonce; 621 uint32_t peer_vtag_nonce; 622 623 uint32_t assoc_id; 624 625 /* This is the SCTP fragmentation threshold */ 626 uint32_t smallest_mtu; 627 628 /* 629 * Special hook for Fast retransmit, allows us to track the highest 630 * TSN that is NEW in this SACK if gap ack blocks are present. 631 */ 632 uint32_t this_sack_highest_gap; 633 634 /* 635 * The highest consecutive TSN that has been acked by peer on my 636 * sends 637 */ 638 uint32_t last_acked_seq; 639 640 /* The next TSN that I will use in sending. */ 641 uint32_t sending_seq; 642 643 /* Original seq number I used ??questionable to keep?? */ 644 uint32_t init_seq_number; 645 646 647 /* The Advanced Peer Ack Point, as required by the PR-SCTP */ 648 /* (A1 in Section 4.2) */ 649 uint32_t advanced_peer_ack_point; 650 651 /* 652 * The highest consequetive TSN at the bottom of the mapping array 653 * (for his sends). 654 */ 655 uint32_t cumulative_tsn; 656 /* 657 * Used to track the mapping array and its offset bits. This MAY be 658 * lower then cumulative_tsn. 659 */ 660 uint32_t mapping_array_base_tsn; 661 /* 662 * used to track highest TSN we have received and is listed in the 663 * mapping array. 664 */ 665 uint32_t highest_tsn_inside_map; 666 667 uint32_t last_echo_tsn; 668 uint32_t last_cwr_tsn; 669 uint32_t fast_recovery_tsn; 670 uint32_t sat_t3_recovery_tsn; 671 uint32_t tsn_last_delivered; 672 /* 673 * For the pd-api we should re-write this a bit more efficent. We 674 * could have multiple sctp_queued_to_read's that we are building at 675 * once. Now we only do this when we get ready to deliver to the 676 * socket buffer. Note that we depend on the fact that the struct is 677 * "stuck" on the read queue until we finish all the pd-api. 678 */ 679 struct sctp_queued_to_read *control_pdapi; 680 681 uint32_t tsn_of_pdapi_last_delivered; 682 uint32_t pdapi_ppid; 683 uint32_t context; 684 uint32_t last_reset_action[SCTP_MAX_RESET_PARAMS]; 685 uint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS]; 686 uint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS]; 687 #ifdef SCTP_ASOCLOG_OF_TSNS 688 /* 689 * special log - This adds considerable size to the asoc, but 690 * provides a log that you can use to detect problems via kgdb. 691 */ 692 struct sctp_tsn_log in_tsnlog[SCTP_TSN_LOG_SIZE]; 693 struct sctp_tsn_log out_tsnlog[SCTP_TSN_LOG_SIZE]; 694 uint16_t tsn_in_at; 695 uint16_t tsn_out_at; 696 uint16_t tsn_in_wrapped; 697 uint16_t tsn_out_wrapped; 698 #endif /* SCTP_ASOCLOG_OF_TSNS */ 699 /* 700 * window state information and smallest MTU that I use to bound 701 * segmentation 702 */ 703 uint32_t peers_rwnd; 704 uint32_t my_rwnd; 705 uint32_t my_last_reported_rwnd; 706 uint32_t my_rwnd_control_len; 707 uint32_t sctp_frag_point; 708 709 uint32_t total_output_queue_size; 710 711 uint32_t sb_cc; /* shadow of sb_cc in one-2-one */ 712 uint32_t sb_mbcnt; /* shadow of sb_mbcnt in one-2-one */ 713 /* 32 bit nonce stuff */ 714 uint32_t nonce_resync_tsn; 715 uint32_t nonce_wait_tsn; 716 uint32_t default_flowlabel; 717 uint32_t pr_sctp_cnt; 718 int ctrl_queue_cnt; /* could be removed REM */ 719 /* 720 * All outbound datagrams queue into this list from the individual 721 * stream queue. Here they get assigned a TSN and then await 722 * sending. The stream seq comes when it is first put in the 723 * individual str queue 724 */ 725 unsigned int stream_queue_cnt; 726 unsigned int send_queue_cnt; 727 unsigned int sent_queue_cnt; 728 unsigned int sent_queue_cnt_removeable; 729 /* 730 * Number on sent queue that are marked for retran until this value 731 * is 0 we only send one packet of retran'ed data. 732 */ 733 unsigned int sent_queue_retran_cnt; 734 735 unsigned int size_on_reasm_queue; 736 unsigned int cnt_on_reasm_queue; 737 /* amount of data (bytes) currently in flight (on all destinations) */ 738 unsigned int total_flight; 739 /* Total book size in flight */ 740 unsigned int total_flight_count; /* count of chunks used with 741 * book total */ 742 /* count of destinaton nets and list of destination nets */ 743 unsigned int numnets; 744 745 /* Total error count on this association */ 746 unsigned int overall_error_count; 747 748 unsigned int cnt_msg_on_sb; 749 750 /* All stream count of chunks for delivery */ 751 unsigned int size_on_all_streams; 752 unsigned int cnt_on_all_streams; 753 754 /* Heart Beat delay in ticks */ 755 unsigned int heart_beat_delay; 756 757 /* autoclose */ 758 unsigned int sctp_autoclose_ticks; 759 760 /* how many preopen streams we have */ 761 unsigned int pre_open_streams; 762 763 /* How many streams I support coming into me */ 764 unsigned int max_inbound_streams; 765 766 /* the cookie life I award for any cookie, in seconds */ 767 unsigned int cookie_life; 768 /* time to delay acks for */ 769 unsigned int delayed_ack; 770 unsigned int old_delayed_ack; 771 unsigned int sack_freq; 772 unsigned int data_pkts_seen; 773 774 unsigned int numduptsns; 775 int dup_tsns[SCTP_MAX_DUP_TSNS]; 776 unsigned int initial_init_rto_max; /* initial RTO for INIT's */ 777 unsigned int initial_rto; /* initial send RTO */ 778 unsigned int minrto; /* per assoc RTO-MIN */ 779 unsigned int maxrto; /* per assoc RTO-MAX */ 780 781 /* authentication fields */ 782 sctp_auth_chklist_t *local_auth_chunks; 783 sctp_auth_chklist_t *peer_auth_chunks; 784 sctp_hmaclist_t *local_hmacs; /* local HMACs supported */ 785 sctp_hmaclist_t *peer_hmacs; /* peer HMACs supported */ 786 struct sctp_keyhead shared_keys; /* assoc's shared keys */ 787 sctp_authinfo_t authinfo; /* randoms, cached keys */ 788 /* 789 * refcnt to block freeing when a sender or receiver is off coping 790 * user data in. 791 */ 792 uint32_t refcnt; 793 uint32_t chunks_on_out_queue; /* total chunks floating around, 794 * locked by send socket buffer */ 795 796 uint16_t peer_hmac_id; /* peer HMAC id to send */ 797 798 /* 799 * Being that we have no bag to collect stale cookies, and that we 800 * really would not want to anyway.. we will count them in this 801 * counter. We of course feed them to the pigeons right away (I have 802 * always thought of pigeons as flying rats). 803 */ 804 uint16_t stale_cookie_count; 805 806 /* 807 * For the partial delivery API, if up, invoked this is what last 808 * TSN I delivered 809 */ 810 uint16_t str_of_pdapi; 811 uint16_t ssn_of_pdapi; 812 813 /* counts of actual built streams. Allocation may be more however */ 814 /* could re-arrange to optimize space here. */ 815 uint16_t streamincnt; 816 uint16_t streamoutcnt; 817 818 /* my maximum number of retrans of INIT and SEND */ 819 /* copied from SCTP but should be individually setable */ 820 uint16_t max_init_times; 821 uint16_t max_send_times; 822 823 uint16_t def_net_failure; 824 825 /* 826 * lock flag: 0 is ok to send, 1+ (duals as a retran count) is 827 * awaiting ACK 828 */ 829 uint16_t asconf_sent; /* possibly removable REM */ 830 uint16_t mapping_array_size; 831 832 uint16_t last_strm_seq_delivered; 833 uint16_t last_strm_no_delivered; 834 835 uint16_t last_revoke_count; 836 int16_t num_send_timers_up; 837 838 uint16_t stream_locked_on; 839 uint16_t ecn_echo_cnt_onq; 840 841 uint16_t free_chunk_cnt; 842 843 uint8_t stream_locked; 844 uint8_t authenticated; /* packet authenticated ok */ 845 /* 846 * This flag indicates that a SACK need to be sent. Initially this 847 * is 1 to send the first sACK immediately. 848 */ 849 uint8_t send_sack; 850 851 /* max burst after fast retransmit completes */ 852 uint8_t max_burst; 853 854 uint8_t sat_network; /* RTT is in range of sat net or greater */ 855 uint8_t sat_network_lockout; /* lockout code */ 856 uint8_t burst_limit_applied; /* Burst limit in effect at last send? */ 857 /* flag goes on when we are doing a partial delivery api */ 858 uint8_t hb_random_values[4]; 859 uint8_t fragmented_delivery_inprogress; 860 uint8_t fragment_flags; 861 uint8_t last_flags_delivered; 862 uint8_t hb_ect_randombit; 863 uint8_t hb_random_idx; 864 uint8_t hb_is_disabled; /* is the hb disabled? */ 865 uint8_t default_tos; 866 867 /* ECN Nonce stuff */ 868 uint8_t receiver_nonce_sum; /* nonce I sum and put in my sack */ 869 uint8_t ecn_nonce_allowed; /* Tells us if ECN nonce is on */ 870 uint8_t nonce_sum_check;/* On off switch used during re-sync */ 871 uint8_t nonce_wait_for_ecne; /* flag when we expect a ECN */ 872 uint8_t peer_supports_ecn_nonce; 873 874 /* 875 * This value, plus all other ack'd but above cum-ack is added 876 * together to cross check against the bit that we have yet to 877 * define (probably in the SACK). When the cum-ack is updated, this 878 * sum is updated as well. 879 */ 880 uint8_t nonce_sum_expect_base; 881 /* Flag to tell if ECN is allowed */ 882 uint8_t ecn_allowed; 883 884 /* flag to indicate if peer can do asconf */ 885 uint8_t peer_supports_asconf; 886 /* pr-sctp support flag */ 887 uint8_t peer_supports_prsctp; 888 /* peer authentication support flag */ 889 uint8_t peer_supports_auth; 890 /* stream resets are supported by the peer */ 891 uint8_t peer_supports_strreset; 892 893 /* 894 * packet drop's are supported by the peer, we don't really care 895 * about this but we bookkeep it anyway. 896 */ 897 uint8_t peer_supports_pktdrop; 898 899 /* Do we allow V6/V4? */ 900 uint8_t ipv4_addr_legal; 901 uint8_t ipv6_addr_legal; 902 /* Address scoping flags */ 903 /* scope value for IPv4 */ 904 uint8_t ipv4_local_scope; 905 /* scope values for IPv6 */ 906 uint8_t local_scope; 907 uint8_t site_scope; 908 /* loopback scope */ 909 uint8_t loopback_scope; 910 /* flags to handle send alternate net tracking */ 911 uint8_t used_alt_onsack; 912 uint8_t used_alt_asconfack; 913 uint8_t fast_retran_loss_recovery; 914 uint8_t sat_t3_loss_recovery; 915 uint8_t dropped_special_cnt; 916 uint8_t seen_a_sack_this_pkt; 917 uint8_t stream_reset_outstanding; 918 uint8_t stream_reset_out_is_outstanding; 919 uint8_t delayed_connection; 920 uint8_t ifp_had_enobuf; 921 uint8_t saw_sack_with_frags; 922 uint8_t in_restart_hash; 923 uint8_t assoc_up_sent; 924 /* CMT variables */ 925 uint8_t cmt_dac_pkts_rcvd; 926 uint8_t sctp_cmt_on_off; 927 uint8_t iam_blocking; 928 uint8_t cookie_how[8]; 929 /* 930 * The mapping array is used to track out of order sequences above 931 * last_acked_seq. 0 indicates packet missing 1 indicates packet 932 * rec'd. We slide it up every time we raise last_acked_seq and 0 933 * trailing locactions out. If I get a TSN above the array 934 * mappingArraySz, I discard the datagram and let retransmit happen. 935 */ 936 uint32_t marked_retrans; 937 uint32_t timoinit; 938 uint32_t timodata; 939 uint32_t timosack; 940 uint32_t timoshutdown; 941 uint32_t timoheartbeat; 942 uint32_t timocookie; 943 uint32_t timoshutdownack; 944 struct timeval start_time; 945 struct timeval discontinuity_time; 946 }; 947 948 #endif 949