master
  1/*-
  2 * SPDX-License-Identifier: BSD-3-Clause
  3 *
  4 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
  5 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
  6 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
  7 *
  8 * Redistribution and use in source and binary forms, with or without
  9 * modification, are permitted provided that the following conditions are met:
 10 *
 11 * a) Redistributions of source code must retain the above copyright notice,
 12 *    this list of conditions and the following disclaimer.
 13 *
 14 * b) Redistributions in binary form must reproduce the above copyright
 15 *    notice, this list of conditions and the following disclaimer in
 16 *    the documentation and/or other materials provided with the distribution.
 17 *
 18 * c) Neither the name of Cisco Systems, Inc. nor the names of its
 19 *    contributors may be used to endorse or promote products derived
 20 *    from this software without specific prior written permission.
 21 *
 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 32 * THE POSSIBILITY OF SUCH DAMAGE.
 33 */
 34
 35#ifndef _NETINET_SCTP_PCB_H_
 36#define _NETINET_SCTP_PCB_H_
 37
 38#include <netinet/sctp_os.h>
 39#include <netinet/sctp.h>
 40#include <netinet/sctp_constants.h>
 41#include <netinet/sctp_sysctl.h>
 42
 43LIST_HEAD(sctppcbhead, sctp_inpcb);
 44LIST_HEAD(sctpasochead, sctp_tcb);
 45LIST_HEAD(sctpladdr, sctp_laddr);
 46LIST_HEAD(sctpvtaghead, sctp_tagblock);
 47LIST_HEAD(sctp_vrflist, sctp_vrf);
 48LIST_HEAD(sctp_ifnlist, sctp_ifn);
 49LIST_HEAD(sctp_ifalist, sctp_ifa);
 50TAILQ_HEAD(sctp_readhead, sctp_queued_to_read);
 51TAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending);
 52
 53#include <netinet/sctp_structs.h>
 54#include <netinet/sctp_auth.h>
 55
 56#define SCTP_PCBHASH_ALLADDR(port, mask) (port & mask)
 57#define SCTP_PCBHASH_ASOC(tag, mask) (tag & mask)
 58
 59struct sctp_vrf {
 60	LIST_ENTRY(sctp_vrf) next_vrf;
 61	struct sctp_ifalist *vrf_addr_hash;
 62	struct sctp_ifnlist ifnlist;
 63	uint32_t vrf_id;
 64	uint32_t tbl_id_v4;	/* default v4 table id */
 65	uint32_t tbl_id_v6;	/* default v6 table id */
 66	uint32_t total_ifa_count;
 67	u_long vrf_addr_hashmark;
 68	uint32_t refcount;
 69};
 70
 71struct sctp_ifn {
 72	struct sctp_ifalist ifalist;
 73	struct sctp_vrf *vrf;
 74	         LIST_ENTRY(sctp_ifn) next_ifn;
 75	         LIST_ENTRY(sctp_ifn) next_bucket;
 76	void *ifn_p;		/* never access without appropriate lock */
 77	uint32_t ifn_mtu;
 78	uint32_t ifn_type;
 79	uint32_t ifn_index;	/* shorthand way to look at ifn for reference */
 80	uint32_t refcount;	/* number of reference held should be >=
 81				 * ifa_count */
 82	uint32_t ifa_count;	/* IFA's we hold (in our list - ifalist) */
 83	uint32_t num_v6;	/* number of v6 addresses */
 84	uint32_t num_v4;	/* number of v4 addresses */
 85	uint32_t registered_af;	/* registered address family for i/f events */
 86	char ifn_name[SCTP_IFNAMSIZ];
 87};
 88
 89/* SCTP local IFA flags */
 90#define SCTP_ADDR_VALID         0x00000001	/* its up and active */
 91#define SCTP_BEING_DELETED      0x00000002	/* being deleted, when
 92						 * refcount = 0. Note that it
 93						 * is pulled from the ifn list
 94						 * and ifa_p is nulled right
 95						 * away but it cannot be freed
 96						 * until the last *net
 97						 * pointing to it is deleted. */
 98#define SCTP_ADDR_DEFER_USE     0x00000004	/* Hold off using this one */
 99#define SCTP_ADDR_IFA_UNUSEABLE 0x00000008
