xref: /freebsd/sys/netinet/sctp_structs.h (revision 5dcd9c10612684d1c823670cbb5b4715028784e7)
1 /*-
2  * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
3  * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.
4  * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * a) Redistributions of source code must retain the above copyright notice,
10  *   this list of conditions and the following disclaimer.
11  *
12  * b) Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in
14  *   the documentation and/or other materials provided with the distribution.
15  *
16  * c) Neither the name of Cisco Systems, Inc. nor the names of its
17  *    contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30  * THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $	 */
34 
35 #include <sys/cdefs.h>
36 __FBSDID("$FreeBSD$");
37 
38 #ifndef __sctp_structs_h__
39 #define __sctp_structs_h__
40 
41 #include <netinet/sctp_os.h>
42 #include <netinet/sctp_header.h>
43 #include <netinet/sctp_auth.h>
44 
45 struct sctp_timer {
46 	sctp_os_timer_t timer;
47 
48 	int type;
49 	/*
50 	 * Depending on the timer type these will be setup and cast with the
51 	 * appropriate entity.
52 	 */
53 	void *ep;
54 	void *tcb;
55 	void *net;
56 	void *vnet;
57 
58 	/* for sanity checking */
59 	void *self;
60 	uint32_t ticks;
61 	uint32_t stopped_from;
62 };
63 
64 
65 struct sctp_foo_stuff {
66 	struct sctp_inpcb *inp;
67 	uint32_t lineno;
68 	uint32_t ticks;
69 	int updown;
70 };
71 
72 
73 /*
74  * This is the information we track on each interface that we know about from
75  * the distant end.
76  */
77 TAILQ_HEAD(sctpnetlisthead, sctp_nets);
78 
79 struct sctp_stream_reset_list {
80 	TAILQ_ENTRY(sctp_stream_reset_list) next_resp;
81 	uint32_t tsn;
82 	int number_entries;
83 	struct sctp_stream_reset_out_request req;
84 };
85 
86 TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);
87 
88 /*
89  * Users of the iterator need to malloc a iterator with a call to
90  * sctp_initiate_iterator(inp_func, assoc_func, inp_func,  pcb_flags, pcb_features,
91  *     asoc_state, void-ptr-arg, uint32-arg, end_func, inp);
92  *
93  * Use the following two defines if you don't care what pcb flags are on the EP
94  * and/or you don't care what state the association is in.
95  *
96  * Note that if you specify an INP as the last argument then ONLY each
97  * association of that single INP will be executed upon. Note that the pcb
98  * flags STILL apply so if the inp you specify has different pcb_flags then
99  * what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS to
100  * assure the inp you specify gets treated.
101  */
102 #define SCTP_PCB_ANY_FLAGS	0x00000000
103 #define SCTP_PCB_ANY_FEATURES	0x00000000
104 #define SCTP_ASOC_ANY_STATE	0x00000000
105 
106 typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr,
107          uint32_t val);
108 typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);
109 typedef void (*end_func) (void *ptr, uint32_t val);
110 
111 #if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)
112 /* whats on the mcore control struct */
113 struct sctp_mcore_queue {
114 	TAILQ_ENTRY(sctp_mcore_queue) next;
115 	struct vnet *vn;
116 	struct mbuf *m;
117 	int off;
118 	int v6;
119 };
120 
121 TAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue);
122 
123 struct sctp_mcore_ctrl {
124 	SCTP_PROCESS_STRUCT thread_proc;
125 	struct sctp_mcore_qhead que;
126 	struct mtx core_mtx;
127 	struct mtx que_mtx;
128 	int running;
129 	int cpuid;
130 };
131 
132 
133 #endif
134 
135 
136 struct sctp_iterator {
137 	TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;
138 	struct vnet *vn;
139 	struct sctp_timer tmr;
140 	struct sctp_inpcb *inp;	/* current endpoint */
141 	struct sctp_tcb *stcb;	/* current* assoc */
142 	struct sctp_inpcb *next_inp;	/* special hook to skip to */
143 	asoc_func function_assoc;	/* per assoc function */
144 	inp_func function_inp;	/* per endpoint function */
145 	inp_func function_inp_end;	/* end INP function */
146 	end_func function_atend;/* iterator completion function */
147 	void *pointer;		/* pointer for apply func to use */
148 	uint32_t val;		/* value for apply func to use */
149 	uint32_t pcb_flags;	/* endpoint flags being checked */
150 	uint32_t pcb_features;	/* endpoint features being checked */
151 	uint32_t asoc_state;	/* assoc state being checked */
152 	uint32_t iterator_flags;
153 	uint8_t no_chunk_output;
154 	uint8_t done_current_ep;
155 };
156 
157 /* iterator_flags values */
158 #define SCTP_ITERATOR_DO_ALL_INP	0x00000001
159 #define SCTP_ITERATOR_DO_SINGLE_INP	0x00000002
160 
161 
162 TAILQ_HEAD(sctpiterators, sctp_iterator);
163 
164 struct sctp_copy_all {
165 	struct sctp_inpcb *inp;	/* ep */
166 	struct mbuf *m;
167 	struct sctp_sndrcvinfo sndrcv;
168 	int sndlen;
169 	int cnt_sent;
170 	int cnt_failed;
171 };
172 
173 struct sctp_asconf_iterator {
174 	struct sctpladdr list_of_work;
175 	int cnt;
176 };
177 
178 struct iterator_control {
179 	struct mtx ipi_iterator_wq_mtx;
180 	struct mtx it_mtx;
181 	SCTP_PROCESS_STRUCT thread_proc;
182 	struct sctpiterators iteratorhead;
183 	struct sctp_iterator *cur_it;
184 	uint32_t iterator_running;
185 	uint32_t iterator_flags;
186 };
187 
188 #define SCTP_ITERATOR_MUST_EXIT   	0x00000001
189 #define SCTP_ITERATOR_STOP_CUR_IT  	0x00000002
190 #define SCTP_ITERATOR_STOP_CUR_INP  	0x00000004
191 
192 struct sctp_net_route {
193 	sctp_rtentry_t *ro_rt;
194 	void *ro_lle;
195 	union sctp_sockstore _l_addr;	/* remote peer addr */
196 	struct sctp_ifa *_s_addr;	/* our selected src addr */
197 };
198 
199 struct htcp {
200 	uint16_t alpha;		/* Fixed point arith, << 7 */
201 	uint8_t beta;		/* Fixed point arith, << 7 */
202 	uint8_t modeswitch;	/* Delay modeswitch until we had at least one
203 				 * congestion event */
204 	uint32_t last_cong;	/* Time since last congestion event end */
205 	uint32_t undo_last_cong;
206 	uint16_t bytes_acked;
207 	uint32_t bytecount;
208 	uint32_t minRTT;
209 	uint32_t maxRTT;
210 
211 	uint32_t undo_maxRTT;
212 	uint32_t undo_old_maxB;
213 
214 	/* Bandwidth estimation */
215 	uint32_t minB;
216 	uint32_t maxB;
217 	uint32_t old_maxB;
218 	uint32_t Bi;
219 	uint32_t lasttime;
220 };
221 
222 struct rtcc_cc {
223 	struct timeval tls;	/* The time we started the sending  */
224 	uint64_t lbw;		/* Our last estimated bw */
225 	uint64_t lbw_rtt;	/* RTT at bw estimate */
226 	uint64_t bw_bytes;	/* The total bytes since this sending began */
227 	uint64_t bw_tot_time;	/* The total time since sending began */
228 	uint64_t new_tot_time;	/* temp holding the new value */
229 	uint32_t cwnd_at_bw_set;
230 	uint8_t ret_from_eq;
231 	uint8_t use_dccc_ecn;
232 	uint8_t tls_needs_set;	/* Flag to indicate we need to set tls 0 or 1
233 				 * means set at send 2 not */
234 };
235 
236 
237 struct sctp_nets {
238 	TAILQ_ENTRY(sctp_nets) sctp_next;	/* next link */
239 
240 	/*
241 	 * Things on the top half may be able to be split into a common
242 	 * structure shared by all.
243 	 */
244 	struct sctp_timer pmtu_timer;
245 
246 	/*
247 	 * The following two in combination equate to a route entry for v6
248 	 * or v4.
249 	 */
250 	struct sctp_net_route ro;
251 
252 	/* mtu discovered so far */
253 	uint32_t mtu;
254 	uint32_t ssthresh;	/* not sure about this one for split */
255 	uint32_t last_cwr_tsn;
256 	uint32_t cwr_window_tsn;
257 	uint32_t ecn_ce_pkt_cnt;
258 	uint32_t lost_cnt;
259 	/* smoothed average things for RTT and RTO itself */
260 	int lastsa;
261 	int lastsv;
262 	uint64_t rtt;		/* last measured rtt value in us */
263 	unsigned int RTO;
264 
265 	/* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */
266 	struct sctp_timer rxt_timer;
267 	struct sctp_timer fr_timer;	/* for early fr */
268 
269 	/* last time in seconds I sent to it */
270 	struct timeval last_sent_time;
271 	union cc_control_data {
272 		struct htcp htcp_ca;	/* JRS - struct used in HTCP algorithm */
273 		struct rtcc_cc rtcc;	/* rtcc module cc stuff  */
274 	}               cc_mod;
275 	int ref_count;
276 
277 	/* Congestion stats per destination */
278 	/*
279 	 * flight size variables and such, sorry Vern, I could not avoid
280 	 * this if I wanted performance :>
281 	 */
282 	uint32_t flight_size;
283 	uint32_t cwnd;		/* actual cwnd */
284 	uint32_t prev_cwnd;	/* cwnd before any processing */
285 	uint32_t ecn_prev_cwnd;	/* ECN prev cwnd at first ecn_echo seen in new
286 				 * window */
287 	uint32_t partial_bytes_acked;	/* in CA tracks when to incr a MTU */
288 	/* tracking variables to avoid the aloc/free in sack processing */
289 	unsigned int net_ack;
290 	unsigned int net_ack2;
291 
292 	/*
293 	 * JRS - 5/8/07 - Variable to track last time a destination was
294 	 * active for CMT PF
295 	 */
296 	uint32_t last_active;
297 
298 	/*
299 	 * CMT variables (iyengar@cis.udel.edu)
300 	 */
301 	uint32_t this_sack_highest_newack;	/* tracks highest TSN newly
302 						 * acked for a given dest in
303 						 * the current SACK. Used in
304 						 * SFR and HTNA algos */
305 	uint32_t pseudo_cumack;	/* CMT CUC algorithm. Maintains next expected
306 				 * pseudo-cumack for this destination */
307 	uint32_t rtx_pseudo_cumack;	/* CMT CUC algorithm. Maintains next
308 					 * expected pseudo-cumack for this
309 					 * destination */
310 
311 	/* CMT fast recovery variables */
312 	uint32_t fast_recovery_tsn;
313 	uint32_t heartbeat_random1;
314 	uint32_t heartbeat_random2;
315 	uint32_t tos_flowlabel;
316 
317 	struct timeval start_time;	/* time when this net was created */
318 	uint32_t marked_retrans;/* number or DATA chunks marked for timer
319 				 * based retransmissions */
320 	uint32_t marked_fastretrans;
321 
322 	/* if this guy is ok or not ... status */
323 	uint16_t dest_state;
324 	/* number of transmit failures to down this guy */
325 	uint16_t failure_threshold;
326 	/* error stats on destination */
327 	uint16_t error_count;
328 	/* UDP port number in case of UDP tunneling */
329 	uint16_t port;
330 
331 	uint8_t fast_retran_loss_recovery;
332 	uint8_t will_exit_fast_recovery;
333 	/* Flags that probably can be combined into dest_state */
334 	uint8_t fast_retran_ip;	/* fast retransmit in progress */
335 	uint8_t hb_responded;
336 	uint8_t saw_newack;	/* CMT's SFR algorithm flag */
337 	uint8_t src_addr_selected;	/* if we split we move */
338 	uint8_t indx_of_eligible_next_to_use;
339 	uint8_t addr_is_local;	/* its a local address (if known) could move
340 				 * in split */
341 
342 	/*
343 	 * CMT variables (iyengar@cis.udel.edu)
344 	 */
345 	uint8_t find_pseudo_cumack;	/* CMT CUC algorithm. Flag used to
346 					 * find a new pseudocumack. This flag
347 					 * is set after a new pseudo-cumack
348 					 * has been received and indicates
349 					 * that the sender should find the
350 					 * next pseudo-cumack expected for
351 					 * this destination */
352 	uint8_t find_rtx_pseudo_cumack;	/* CMT CUCv2 algorithm. Flag used to
353 					 * find a new rtx-pseudocumack. This
354 					 * flag is set after a new
355 					 * rtx-pseudo-cumack has been received
356 					 * and indicates that the sender
357 					 * should find the next
358 					 * rtx-pseudo-cumack expected for this
359 					 * destination */
360 	uint8_t new_pseudo_cumack;	/* CMT CUC algorithm. Flag used to
361 					 * indicate if a new pseudo-cumack or
362 					 * rtx-pseudo-cumack has been received */
363 	uint8_t window_probe;	/* Doing a window probe? */
364 	uint8_t RTO_measured;	/* Have we done the first measure */
365 	uint8_t last_hs_used;	/* index into the last HS table entry we used */
366 	uint8_t lan_type;
367 	uint32_t flowid;
368 #ifdef INVARIANTS
369 	uint8_t flowidset;
370 #endif
371 };
372 
373 
374 struct sctp_data_chunkrec {
375 	uint32_t TSN_seq;	/* the TSN of this transmit */
376 	uint16_t stream_seq;	/* the stream sequence number of this transmit */
377 	uint16_t stream_number;	/* the stream number of this guy */
378 	uint32_t payloadtype;
379 	uint32_t context;	/* from send */
380 	uint32_t cwnd_at_send;
381 	/*
382 	 * part of the Highest sacked algorithm to be able to stroke counts
383 	 * on ones that are FR'd.
384 	 */
385 	uint32_t fast_retran_tsn;	/* sending_seq at the time of FR */
386 	struct timeval timetodrop;	/* time we drop it from queue */
387 	uint8_t doing_fast_retransmit;
388 	uint8_t rcv_flags;	/* flags pulled from data chunk on inbound for
389 				 * outbound holds sending flags for PR-SCTP. */
390 	uint8_t state_flags;
391 	uint8_t chunk_was_revoked;
392 	uint8_t fwd_tsn_cnt;
393 };
394 
395 TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk);
396 
397 /* The lower byte is used to enumerate PR_SCTP policies */
398 #define CHUNK_FLAGS_PR_SCTP_TTL	        SCTP_PR_SCTP_TTL
399 #define CHUNK_FLAGS_PR_SCTP_BUF	        SCTP_PR_SCTP_BUF
400 #define CHUNK_FLAGS_PR_SCTP_RTX         SCTP_PR_SCTP_RTX
401 
402 /* The upper byte is used a a bit mask */
403 #define CHUNK_FLAGS_FRAGMENT_OK	        0x0100
404 
405 struct chk_id {
406 	uint16_t id;
407 	uint16_t can_take_data;
408 };
409 
410 
411 struct sctp_tmit_chunk {
412 	union {
413 		struct sctp_data_chunkrec data;
414 		struct chk_id chunk_id;
415 	}     rec;
416 	struct sctp_association *asoc;	/* bp to asoc this belongs to */
417 	struct timeval sent_rcv_time;	/* filled in if RTT being calculated */
418 	struct mbuf *data;	/* pointer to mbuf chain of data */
419 	struct mbuf *last_mbuf;	/* pointer to last mbuf in chain */
420 	struct sctp_nets *whoTo;
421 	          TAILQ_ENTRY(sctp_tmit_chunk) sctp_next;	/* next link */
422 	int32_t sent;		/* the send status */
423 	uint16_t snd_count;	/* number of times I sent */
424 	uint16_t flags;		/* flags, such as FRAGMENT_OK */
425 	uint16_t send_size;
426 	uint16_t book_size;
427 	uint16_t mbcnt;
428 	uint16_t auth_keyid;
429 	uint8_t holds_key_ref;	/* flag if auth keyid refcount is held */
430 	uint8_t pad_inplace;
431 	uint8_t do_rtt;
432 	uint8_t book_size_scale;
433 	uint8_t no_fr_allowed;
434 	uint8_t pr_sctp_on;
435 	uint8_t copy_by_ref;
436 	uint8_t window_probe;
437 };
438 
439 /*
440  * The first part of this structure MUST be the entire sinfo structure. Maybe
441  * I should have made it a sub structure... we can circle back later and do
442  * that if we want.
443  */
444 struct sctp_queued_to_read {	/* sinfo structure Pluse more */
445 	uint16_t sinfo_stream;	/* off the wire */
446 	uint16_t sinfo_ssn;	/* off the wire */
447 	uint16_t sinfo_flags;	/* SCTP_UNORDERED from wire use SCTP_EOF for
448 				 * EOR */
449 	uint32_t sinfo_ppid;	/* off the wire */
450 	uint32_t sinfo_context;	/* pick this up from assoc def context? */
451 	uint32_t sinfo_timetolive;	/* not used by kernel */
452 	uint32_t sinfo_tsn;	/* Use this in reassembly as first TSN */
453 	uint32_t sinfo_cumtsn;	/* Use this in reassembly as last TSN */
454 	sctp_assoc_t sinfo_assoc_id;	/* our assoc id */
455 	/* Non sinfo stuff */
456 	uint32_t length;	/* length of data */
457 	uint32_t held_length;	/* length held in sb */
458 	struct sctp_nets *whoFrom;	/* where it came from */
459 	struct mbuf *data;	/* front of the mbuf chain of data with
460 				 * PKT_HDR */
461 	struct mbuf *tail_mbuf;	/* used for multi-part data */
462 	struct mbuf *aux_data;	/* used to hold/cache  control if o/s does not
463 				 * take it from us */
464 	struct sctp_tcb *stcb;	/* assoc, used for window update */
465 	         TAILQ_ENTRY(sctp_queued_to_read) next;
466 	uint16_t port_from;
467 	uint16_t spec_flags;	/* Flags to hold the notification field */
468 	uint8_t do_not_ref_stcb;
469 	uint8_t end_added;
470 	uint8_t pdapi_aborted;
471 	uint8_t some_taken;
472 };
473 
474 /* This data structure will be on the outbound
475  * stream queues. Data will be pulled off from
476  * the front of the mbuf data and chunk-ified
477  * by the output routines. We will custom
478  * fit every chunk we pull to the send/sent
479  * queue to make up the next full packet
480  * if we can. An entry cannot be removed
481  * from the stream_out queue until
482  * the msg_is_complete flag is set. This
483  * means at times data/tail_mbuf MIGHT
484  * be NULL.. If that occurs it happens
485  * for one of two reasons. Either the user
486  * is blocked on a send() call and has not
487  * awoken to copy more data down... OR
488  * the user is in the explict MSG_EOR mode
489  * and wrote some data, but has not completed
490  * sending.
491  */
492 struct sctp_stream_queue_pending {
493 	struct mbuf *data;
494 	struct mbuf *tail_mbuf;
495 	struct timeval ts;
496 	struct sctp_nets *net;
497 	          TAILQ_ENTRY(sctp_stream_queue_pending) next;
498 	          TAILQ_ENTRY(sctp_stream_queue_pending) ss_next;
499 	uint32_t length;
500 	uint32_t timetolive;
501 	uint32_t ppid;
502 	uint32_t context;
503 	uint16_t sinfo_flags;
504 	uint16_t stream;
505 	uint16_t strseq;
506 	uint16_t act_flags;
507 	uint16_t auth_keyid;
508 	uint8_t holds_key_ref;
509 	uint8_t msg_is_complete;
510 	uint8_t some_taken;
511 	uint8_t pr_sctp_on;
512 	uint8_t sender_all_done;
513 	uint8_t put_last_out;
514 	uint8_t discard_rest;
515 };
516 
517 /*
518  * this struct contains info that is used to track inbound stream data and
519  * help with ordering.
520  */
521 TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in);
522 struct sctp_stream_in {
523 	struct sctp_readhead inqueue;
524 	uint16_t stream_no;
525 	uint16_t last_sequence_delivered;	/* used for re-order */
526 	uint8_t delivery_started;
527 };
528 
529 TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out);
530 TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending);
531 
532 /* Round-robin schedulers */
533 struct ss_rr {
534 	/* next link in wheel */
535 	TAILQ_ENTRY(sctp_stream_out) next_spoke;
536 };
537 
538 /* Priority scheduler */
539 struct ss_prio {
540 	/* next link in wheel */
541 	TAILQ_ENTRY(sctp_stream_out) next_spoke;
542 	/* priority id */
543 	uint16_t priority;
544 };
545 
546 /* Fair Bandwidth scheduler */
547 struct ss_fb {
548 	/* next link in wheel */
549 	TAILQ_ENTRY(sctp_stream_out) next_spoke;
550 	/* stores message size */
551 	int32_t rounds;
552 };
553 
554 /*
555  * This union holds all data necessary for
556  * different stream schedulers.
557  */
558 union scheduling_data {
559 	struct sctpwheel_listhead out_wheel;
560 	struct sctplist_listhead out_list;
561 };
562 
563 /*
564  * This union holds all parameters per stream
565  * necessary for different stream schedulers.
566  */
567 union scheduling_parameters {
568 	struct ss_rr rr;
569 	struct ss_prio prio;
570 	struct ss_fb fb;
571 };
572 
573 /* This struct is used to track the traffic on outbound streams */
574 struct sctp_stream_out {
575 	struct sctp_streamhead outqueue;
576 	union scheduling_parameters ss_params;
577 	uint16_t stream_no;
578 	uint16_t next_sequence_sent;	/* next one I expect to send out */
579 	uint8_t last_msg_incomplete;
580 };
581 
582 /* used to keep track of the addresses yet to try to add/delete */
583 TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr);
584 struct sctp_asconf_addr {
585 	TAILQ_ENTRY(sctp_asconf_addr) next;
586 	struct sctp_asconf_addr_param ap;
587 	struct sctp_ifa *ifa;	/* save the ifa for add/del ip */
588 	uint8_t sent;		/* has this been sent yet? */
589 	uint8_t special_del;	/* not to be used in lookup */
590 };
591 
592 struct sctp_scoping {
593 	uint8_t ipv4_addr_legal;
594 	uint8_t ipv6_addr_legal;
595 	uint8_t loopback_scope;
596 	uint8_t ipv4_local_scope;
597 	uint8_t local_scope;
598 	uint8_t site_scope;
599 };
600 
601 #define SCTP_TSN_LOG_SIZE 40
602 
603 struct sctp_tsn_log {
604 	void *stcb;
605 	uint32_t tsn;
606 	uint16_t strm;
607 	uint16_t seq;
608 	uint16_t sz;
609 	uint16_t flgs;
610 	uint16_t in_pos;
611 	uint16_t in_out;
612 };
613 
614 #define SCTP_FS_SPEC_LOG_SIZE 200
615 struct sctp_fs_spec_log {
616 	uint32_t sent;
617 	uint32_t total_flight;
618 	uint32_t tsn;
619 	uint16_t book;
620 	uint8_t incr;
621 	uint8_t decr;
622 };
623 
624 /* This struct is here to cut out the compatiabilty
625  * pad that bulks up both the inp and stcb. The non
626  * pad portion MUST stay in complete sync with
627  * sctp_sndrcvinfo... i.e. if sinfo_xxxx is added
628  * this must be done here too.
629  */
630 struct sctp_nonpad_sndrcvinfo {
631 	uint16_t sinfo_stream;
632 	uint16_t sinfo_ssn;
633 	uint16_t sinfo_flags;
634 	uint32_t sinfo_ppid;
635 	uint32_t sinfo_context;
636 	uint32_t sinfo_timetolive;
637 	uint32_t sinfo_tsn;
638 	uint32_t sinfo_cumtsn;
639 	sctp_assoc_t sinfo_assoc_id;
640 };
641 
642 /*
643  * JRS - Structure to hold function pointers to the functions responsible
644  * for congestion control.
645  */
646 
647 struct sctp_cc_functions {
648 	void (*sctp_set_initial_cc_param) (struct sctp_tcb *stcb, struct sctp_nets *net);
649 	void (*sctp_cwnd_update_after_sack) (struct sctp_tcb *stcb,
650 	         struct sctp_association *asoc,
651 	         int accum_moved, int reneged_all, int will_exit);
652 	void (*sctp_cwnd_update_after_fr) (struct sctp_tcb *stcb,
653 	         struct sctp_association *asoc);
654 	void (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb,
655 	         struct sctp_nets *net);
656 	void (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb,
657 	         struct sctp_nets *net, int in_window, int num_pkt_lost);
658 	void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb,
659 	         struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,
660 	         uint32_t * bottle_bw, uint32_t * on_queue);
661 	void (*sctp_cwnd_update_after_output) (struct sctp_tcb *stcb,
662 	         struct sctp_nets *net, int burst_limit);
663 	void (*sctp_cwnd_update_after_fr_timer) (struct sctp_inpcb *inp,
664 	         struct sctp_tcb *stcb, struct sctp_nets *net);
665 	void (*sctp_cwnd_update_packet_transmitted) (struct sctp_tcb *stcb,
666 	         struct sctp_nets *net);
667 	void (*sctp_cwnd_update_tsn_acknowledged) (struct sctp_nets *net,
668 	         struct sctp_tmit_chunk *);
669 	void (*sctp_cwnd_new_transmission_begins) (struct sctp_tcb *stcb,
670 	         struct sctp_nets *net);
671 	void (*sctp_cwnd_prepare_net_for_sack) (struct sctp_tcb *stcb,
672 	         struct sctp_nets *net);
673 	int (*sctp_cwnd_socket_option) (struct sctp_tcb *stcb, int set, struct sctp_cc_option *);
674 };
675 
676 /*
677  * RS - Structure to hold function pointers to the functions responsible
678  * for stream scheduling.
679  */
680 struct sctp_ss_functions {
681 	void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc,
682 	         int holds_lock);
683 	void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc,
684 	         int clear_values, int holds_lock);
685 	void (*sctp_ss_init_stream) (struct sctp_stream_out *strq, struct sctp_stream_out *with_strq);
686 	void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc,
687 	         struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);
688 	int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc);
689 	void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc,
690 	         struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);
691 	struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb,
692 	                    struct sctp_nets *net, struct sctp_association *asoc);
693 	void (*sctp_ss_scheduled) (struct sctp_tcb *stcb, struct sctp_nets *net,
694 	         struct sctp_association *asoc, struct sctp_stream_out *strq, int moved_how_much);
695 	void (*sctp_ss_packet_done) (struct sctp_tcb *stcb, struct sctp_nets *net,
696 	         struct sctp_association *asoc);
697 	int (*sctp_ss_get_value) (struct sctp_tcb *stcb, struct sctp_association *asoc,
698 	        struct sctp_stream_out *strq, uint16_t * value);
699 	int (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc,
700 	        struct sctp_stream_out *strq, uint16_t value);
701 };
702 
703 /* used to save ASCONF chunks for retransmission */
704 TAILQ_HEAD(sctp_asconf_head, sctp_asconf);
705 struct sctp_asconf {
706 	TAILQ_ENTRY(sctp_asconf) next;
707 	uint32_t serial_number;
708 	uint16_t snd_count;
709 	struct mbuf *data;
710 	uint16_t len;
711 };
712 
713 /* used to save ASCONF-ACK chunks for retransmission */
714 TAILQ_HEAD(sctp_asconf_ackhead, sctp_asconf_ack);
715 struct sctp_asconf_ack {
716 	TAILQ_ENTRY(sctp_asconf_ack) next;
717 	uint32_t serial_number;
718 	struct sctp_nets *last_sent_to;
719 	struct mbuf *data;
720 	uint16_t len;
721 };
722 
723 /*
724  * Here we have information about each individual association that we track.
725  * We probably in production would be more dynamic. But for ease of
726  * implementation we will have a fixed array that we hunt for in a linear
727  * fashion.
728  */
729 struct sctp_association {
730 	/* association state */
731 	int state;
732 
733 	/* queue of pending addrs to add/delete */
734 	struct sctp_asconf_addrhead asconf_queue;
735 
736 	struct timeval time_entered;	/* time we entered state */
737 	struct timeval time_last_rcvd;
738 	struct timeval time_last_sent;
739 	struct timeval time_last_sat_advance;
740 	struct sctp_nonpad_sndrcvinfo def_send;
741 
742 	/* timers and such */
743 	struct sctp_timer hb_timer;	/* hb timer */
744 	struct sctp_timer dack_timer;	/* Delayed ack timer */
745 	struct sctp_timer asconf_timer;	/* asconf */
746 	struct sctp_timer strreset_timer;	/* stream reset */
747 	struct sctp_timer shut_guard_timer;	/* shutdown guard */
748 	struct sctp_timer autoclose_timer;	/* automatic close timer */
749 	struct sctp_timer delayed_event_timer;	/* timer for delayed events */
750 	struct sctp_timer delete_prim_timer;	/* deleting primary dst */
751 
752 	/* list of restricted local addresses */
753 	struct sctpladdr sctp_restricted_addrs;
754 
755 	/* last local address pending deletion (waiting for an address add) */
756 	struct sctp_ifa *asconf_addr_del_pending;
757 	/* Deleted primary destination (used to stop timer) */
758 	struct sctp_nets *deleted_primary;
759 
760 	struct sctpnetlisthead nets;	/* remote address list */
761 
762 	/* Free chunk list */
763 	struct sctpchunk_listhead free_chunks;
764 
765 	/* Control chunk queue */
766 	struct sctpchunk_listhead control_send_queue;
767 
768 	/* ASCONF chunk queue */
769 	struct sctpchunk_listhead asconf_send_queue;
770 
771 	/*
772 	 * Once a TSN hits the wire it is moved to the sent_queue. We
773 	 * maintain two counts here (don't know if any but retran_cnt is
774 	 * needed). The idea is that the sent_queue_retran_cnt reflects how
775 	 * many chunks have been marked for retranmission by either T3-rxt
776 	 * or FR.
777 	 */
778 	struct sctpchunk_listhead sent_queue;
779 	struct sctpchunk_listhead send_queue;
780 
781 	/* re-assembly queue for fragmented chunks on the inbound path */
782 	struct sctpchunk_listhead reasmqueue;
783 
784 	/* Scheduling queues */
785 	union scheduling_data ss_data;
786 
787 	/*
788 	 * This pointer will be set to NULL most of the time. But when we
789 	 * have a fragmented message, where we could not get out all of the
790 	 * message at the last send then this will point to the stream to go
791 	 * get data from.
792 	 */
793 	struct sctp_stream_out *locked_on_sending;
794 
795 	/* If an iterator is looking at me, this is it */
796 	struct sctp_iterator *stcb_starting_point_for_iterator;
797 
798 	/* ASCONF save the last ASCONF-ACK so we can resend it if necessary */
799 	struct sctp_asconf_ackhead asconf_ack_sent;
800 
801 	/*
802 	 * pointer to last stream reset queued to control queue by us with
803 	 * requests.
804 	 */
805 	struct sctp_tmit_chunk *str_reset;
806 	/*
807 	 * if Source Address Selection happening, this will rotate through
808 	 * the link list.
809 	 */
810 	struct sctp_laddr *last_used_address;
811 
812 	/* stream arrays */
813 	struct sctp_stream_in *strmin;
814 	struct sctp_stream_out *strmout;
815 	uint8_t *mapping_array;
816 	/* primary destination to use */
817 	struct sctp_nets *primary_destination;
818 	/* For CMT */
819 	struct sctp_nets *last_net_cmt_send_started;
820 	/* last place I got a data chunk from */
821 	struct sctp_nets *last_data_chunk_from;
822 	/* last place I got a control from */
823 	struct sctp_nets *last_control_chunk_from;
824 
825 	/* circular looking for output selection */
826 	struct sctp_stream_out *last_out_stream;
827 
828 	/*
829 	 * wait to the point the cum-ack passes req->send_reset_at_tsn for
830 	 * any req on the list.
831 	 */
832 	struct sctp_resethead resetHead;
833 
834 	/* queue of chunks waiting to be sent into the local stack */
835 	struct sctp_readhead pending_reply_queue;
836 
837 	/* JRS - the congestion control functions are in this struct */
838 	struct sctp_cc_functions cc_functions;
839 	/*
840 	 * JRS - value to store the currently loaded congestion control
841 	 * module
842 	 */
843 	uint32_t congestion_control_module;
844 	/* RS - the stream scheduling functions are in this struct */
845 	struct sctp_ss_functions ss_functions;
846 	/* RS - value to store the currently loaded stream scheduling module */
847 	uint32_t stream_scheduling_module;
848 
849 	uint32_t vrf_id;
850 
851 	uint32_t cookie_preserve_req;
852 	/* ASCONF next seq I am sending out, inits at init-tsn */
853 	uint32_t asconf_seq_out;
854 	uint32_t asconf_seq_out_acked;
855 	/* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */
856 	uint32_t asconf_seq_in;
857 
858 	/* next seq I am sending in str reset messages */
859 	uint32_t str_reset_seq_out;
860 	/* next seq I am expecting in str reset messages */
861 	uint32_t str_reset_seq_in;
862 
863 	/* various verification tag information */
864 	uint32_t my_vtag;	/* The tag to be used. if assoc is re-initited
865 				 * by remote end, and I have unlocked this
866 				 * will be regenerated to a new random value. */
867 	uint32_t peer_vtag;	/* The peers last tag */
868 
869 	uint32_t my_vtag_nonce;
870 	uint32_t peer_vtag_nonce;
871 
872 	uint32_t assoc_id;
873 
874 	/* This is the SCTP fragmentation threshold */
875 	uint32_t smallest_mtu;
876 
877 	/*
878 	 * Special hook for Fast retransmit, allows us to track the highest
879 	 * TSN that is NEW in this SACK if gap ack blocks are present.
880 	 */
881 	uint32_t this_sack_highest_gap;
882 
883 	/*
884 	 * The highest consecutive TSN that has been acked by peer on my
885 	 * sends
886 	 */
887 	uint32_t last_acked_seq;
888 
889 	/* The next TSN that I will use in sending. */
890 	uint32_t sending_seq;
891 
892 	/* Original seq number I used ??questionable to keep?? */
893 	uint32_t init_seq_number;
894 
895 
896 	/* The Advanced Peer Ack Point, as required by the PR-SCTP */
897 	/* (A1 in Section 4.2) */
898 	uint32_t advanced_peer_ack_point;
899 
900 	/*
901 	 * The highest consequetive TSN at the bottom of the mapping array
902 	 * (for his sends).
903 	 */
904 	uint32_t cumulative_tsn;
905 	/*
906 	 * Used to track the mapping array and its offset bits. This MAY be
907 	 * lower then cumulative_tsn.
908 	 */
909 	uint32_t mapping_array_base_tsn;
910 	/*
911 	 * used to track highest TSN we have received and is listed in the
912 	 * mapping array.
913 	 */
914 	uint32_t highest_tsn_inside_map;
915 
916 	/* EY - new NR variables used for nr_sack based on mapping_array */
917 	uint8_t *nr_mapping_array;
918 	uint32_t highest_tsn_inside_nr_map;
919 
920 	uint32_t fast_recovery_tsn;
921 	uint32_t sat_t3_recovery_tsn;
922 	uint32_t tsn_last_delivered;
923 	/*
924 	 * For the pd-api we should re-write this a bit more efficent. We
925 	 * could have multiple sctp_queued_to_read's that we are building at
926 	 * once. Now we only do this when we get ready to deliver to the
927 	 * socket buffer. Note that we depend on the fact that the struct is
928 	 * "stuck" on the read queue until we finish all the pd-api.
929 	 */
930 	struct sctp_queued_to_read *control_pdapi;
931 
932 	uint32_t tsn_of_pdapi_last_delivered;
933 	uint32_t pdapi_ppid;
934 	uint32_t context;
935 	uint32_t last_reset_action[SCTP_MAX_RESET_PARAMS];
936 	uint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS];
937 	uint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS];
938 #ifdef SCTP_ASOCLOG_OF_TSNS
939 	/*
940 	 * special log  - This adds considerable size to the asoc, but
941 	 * provides a log that you can use to detect problems via kgdb.
942 	 */
943 	struct sctp_tsn_log in_tsnlog[SCTP_TSN_LOG_SIZE];
944 	struct sctp_tsn_log out_tsnlog[SCTP_TSN_LOG_SIZE];
945 	uint32_t cumack_log[SCTP_TSN_LOG_SIZE];
946 	uint32_t cumack_logsnt[SCTP_TSN_LOG_SIZE];
947 	uint16_t tsn_in_at;
948 	uint16_t tsn_out_at;
949 	uint16_t tsn_in_wrapped;
950 	uint16_t tsn_out_wrapped;
951 	uint16_t cumack_log_at;
952 	uint16_t cumack_log_atsnt;
953 #endif				/* SCTP_ASOCLOG_OF_TSNS */
954 #ifdef SCTP_FS_SPEC_LOG
955 	struct sctp_fs_spec_log fslog[SCTP_FS_SPEC_LOG_SIZE];
956 	uint16_t fs_index;
957 #endif
958 
959 	/*
960 	 * window state information and smallest MTU that I use to bound
961 	 * segmentation
962 	 */
963 	uint32_t peers_rwnd;
964 	uint32_t my_rwnd;
965 	uint32_t my_last_reported_rwnd;
966 	uint32_t sctp_frag_point;
967 
968 	uint32_t total_output_queue_size;
969 
970 	uint32_t sb_cc;		/* shadow of sb_cc */
971 	uint32_t sb_send_resv;	/* amount reserved on a send */
972 	uint32_t my_rwnd_control_len;	/* shadow of sb_mbcnt used for rwnd
973 					 * control */
974 	uint32_t default_flowlabel;
975 	uint32_t pr_sctp_cnt;
976 	int ctrl_queue_cnt;	/* could be removed  REM - NO IT CAN'T!! RRS */
977 	/*
978 	 * All outbound datagrams queue into this list from the individual
979 	 * stream queue. Here they get assigned a TSN and then await
980 	 * sending. The stream seq comes when it is first put in the
981 	 * individual str queue
982 	 */
983 	unsigned int stream_queue_cnt;
984 	unsigned int send_queue_cnt;
985 	unsigned int sent_queue_cnt;
986 	unsigned int sent_queue_cnt_removeable;
987 	/*
988 	 * Number on sent queue that are marked for retran until this value
989 	 * is 0 we only send one packet of retran'ed data.
990 	 */
991 	unsigned int sent_queue_retran_cnt;
992 
993 	unsigned int size_on_reasm_queue;
994 	unsigned int cnt_on_reasm_queue;
995 	unsigned int fwd_tsn_cnt;
996 	/* amount of data (bytes) currently in flight (on all destinations) */
997 	unsigned int total_flight;
998 	/* Total book size in flight */
999 	unsigned int total_flight_count;	/* count of chunks used with
1000 						 * book total */
1001 	/* count of destinaton nets and list of destination nets */
1002 	unsigned int numnets;
1003 
1004 	/* Total error count on this association */
1005 	unsigned int overall_error_count;
1006 
1007 	unsigned int cnt_msg_on_sb;
1008 
1009 	/* All stream count of chunks for delivery */
1010 	unsigned int size_on_all_streams;
1011 	unsigned int cnt_on_all_streams;
1012 
1013 	/* Heart Beat delay in ticks */
1014 	unsigned int heart_beat_delay;
1015 
1016 	/* autoclose */
1017 	unsigned int sctp_autoclose_ticks;
1018 
1019 	/* how many preopen streams we have */
1020 	unsigned int pre_open_streams;
1021 
1022 	/* How many streams I support coming into me */
1023 	unsigned int max_inbound_streams;
1024 
1025 	/* the cookie life I award for any cookie, in seconds */
1026 	unsigned int cookie_life;
1027 	/* time to delay acks for */
1028 	unsigned int delayed_ack;
1029 	unsigned int old_delayed_ack;
1030 	unsigned int sack_freq;
1031 	unsigned int data_pkts_seen;
1032 
1033 	unsigned int numduptsns;
1034 	int dup_tsns[SCTP_MAX_DUP_TSNS];
1035 	unsigned int initial_init_rto_max;	/* initial RTO for INIT's */
1036 	unsigned int initial_rto;	/* initial send RTO */
1037 	unsigned int minrto;	/* per assoc RTO-MIN */
1038 	unsigned int maxrto;	/* per assoc RTO-MAX */
1039 
1040 	/* authentication fields */
1041 	sctp_auth_chklist_t *local_auth_chunks;
1042 	sctp_auth_chklist_t *peer_auth_chunks;
1043 	sctp_hmaclist_t *local_hmacs;	/* local HMACs supported */
1044 	sctp_hmaclist_t *peer_hmacs;	/* peer HMACs supported */
1045 	struct sctp_keyhead shared_keys;	/* assoc's shared keys */
1046 	sctp_authinfo_t authinfo;	/* randoms, cached keys */
1047 	/*
1048 	 * refcnt to block freeing when a sender or receiver is off coping
1049 	 * user data in.
1050 	 */
1051 	uint32_t refcnt;
1052 	uint32_t chunks_on_out_queue;	/* total chunks floating around,
1053 					 * locked by send socket buffer */
1054 	uint32_t peers_adaptation;
1055 	uint16_t peer_hmac_id;	/* peer HMAC id to send */
1056 
1057 	/*
1058 	 * Being that we have no bag to collect stale cookies, and that we
1059 	 * really would not want to anyway.. we will count them in this
1060 	 * counter. We of course feed them to the pigeons right away (I have
1061 	 * always thought of pigeons as flying rats).
1062 	 */
1063 	uint16_t stale_cookie_count;
1064 
1065 	/*
1066 	 * For the partial delivery API, if up, invoked this is what last
1067 	 * TSN I delivered
1068 	 */
1069 	uint16_t str_of_pdapi;
1070 	uint16_t ssn_of_pdapi;
1071 
1072 	/* counts of actual built streams. Allocation may be more however */
1073 	/* could re-arrange to optimize space here. */
1074 	uint16_t streamincnt;
1075 	uint16_t streamoutcnt;
1076 	uint16_t strm_realoutsize;
1077 	/* my maximum number of retrans of INIT and SEND */
1078 	/* copied from SCTP but should be individually setable */
1079 	uint16_t max_init_times;
1080 	uint16_t max_send_times;
1081 
1082 	uint16_t def_net_failure;
1083 
1084 	/*
1085 	 * lock flag: 0 is ok to send, 1+ (duals as a retran count) is
1086 	 * awaiting ACK
1087 	 */
1088 	uint16_t mapping_array_size;
1089 
1090 	uint16_t last_strm_seq_delivered;
1091 	uint16_t last_strm_no_delivered;
1092 
1093 	uint16_t last_revoke_count;
1094 	int16_t num_send_timers_up;
1095 
1096 	uint16_t stream_locked_on;
1097 	uint16_t ecn_echo_cnt_onq;
1098 
1099 	uint16_t free_chunk_cnt;
1100 	uint8_t stream_locked;
1101 	uint8_t authenticated;	/* packet authenticated ok */
1102 	/*
1103 	 * This flag indicates that a SACK need to be sent. Initially this
1104 	 * is 1 to send the first sACK immediately.
1105 	 */
1106 	uint8_t send_sack;
1107 
1108 	/* max burst of new packets into the network */
1109 	uint32_t max_burst;
1110 	/* max burst of fast retransmit packets */
1111 	uint32_t fr_max_burst;
1112 
1113 	uint8_t sat_network;	/* RTT is in range of sat net or greater */
1114 	uint8_t sat_network_lockout;	/* lockout code */
1115 	uint8_t burst_limit_applied;	/* Burst limit in effect at last send? */
1116 	/* flag goes on when we are doing a partial delivery api */
1117 	uint8_t hb_random_values[4];
1118 	uint8_t fragmented_delivery_inprogress;
1119 	uint8_t fragment_flags;
1120 	uint8_t last_flags_delivered;
1121 	uint8_t hb_ect_randombit;
1122 	uint8_t hb_random_idx;
1123 	uint8_t hb_is_disabled;	/* is the hb disabled? */
1124 	uint8_t default_tos;
1125 	uint8_t asconf_del_pending;	/* asconf delete last addr pending */
1126 
1127 	/*
1128 	 * This value, plus all other ack'd but above cum-ack is added
1129 	 * together to cross check against the bit that we have yet to
1130 	 * define (probably in the SACK). When the cum-ack is updated, this
1131 	 * sum is updated as well.
1132 	 */
1133 
1134 	/* Flag to tell if ECN is allowed */
1135 	uint8_t ecn_allowed;
1136 
1137 	/* flag to indicate if peer can do asconf */
1138 	uint8_t peer_supports_asconf;
1139 	/* EY - flag to indicate if peer can do nr_sack */
1140 	uint8_t peer_supports_nr_sack;
1141 	/* pr-sctp support flag */
1142 	uint8_t peer_supports_prsctp;
1143 	/* peer authentication support flag */
1144 	uint8_t peer_supports_auth;
1145 	/* stream resets are supported by the peer */
1146 	uint8_t peer_supports_strreset;
1147 
1148 	uint8_t peer_supports_nat;
1149 	/*
1150 	 * packet drop's are supported by the peer, we don't really care
1151 	 * about this but we bookkeep it anyway.
1152 	 */
1153 	uint8_t peer_supports_pktdrop;
1154 
1155 	/* Do we allow V6/V4? */
1156 	uint8_t ipv4_addr_legal;
1157 	uint8_t ipv6_addr_legal;
1158 	/* Address scoping flags */
1159 	/* scope value for IPv4 */
1160 	uint8_t ipv4_local_scope;
1161 	/* scope values for IPv6 */
1162 	uint8_t local_scope;
1163 	uint8_t site_scope;
1164 	/* loopback scope */
1165 	uint8_t loopback_scope;
1166 	/* flags to handle send alternate net tracking */
1167 	uint8_t used_alt_onsack;
1168 	uint8_t used_alt_asconfack;
1169 	uint8_t fast_retran_loss_recovery;
1170 	uint8_t sat_t3_loss_recovery;
1171 	uint8_t dropped_special_cnt;
1172 	uint8_t seen_a_sack_this_pkt;
1173 	uint8_t stream_reset_outstanding;
1174 	uint8_t stream_reset_out_is_outstanding;
1175 	uint8_t delayed_connection;
1176 	uint8_t ifp_had_enobuf;
1177 	uint8_t saw_sack_with_frags;
1178 	uint8_t saw_sack_with_nr_frags;
1179 	uint8_t in_asocid_hash;
1180 	uint8_t assoc_up_sent;
1181 	uint8_t adaptation_needed;
1182 	uint8_t adaptation_sent;
1183 	/* CMT variables */
1184 	uint8_t cmt_dac_pkts_rcvd;
1185 	uint8_t sctp_cmt_on_off;
1186 	uint8_t iam_blocking;
1187 	uint8_t cookie_how[8];
1188 	/* EY 05/05/08 - NR_SACK variable */
1189 	uint8_t sctp_nr_sack_on_off;
1190 	/* JRS 5/21/07 - CMT PF variable */
1191 	uint8_t sctp_cmt_pf;
1192 	uint8_t use_precise_time;
1193 	/*
1194 	 * The mapping array is used to track out of order sequences above
1195 	 * last_acked_seq. 0 indicates packet missing 1 indicates packet
1196 	 * rec'd. We slide it up every time we raise last_acked_seq and 0
1197 	 * trailing locactions out.  If I get a TSN above the array
1198 	 * mappingArraySz, I discard the datagram and let retransmit happen.
1199 	 */
1200 	uint32_t marked_retrans;
1201 	uint32_t timoinit;
1202 	uint32_t timodata;
1203 	uint32_t timosack;
1204 	uint32_t timoshutdown;
1205 	uint32_t timoheartbeat;
1206 	uint32_t timocookie;
1207 	uint32_t timoshutdownack;
1208 	struct timeval start_time;
1209 	struct timeval discontinuity_time;
1210 };
1211 
1212 #endif
1213