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