100
101struct sctp_ifa {
102	LIST_ENTRY(sctp_ifa) next_ifa;
103	LIST_ENTRY(sctp_ifa) next_bucket;
104	struct sctp_ifn *ifn_p;	/* back pointer to parent ifn */
105	void *ifa;		/* pointer to ifa, needed for flag update for
106				 * that we MUST lock appropriate locks. This
107				 * is for V6. */
108	union sctp_sockstore address;
109	uint32_t refcount;	/* number of folks referring to this */
110	uint32_t flags;
111	uint32_t localifa_flags;
112	uint32_t vrf_id;	/* vrf_id of this addr (for deleting) */
113	uint8_t src_is_loop;
114	uint8_t src_is_priv;
115	uint8_t src_is_glob;
116	uint8_t resv;
117};
118
119struct sctp_laddr {
120	LIST_ENTRY(sctp_laddr) sctp_nxt_addr;	/* next in list */
121	struct sctp_ifa *ifa;
122	uint32_t action;	/* Used during asconf and adding if no-zero
123				 * src-addr selection will not consider this
124				 * address. */
125	struct timeval start_time;	/* time when this address was created */
126};
127
128struct sctp_block_entry {
129	int error;
130};
131
132struct sctp_timewait {
133	time_t tv_sec_at_expire;	/* the seconds from boot to expire */
134	uint32_t v_tag;		/* the vtag that can not be reused */
135	uint16_t lport;		/* the local port used in vtag */
136	uint16_t rport;		/* the remote port used in vtag */
137};
138
139struct sctp_tagblock {
140	LIST_ENTRY(sctp_tagblock) sctp_nxt_tagblock;
141	struct sctp_timewait vtag_block[SCTP_NUMBER_IN_VTAG_BLOCK];
142};
143
144struct sctp_epinfo {
145#ifdef INET
146	struct socket *udp4_tun_socket;
147#endif
148#ifdef INET6
149	struct socket *udp6_tun_socket;
150#endif
151	struct sctpasochead *sctp_asochash;
152	u_long hashasocmark;
153
154	struct sctppcbhead *sctp_ephash;
155	u_long hashmark;
156
157	/*-
158	 * The TCP model represents a substantial overhead in that we get an
159	 * additional hash table to keep explicit connections in. The
160	 * listening TCP endpoint will exist in the usual ephash above and
161	 * accept only INIT's. It will be incapable of sending off an INIT.
162	 * When a dg arrives we must look in the normal ephash. If we find a
163	 * TCP endpoint that will tell us to go to the specific endpoint
164	 * hash and re-hash to find the right assoc/socket. If we find a UDP
165	 * model socket we then must complete the lookup. If this fails,
166	 * i.e. no association can be found then we must continue to see if
167	 * a sctp_peeloff()'d socket is in the tcpephash (a spun off socket
168	 * acts like a TCP model connected socket).
169	 */
170	struct sctppcbhead *sctp_tcpephash;
171	u_long hashtcpmark;
172	uint32_t hashtblsize;
173
174	struct sctp_vrflist *sctp_vrfhash;
175	u_long hashvrfmark;
176
177	struct sctp_ifnlist *vrf_ifn_hash;
178	u_long vrf_ifn_hashmark;
179
180	struct sctppcbhead listhead;
181	struct sctpladdr addr_wq;
182
183	/* ep zone info */
184	sctp_zone_t ipi_zone_ep;
185	sctp_zone_t ipi_zone_asoc;
186	sctp_zone_t ipi_zone_laddr;
187	sctp_zone_t ipi_zone_net;
188	sctp_zone_t ipi_zone_chunk;
189	sctp_zone_t ipi_zone_readq;
190	sctp_zone_t ipi_zone_strmoq;
191	sctp_zone_t ipi_zone_asconf;
192	sctp_zone_t ipi_zone_asconf_ack;
193
194	struct rwlock ipi_ep_mtx;
195	struct mtx ipi_iterator_wq_mtx;
196	struct rwlock ipi_addr_mtx;
197	struct mtx ipi_pktlog_mtx;
198	struct mtx wq_addr_mtx;
199	uint32_t ipi_count_ep;
200
201	/* assoc/tcb zone info */
202	uint32_t ipi_count_asoc;
203
204	/* local addrlist zone info */
205	uint32_t ipi_count_laddr;
206
207	/* remote addrlist zone info */
208	uint32_t ipi_count_raddr;
209
210	/* chunk structure list for output */
211	uint32_t ipi_count_chunk;
212
213	/* socket queue zone info */
214	uint32_t ipi_count_readq;
215
216	/* socket queue zone info */
217	uint32_t ipi_count_strmoq;
218
219	/* Number of vrfs */
220	uint32_t ipi_count_vrfs;
221
222	/* Number of ifns */
223	uint32_t ipi_count_ifns;
224
225	/* Number of ifas */
226	uint32_t ipi_count_ifas;
227
228	/* system wide number of free chunks hanging around */
229	uint32_t ipi_free_chunks;
230	uint32_t ipi_free_strmoq;
231
232	struct sctpvtaghead vtag_timewait[SCTP_STACK_VTAG_HASH_SIZE];
233
234	/* address work queue handling */
235	struct sctp_timer addr_wq_timer;
236
237};
238
239struct sctp_base_info {
240	/*
241	 * All static structures that anchor the system must be here.
242	 */
243	struct sctp_epinfo sctppcbinfo;
244#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT)
245	struct sctpstat *sctpstat;
246#else
247	struct sctpstat sctpstat;
248#endif
249	struct sctp_sysctl sctpsysctl;
250	uint8_t first_time;
251	char sctp_pcb_initialized;
252#if defined(SCTP_PACKET_LOGGING)
253	int packet_log_writers;
254	int packet_log_end;
255	uint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE];
256#endif
257	eventhandler_tag eh_tag;
258};
259
260/*-
261 * Here we have all the relevant information for each SCTP entity created. We
262 * will need to modify this as approprate. We also need to figure out how to
263 * access /dev/random.
264 */
265struct sctp_pcb {
266	time_t time_of_secret_change;	/* number of seconds from
267					 * timeval.tv_sec */
268	uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS];
269	unsigned int size_of_a_cookie;
270
271	uint32_t sctp_timeoutticks[SCTP_NUM_TMRS];
272	uint32_t sctp_minrto;
273	uint32_t sctp_maxrto;
274	uint32_t initial_rto;
275	uint32_t initial_init_rto_max;
276
277	unsigned int sctp_sack_freq;
278	uint32_t sctp_sws_sender;
279	uint32_t sctp_sws_receiver;
280
281	uint32_t sctp_default_cc_module;
282	uint32_t sctp_default_ss_module;
283	/* authentication related fields */
284	struct sctp_keyhead shared_keys;
285	sctp_auth_chklist_t *local_auth_chunks;
286	sctp_hmaclist_t *local_hmacs;
287	uint16_t default_keyid;
288	uint32_t default_mtu;
289
290	/* various thresholds */
291	/* Max times I will init at a guy */
292	uint16_t max_init_times;
293
294	/* Max times I will send before we consider someone dead */
295	uint16_t max_send_times;
296
297	uint16_t def_net_failure;
298
299	uint16_t def_net_pf_threshold;
300
301	/* number of streams to pre-open on a association */
302	uint16_t pre_open_stream_count;
303	uint16_t max_open_streams_intome;
304
305	/* random number generator */
306	uint32_t random_counter;
307	uint8_t random_numbers[SCTP_SIGNATURE_ALOC_SIZE];
308	uint8_t random_store[SCTP_SIGNATURE_ALOC_SIZE];
309
310	/*
311	 * This timer is kept running per endpoint.  When it fires it will
312	 * change the secret key.  The default is once a hour
313	 */
314	struct sctp_timer signature_change;
315
316	uint32_t def_cookie_life;
317	/* defaults to 0 */
318	uint32_t auto_close_time;
319	uint32_t initial_sequence_debug;
320	uint32_t adaptation_layer_indicator;
321	uint8_t adaptation_layer_indicator_provided;
322	uint32_t store_at;
323	uint32_t max_burst;
324	uint32_t fr_max_burst;
325#ifdef INET6
326	uint32_t default_flowlabel;
327#endif
328	uint8_t default_dscp;
329	char current_secret_number;
330	char last_secret_number;
331	uint16_t port;		/* remote UDP encapsulation port */
332};
333
334#ifndef SCTP_ALIGNMENT
335#define SCTP_ALIGNMENT 32
336#endif
337
338#ifndef SCTP_ALIGNM1
339#define SCTP_ALIGNM1 (SCTP_ALIGNMENT-1)
340#endif
341
342#define sctp_lport ip_inp.inp.inp_lport
343
344struct sctp_pcbtsn_rlog {
345	uint32_t vtag;
346	uint16_t strm;
347	uint16_t seq;
348	uint16_t sz;
349	uint16_t flgs;
350};
351#define SCTP_READ_LOG_SIZE 135	/* we choose the number to make a pcb a page */
352
353struct sctp_inpcb {
354	/*-
355	 * put an inpcb in front of it all, kind of a waste but we need to
356	 * for compatibility with all the other stuff.
357	 */
358	union {
359		struct inpcb inp;
360		char align[(sizeof(struct inpcb) + SCTP_ALIGNM1) &
361		    ~SCTP_ALIGNM1];
362	}     ip_inp;
363
364	/* Socket buffer lock protects read_queue and of course sb_cc */
365	struct sctp_readhead read_queue;
366
367	              LIST_ENTRY(sctp_inpcb) sctp_list;	/* lists all endpoints */
368	/* hash of all endpoints for model */
369	              LIST_ENTRY(sctp_inpcb) sctp_hash;
370	/* count of local addresses bound, 0 if bound all */
371	int laddr_count;
372
373	/* list of addrs in use by the EP, NULL if bound-all */
374	struct sctpladdr sctp_addr_list;
375	/*
376	 * used for source address selection rotation when we are subset
377	 * bound
378	 */
379	struct sctp_laddr *next_addr_touse;
380
381	/* back pointer to our socket */
382	struct socket *sctp_socket;
383	uint64_t sctp_features;	/* Feature flags */
384	uint32_t sctp_flags;	/* INP state flag set */
385	uint32_t sctp_mobility_features;	/* Mobility  Feature flags */
386	struct sctp_pcb sctp_ep;	/* SCTP ep data */
387	/* head of the hash of all associations */
388	struct sctpasochead *sctp_tcbhash;
389	u_long sctp_hashmark;
390	/* head of the list of all associations */
391	struct sctpasochead sctp_asoc_list;
392#ifdef SCTP_TRACK_FREED_ASOCS
393	struct sctpasochead sctp_asoc_free_list;
394#endif
395	uint32_t sctp_frag_point;
396	uint32_t partial_delivery_point;
397	uint32_t sctp_context;
398	uint32_t max_cwnd;
399	uint8_t local_strreset_support;
400	uint32_t sctp_cmt_on_off;
401	uint8_t ecn_supported;
402	uint8_t prsctp_supported;
403	uint8_t auth_supported;
404	uint8_t idata_supported;
405	uint8_t asconf_supported;
406	uint8_t reconfig_supported;
407	uint8_t nrsack_supported;
408	uint8_t pktdrop_supported;
409	uint8_t rcv_edmid;
410	struct sctp_nonpad_sndrcvinfo def_send;
411	/*-
412	 * These three are here for the sosend_dgram
413	 * (pkt, pkt_last and control).
414	 * routine. However, I don't think anyone in
415	 * the current FreeBSD kernel calls this. So
416	 * they are candidates with sctp_sendm for
417	 * de-supporting.
418	 */
419	struct mbuf *pkt, *pkt_last;
420	struct mbuf *control;
421	struct mtx inp_mtx;
422	struct mtx inp_create_mtx;
423	struct mtx inp_rdata_mtx;
424	int32_t refcount;
425	uint32_t def_vrf_id;
426	uint16_t fibnum;
427	uint32_t total_sends;
428	uint32_t total_recvs;
429	uint32_t last_abort_code;
430	uint32_t total_nospaces;
431	struct sctpasochead *sctp_asocidhash;
432	u_long hashasocidmark;
433	uint32_t sctp_associd_counter;
434
435#ifdef SCTP_ASOCLOG_OF_TSNS
436	struct sctp_pcbtsn_rlog readlog[SCTP_READ_LOG_SIZE];
437	uint32_t readlog_index;
438#endif
439};
440
441struct sctp_tcb {
442	struct socket *sctp_socket;	/* back pointer to socket */
443	struct sctp_inpcb *sctp_ep;	/* back pointer to ep */
444	           LIST_ENTRY(sctp_tcb) sctp_tcbhash;	/* next link in hash
445							 * table */
446	           LIST_ENTRY(sctp_tcb) sctp_tcblist;	/* list of all of the
447							 * TCB's */
448	           LIST_ENTRY(sctp_tcb) sctp_tcbasocidhash;	/* next link in asocid
449								 * hash table */
450	           LIST_ENTRY(sctp_tcb) sctp_asocs;	/* vtag hash list */
451	struct sctp_block_entry *block_entry;	/* pointer locked by  socket
452						 * send buffer */
453	struct sctp_association asoc;
454	/*-
455	 * freed_by_sorcv_sincelast is protected by the sockbuf_lock NOT the
456	 * tcb_lock. Its special in this way to help avoid extra mutex calls
457	 * in the reading of data.
458	 */
459	uint32_t freed_by_sorcv_sincelast;
460	uint32_t total_sends;
461	uint32_t total_recvs;
462	int freed_from_where;
463	uint16_t rport;		/* remote port in network format */
464	uint16_t resv;
465	struct mtx tcb_mtx;
466};
467
468#include <netinet/sctp_lock_bsd.h>
469
470#if defined(_KERNEL) || defined(__Userspace__)
471
472/* Attention Julian, this is the extern that
473 * goes with the base info. sctp_pcb.c has
474 * the real definition.
475 */
476VNET_DECLARE(struct sctp_base_info, system_base_info);
477
478#ifdef INET6
479int SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b);
480#endif
481
482void sctp_fill_pcbinfo(struct sctp_pcbinfo *);
483
484struct sctp_ifn *sctp_find_ifn(void *ifn, uint32_t ifn_index);
485
486struct sctp_vrf *sctp_allocate_vrf(int vrfid);
487struct sctp_vrf *sctp_find_vrf(uint32_t vrfid);
488void sctp_free_vrf(struct sctp_vrf *vrf);
489
490struct sctp_ifa *
491sctp_add_addr_to_vrf(uint32_t vrfid,
492    void *ifn, uint32_t ifn_index, uint32_t ifn_type,
493    const char *if_name,
494    void *ifa, struct sockaddr *addr, uint32_t ifa_flags,
495    int dynamic_add);
496
497void sctp_free_ifa(struct sctp_ifa *sctp_ifap);
498
499void
500sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,
501    void *ifn, uint32_t ifn_index);
502
503struct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);
504
505struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t);
506
507int
508sctp_inpcb_bind(struct socket *, struct sockaddr *,
509    struct sctp_ifa *, struct thread *);
510int
511sctp_inpcb_bind_locked(struct sctp_inpcb *, struct sockaddr *,
512    struct sctp_ifa *, struct thread *);
513
514struct sctp_tcb *
515sctp_findassociation_addr(struct mbuf *, int,
516    struct sockaddr *, struct sockaddr *,
517    struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb **,
518    struct sctp_nets **, uint32_t vrf_id);
519
520struct sctp_tcb *
521sctp_findassociation_addr_sa(struct sockaddr *,
522    struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int, uint32_t);
523
524void
525sctp_move_pcb_and_assoc(struct sctp_inpcb *, struct sctp_inpcb *,
526    struct sctp_tcb *);
527
528/*-
529 * For this call ep_addr, the to is the destination endpoint address of the
530 * peer (relative to outbound). The from field is only used if the TCP model
531 * is enabled and helps distingush amongst the subset bound (non-boundall).
532 * The TCP model MAY change the actual ep field, this is why it is passed.
533 */
534struct sctp_tcb *
535sctp_findassociation_ep_addr(struct sctp_inpcb **,
536    struct sockaddr *, struct sctp_nets **, struct sockaddr *,
537    struct sctp_tcb *);
538
539struct sctp_tcb *sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock);
540
541struct sctp_tcb *
542sctp_findassociation_ep_asocid(struct sctp_inpcb *,
543    sctp_assoc_t, int);
544
545struct sctp_tcb *
546sctp_findassociation_ep_asconf(struct mbuf *, int, struct sockaddr *,
547    struct sctphdr *, struct sctp_inpcb **, struct sctp_nets **, uint32_t vrf_id);
548
549int sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id);
550
551int sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id);
552
553void sctp_inpcb_free(struct sctp_inpcb *, int, int);
554
555#define SCTP_DONT_INITIALIZE_AUTH_PARAMS	0
556#define SCTP_INITIALIZE_AUTH_PARAMS		1
557
558struct sctp_tcb *
559sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
560    int *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t,
561    struct thread *, int);
562struct sctp_tcb *
563sctp_aloc_assoc_connected(struct sctp_inpcb *, struct sockaddr *,
564    int *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t,
565    struct thread *, int);
566
567int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);
568
569void sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t);
570
571void sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *);
572
573int sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, struct sctp_nets **, uint16_t, int, int);
574
575void sctp_remove_net(struct sctp_tcb *, struct sctp_nets *);
576
577int sctp_del_remote_addr(struct sctp_tcb *, struct sockaddr *);
578
579void sctp_pcb_init(void);
580
581void sctp_pcb_finish(void);
582
583void sctp_add_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
584void sctp_del_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
585
586int
587sctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int, int,
588    struct sockaddr *, struct sockaddr *, struct sockaddr *, uint16_t);
589
590int
591sctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *,
592    struct sctp_nets *);
593
594bool
595     sctp_is_vtag_good(uint32_t, uint16_t lport, uint16_t rport, struct timeval *);
596
597int sctp_destination_is_reachable(struct sctp_tcb *, struct sockaddr *);
598
599int sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp);
600
601void sctp_clean_up_stream(struct sctp_tcb *stcb, struct sctp_readhead *rh);
602
603void
604     sctp_pcb_add_flags(struct sctp_inpcb *, uint32_t);
605
606/*-
607 * Null in last arg inpcb indicate run on ALL ep's. Specific inp in last arg
608 * indicates run on ONLY assoc's of the specified endpoint.
609 */
610int
611sctp_initiate_iterator(inp_func inpf,
612    asoc_func af,
613    inp_func inpe,
614    uint32_t, uint32_t,
615    uint32_t, void *,
616    uint32_t,
617    end_func ef,
618    struct sctp_inpcb *,
619    uint8_t co_off);
620#if defined(SCTP_MCORE_INPUT) && defined(SMP)
621void
622     sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use);
623
624#endif
625
626#endif				/* _KERNEL */
627#endif				/* !__sctp_pcb_h__ */