sctp_pcb.h revision 172091
1103285Sikob/*- 2103285Sikob * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. 3103285Sikob * 4103285Sikob * Redistribution and use in source and binary forms, with or without 5103285Sikob * modification, are permitted provided that the following conditions are met: 6103285Sikob * 7103285Sikob * a) Redistributions of source code must retain the above copyright notice, 8103285Sikob * this list of conditions and the following disclaimer. 9103285Sikob * 10103285Sikob * b) Redistributions in binary form must reproduce the above copyright 11103285Sikob * notice, this list of conditions and the following disclaimer in 12103285Sikob * the documentation and/or other materials provided with the distribution. 13103285Sikob * 14103285Sikob * c) Neither the name of Cisco Systems, Inc. nor the names of its 15103285Sikob * contributors may be used to endorse or promote products derived 16103285Sikob * from this software without specific prior written permission. 17103285Sikob * 18103285Sikob * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19103285Sikob * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20103285Sikob * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21103285Sikob * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22103285Sikob * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23103285Sikob * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24103285Sikob * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25103285Sikob * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26103285Sikob * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27103285Sikob * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28103285Sikob * THE POSSIBILITY OF SUCH DAMAGE. 29103285Sikob */ 30103285Sikob 31103285Sikob/* $KAME: sctp_pcb.h,v 1.21 2005/07/16 01:18:47 suz Exp $ */ 32103285Sikob 33103285Sikob#include <sys/cdefs.h> 34103285Sikob__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.h 172091 2007-09-08 17:48:46Z rrs $"); 35103285Sikob 36103285Sikob#ifndef __sctp_pcb_h__ 37103285Sikob#define __sctp_pcb_h__ 38103285Sikob 39103285Sikob#include <netinet/sctp_os.h> 40103285Sikob#include <netinet/sctp.h> 41103285Sikob#include <netinet/sctp_constants.h> 42103285Sikob 43103285SikobLIST_HEAD(sctppcbhead, sctp_inpcb); 44103285SikobLIST_HEAD(sctpasochead, sctp_tcb); 45103285SikobLIST_HEAD(sctpladdr, sctp_laddr); 46103285SikobLIST_HEAD(sctpvtaghead, sctp_tagblock); 47103285SikobLIST_HEAD(sctp_vrflist, sctp_vrf); 48103285SikobLIST_HEAD(sctp_ifnlist, sctp_ifn); 49103285SikobLIST_HEAD(sctp_ifalist, sctp_ifa); 50103285SikobTAILQ_HEAD(sctp_readhead, sctp_queued_to_read); 51103285SikobTAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending); 52103285Sikob 53103285Sikob#include <netinet/sctp_structs.h> 54103285Sikob#include <netinet/sctp_auth.h> 55103285Sikob 56103285Sikob#define SCTP_PCBHASH_ALLADDR(port, mask) (port & mask) 57103285Sikob#define SCTP_PCBHASH_ASOC(tag, mask) (tag & mask) 58103285Sikob 59103285Sikobstruct sctp_vrf { 60103285Sikob LIST_ENTRY(sctp_vrf) next_vrf; 61103285Sikob struct sctp_ifalist *vrf_addr_hash; 62103285Sikob struct sctp_ifnlist ifnlist; 63103285Sikob uint32_t vrf_id; 64103285Sikob uint32_t tbl_id_v4; /* default v4 table id */ 65103285Sikob uint32_t tbl_id_v6; /* default v6 table id */ 66103285Sikob uint32_t total_ifa_count; 67103285Sikob u_long vrf_addr_hashmark; 68103285Sikob uint32_t refcount; 69103285Sikob}; 70103285Sikob 71103285Sikobstruct sctp_ifn { 72103285Sikob struct sctp_ifalist ifalist; 73103285Sikob struct sctp_vrf *vrf; 74103285Sikob LIST_ENTRY(sctp_ifn) next_ifn; 75103285Sikob LIST_ENTRY(sctp_ifn) next_bucket; 76103285Sikob void *ifn_p; /* never access without appropriate lock */ 77103285Sikob uint32_t ifn_mtu; 78103285Sikob uint32_t ifn_type; 79103285Sikob uint32_t ifn_index; /* shorthand way to look at ifn for reference */ 80103285Sikob uint32_t refcount; /* number of reference held should be >= 81103285Sikob * ifa_count */ 82103285Sikob uint32_t ifa_count; /* IFA's we hold (in our list - ifalist) */ 83103285Sikob uint32_t num_v6; /* number of v6 addresses */ 84103285Sikob uint32_t num_v4; /* number of v4 addresses */ 85103285Sikob uint32_t registered_af; /* registered address family for i/f events */ 86103285Sikob char ifn_name[SCTP_IFNAMSIZ]; 87103285Sikob}; 88103285Sikob 89103285Sikob/* SCTP local IFA flags */ 90103285Sikob#define SCTP_ADDR_VALID 0x00000001 /* its up and active */ 91103285Sikob#define SCTP_BEING_DELETED 0x00000002 /* being deleted, when 92103285Sikob * refcount = 0. Note that it 93103285Sikob * is pulled from the ifn list 94103285Sikob * and ifa_p is nulled right 95103285Sikob * away but it cannot be freed 96103285Sikob * until the last *net 97103285Sikob * pointing to it is deleted. */ 98103285Sikob#define SCTP_ADDR_DEFER_USE 0x00000004 /* Hold off using this one */ 99103285Sikob#define SCTP_ADDR_IFA_UNUSEABLE 0x00000008 100103285Sikob 101103285Sikobstruct sctp_ifa { 102103285Sikob LIST_ENTRY(sctp_ifa) next_ifa; 103103285Sikob LIST_ENTRY(sctp_ifa) next_bucket; 104103285Sikob struct sctp_ifn *ifn_p; /* back pointer to parent ifn */ 105103285Sikob void *ifa; /* pointer to ifa, needed for flag update for 106103285Sikob * that we MUST lock appropriate locks. This 107103285Sikob * is for V6. */ 108103285Sikob union sctp_sockstore address; 109103285Sikob uint32_t refcount; /* number of folks refering to this */ 110103285Sikob uint32_t flags; 111103285Sikob uint32_t localifa_flags; 112103285Sikob uint32_t vrf_id; /* vrf_id of this addr (for deleting) */ 113103285Sikob uint8_t src_is_loop; 114103285Sikob uint8_t src_is_priv; 115103285Sikob uint8_t src_is_glob; 116103285Sikob uint8_t resv; 117103285Sikob}; 118103285Sikob 119103285Sikobstruct sctp_laddr { 120103285Sikob LIST_ENTRY(sctp_laddr) sctp_nxt_addr; /* next in list */ 121103285Sikob struct sctp_ifa *ifa; 122103285Sikob uint32_t action; /* Used during asconf and adding if no-zero 123103285Sikob * src-addr selection will not consider this 124103285Sikob * address. */ 125103285Sikob struct timeval start_time; /* time when this address was created */ 126103285Sikob}; 127103285Sikob 128103285Sikobstruct sctp_block_entry { 129103285Sikob int error; 130103285Sikob}; 131103285Sikob 132107653Ssimokawastruct sctp_timewait { 133103285Sikob uint32_t tv_sec_at_expire; /* the seconds from boot to expire */ 134103285Sikob uint32_t v_tag; /* the vtag that can not be reused */ 135103285Sikob}; 136103285Sikob 137103285Sikobstruct sctp_tagblock { 138103285Sikob LIST_ENTRY(sctp_tagblock) sctp_nxt_tagblock; 139103285Sikob struct sctp_timewait vtag_block[SCTP_NUMBER_IN_VTAG_BLOCK]; 140103285Sikob}; 141103285Sikob 142103285Sikobstruct sctp_epinfo { 143103285Sikob struct sctpasochead *sctp_asochash; 144103285Sikob u_long hashasocmark; 145103285Sikob 146103285Sikob struct sctppcbhead *sctp_ephash; 147103285Sikob u_long hashmark; 148103285Sikob 149103285Sikob struct sctpasochead *sctp_restarthash; 150103285Sikob u_long hashrestartmark; 151103285Sikob /*- 152103285Sikob * The TCP model represents a substantial overhead in that we get an 153103285Sikob * additional hash table to keep explicit connections in. The 154103285Sikob * listening TCP endpoint will exist in the usual ephash above and 155103285Sikob * accept only INIT's. It will be incapable of sending off an INIT. 156103285Sikob * When a dg arrives we must look in the normal ephash. If we find a 157103285Sikob * TCP endpoint that will tell us to go to the specific endpoint 158103285Sikob * hash and re-hash to find the right assoc/socket. If we find a UDP 159103285Sikob * model socket we then must complete the lookup. If this fails, 160103285Sikob * i.e. no association can be found then we must continue to see if 161103285Sikob * a sctp_peeloff()'d socket is in the tcpephash (a spun off socket 162103285Sikob * acts like a TCP model connected socket). 163103285Sikob */ 164103285Sikob struct sctppcbhead *sctp_tcpephash; 165103285Sikob u_long hashtcpmark; 166103285Sikob uint32_t hashtblsize; 167103285Sikob 168103285Sikob struct sctp_vrflist *sctp_vrfhash; 169103285Sikob u_long hashvrfmark; 170103285Sikob 171103285Sikob struct sctp_ifnlist *vrf_ifn_hash; 172103285Sikob u_long vrf_ifn_hashmark; 173103285Sikob 174103285Sikob struct sctppcbhead listhead; 175103285Sikob struct sctpladdr addr_wq; 176103285Sikob 177103285Sikob struct sctpiterators iteratorhead; 178103285Sikob 179103285Sikob /* ep zone info */ 180103285Sikob sctp_zone_t ipi_zone_ep; 181103285Sikob sctp_zone_t ipi_zone_asoc; 182103285Sikob sctp_zone_t ipi_zone_laddr; 183103285Sikob sctp_zone_t ipi_zone_net; 184103285Sikob sctp_zone_t ipi_zone_chunk; 185103285Sikob sctp_zone_t ipi_zone_readq; 186103285Sikob sctp_zone_t ipi_zone_strmoq; 187103285Sikob sctp_zone_t ipi_zone_asconf_ack; 188103285Sikob 189103285Sikob struct mtx ipi_ep_mtx; 190103285Sikob struct mtx it_mtx; 191103285Sikob struct mtx ipi_iterator_wq_mtx; 192103285Sikob struct mtx ipi_addr_mtx; 193103285Sikob struct mtx ipi_pktlog_mtx; 194103285Sikob uint32_t ipi_count_ep; 195103285Sikob 196103285Sikob /* assoc/tcb zone info */ 197103285Sikob uint32_t ipi_count_asoc; 198103285Sikob 199103285Sikob /* local addrlist zone info */ 200103285Sikob uint32_t ipi_count_laddr; 201103285Sikob 202103285Sikob /* remote addrlist zone info */ 203103285Sikob uint32_t ipi_count_raddr; 204103285Sikob 205103285Sikob /* chunk structure list for output */ 206103285Sikob uint32_t ipi_count_chunk; 207103285Sikob 208103285Sikob /* socket queue zone info */ 209103285Sikob uint32_t ipi_count_readq; 210103285Sikob 211110336Ssimokawa /* socket queue zone info */ 212103285Sikob uint32_t ipi_count_strmoq; 213103285Sikob 214110336Ssimokawa /* Number of vrfs */ 215103285Sikob uint32_t ipi_count_vrfs; 216103285Sikob 217103285Sikob /* Number of ifns */ 218103285Sikob uint32_t ipi_count_ifns; 219103285Sikob 220110336Ssimokawa /* Number of ifas */ 221110336Ssimokawa uint32_t ipi_count_ifas; 222110336Ssimokawa 223108503Ssimokawa /* system wide number of free chunks hanging around */ 224108503Ssimokawa uint32_t ipi_free_chunks; 225103285Sikob uint32_t ipi_free_strmoq; 226103285Sikob 227103285Sikob 228103285Sikob struct sctpvtaghead vtag_timewait[SCTP_STACK_VTAG_HASH_SIZE_A]; 229103285Sikob 230103285Sikob /* address work queue handling */ 231103285Sikob#if defined(SCTP_USE_THREAD_BASED_ITERATOR) 232103285Sikob uint32_t iterator_running; 233103285Sikob SCTP_PROCESS_STRUCT thread_proc; 234103285Sikob#endif 235103285Sikob struct sctp_timer addr_wq_timer; 236103285Sikob 237103285Sikob}; 238103285Sikob 239103285Sikob/*- 240103285Sikob * Here we have all the relevant information for each SCTP entity created. We 241103285Sikob * will need to modify this as approprate. We also need to figure out how to 242103285Sikob * access /dev/random. 243103285Sikob */ 244103285Sikobstruct sctp_pcb { 245103285Sikob unsigned int time_of_secret_change; /* number of seconds from 246103285Sikob * timeval.tv_sec */ 247103285Sikob uint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS]; 248103285Sikob unsigned int size_of_a_cookie; 249103285Sikob 250103285Sikob unsigned int sctp_timeoutticks[SCTP_NUM_TMRS]; 251103285Sikob unsigned int sctp_minrto; 252103285Sikob unsigned int sctp_maxrto; 253103285Sikob unsigned int initial_rto; 254103285Sikob int initial_init_rto_max; 255103285Sikob 256103285Sikob unsigned int sctp_sack_freq; 257103285Sikob uint32_t sctp_sws_sender; 258103285Sikob uint32_t sctp_sws_receiver; 259103285Sikob 260103285Sikob uint32_t sctp_default_cc_module; 261103285Sikob /* authentication related fields */ 262103285Sikob struct sctp_keyhead shared_keys; 263103285Sikob sctp_auth_chklist_t *local_auth_chunks; 264103285Sikob sctp_hmaclist_t *local_hmacs; 265103285Sikob uint16_t default_keyid; 266110145Ssimokawa 267103285Sikob /* various thresholds */ 268110336Ssimokawa /* Max times I will init at a guy */ 269103285Sikob uint16_t max_init_times; 270108281Ssimokawa 271103285Sikob /* Max times I will send before we consider someone dead */ 272103285Sikob uint16_t max_send_times; 273103285Sikob 274103285Sikob uint16_t def_net_failure; 275103285Sikob 276103285Sikob /* number of streams to pre-open on a association */ 277103285Sikob uint16_t pre_open_stream_count; 278103285Sikob uint16_t max_open_streams_intome; 279103285Sikob 280103285Sikob /* random number generator */ 281103285Sikob uint32_t random_counter; 282103285Sikob uint8_t random_numbers[SCTP_SIGNATURE_ALOC_SIZE]; 283103285Sikob uint8_t random_store[SCTP_SIGNATURE_ALOC_SIZE]; 284103285Sikob 285103285Sikob /* 286103285Sikob * This timer is kept running per endpoint. When it fires it will 287103285Sikob * change the secret key. The default is once a hour 288103285Sikob */ 289103285Sikob struct sctp_timer signature_change; 290103285Sikob 291103285Sikob /* Zero copy full buffer timer */ 292103285Sikob struct sctp_timer zero_copy_timer; 293103285Sikob /* Zero copy app to transport (sendq) read repulse timer */ 294103285Sikob struct sctp_timer zero_copy_sendq_timer; 295103285Sikob uint32_t def_cookie_life; 296103285Sikob /* defaults to 0 */ 297103285Sikob int auto_close_time; 298103285Sikob uint32_t initial_sequence_debug; 299103285Sikob uint32_t adaptation_layer_indicator; 300103285Sikob uint32_t store_at; 301103285Sikob uint8_t max_burst; 302103285Sikob char current_secret_number; 303103285Sikob char last_secret_number; 304103285Sikob}; 305103285Sikob 306103285Sikob#ifndef SCTP_ALIGNMENT 307103285Sikob#define SCTP_ALIGNMENT 32 308103285Sikob#endif 309103285Sikob 310103285Sikob#ifndef SCTP_ALIGNM1 311103285Sikob#define SCTP_ALIGNM1 (SCTP_ALIGNMENT-1) 312103285Sikob#endif 313103285Sikob 314103285Sikob#define sctp_lport ip_inp.inp.inp_lport 315103285Sikob 316103285Sikobstruct sctp_pcbtsn_rlog { 317103285Sikob uint32_t vtag; 318103285Sikob uint16_t strm; 319103285Sikob uint16_t seq; 320103285Sikob uint16_t sz; 321103285Sikob uint16_t flgs; 322103285Sikob}; 323103285Sikob 324103285Sikob#define SCTP_READ_LOG_SIZE 135 /* we choose the number to make a pcb a page */ 325103285Sikob 326103285Sikob 327103285Sikobstruct sctp_inpcb { 328103285Sikob /*- 329103285Sikob * put an inpcb in front of it all, kind of a waste but we need to 330103285Sikob * for compatability with all the other stuff. 331103285Sikob */ 332103285Sikob union { 333103285Sikob struct inpcb inp; 334103285Sikob char align[(sizeof(struct in6pcb) + SCTP_ALIGNM1) & 335103285Sikob ~SCTP_ALIGNM1]; 336103285Sikob } ip_inp; 337103285Sikob 338103285Sikob 339103285Sikob /* Socket buffer lock protects read_queue and of course sb_cc */ 340103285Sikob struct sctp_readhead read_queue; 341103285Sikob 342103285Sikob LIST_ENTRY(sctp_inpcb) sctp_list; /* lists all endpoints */ 343103285Sikob /* hash of all endpoints for model */ 344103285Sikob LIST_ENTRY(sctp_inpcb) sctp_hash; 345103285Sikob /* count of local addresses bound, 0 if bound all */ 346103285Sikob int laddr_count; 347103285Sikob 348103285Sikob /* list of addrs in use by the EP, NULL if bound-all */ 349103285Sikob struct sctpladdr sctp_addr_list; 350103285Sikob /* 351103285Sikob * used for source address selection rotation when we are subset 352103285Sikob * bound 353103285Sikob */ 354103285Sikob struct sctp_laddr *next_addr_touse; 355103285Sikob 356103285Sikob /* back pointer to our socket */ 357103285Sikob struct socket *sctp_socket; 358103285Sikob uint32_t sctp_flags; /* INP state flag set */ 359103285Sikob uint32_t sctp_features; /* Feature flags */ 360103285Sikob uint32_t sctp_mobility_features; /* Mobility Feature flags */ 361103285Sikob struct sctp_pcb sctp_ep;/* SCTP ep data */ 362103285Sikob /* head of the hash of all associations */ 363103285Sikob struct sctpasochead *sctp_tcbhash; 364103285Sikob u_long sctp_hashmark; 365103285Sikob /* head of the list of all associations */ 366103285Sikob struct sctpasochead sctp_asoc_list; 367103285Sikob#ifdef SCTP_TRACK_FREED_ASOCS 368103285Sikob struct sctpasochead sctp_asoc_free_list; 369103285Sikob#endif 370103285Sikob struct sctp_iterator *inp_starting_point_for_iterator; 371108503Ssimokawa uint32_t sctp_frag_point; 372108503Ssimokawa uint32_t partial_delivery_point; 373103285Sikob uint32_t sctp_context; 374103285Sikob struct sctp_nonpad_sndrcvinfo def_send; 375103285Sikob /*- 376103285Sikob * These three are here for the sosend_dgram 377103285Sikob * (pkt, pkt_last and control). 378103285Sikob * routine. However, I don't think anyone in 379103285Sikob * the current FreeBSD kernel calls this. So 380103285Sikob * they are candidates with sctp_sendm for 381103285Sikob * de-supporting. 382103285Sikob */ 383103285Sikob struct mbuf *pkt, *pkt_last; 384103285Sikob struct mbuf *control; 385103285Sikob struct mtx inp_mtx; 386103285Sikob struct mtx inp_create_mtx; 387110184Ssimokawa struct mtx inp_rdata_mtx; 388110184Ssimokawa int32_t refcount; 389110184Ssimokawa uint32_t def_vrf_id; 390110184Ssimokawa uint32_t total_sends; 391110184Ssimokawa uint32_t total_recvs; 392110184Ssimokawa uint32_t last_abort_code; 393110184Ssimokawa uint32_t total_nospaces; 394110184Ssimokawa#ifdef SCTP_ASOCLOG_OF_TSNS 395110184Ssimokawa struct sctp_pcbtsn_rlog readlog[SCTP_READ_LOG_SIZE]; 396110184Ssimokawa uint32_t readlog_index; 397110184Ssimokawa#endif 398110184Ssimokawa}; 399110184Ssimokawa 400110184Ssimokawastruct sctp_tcb { 401110184Ssimokawa struct socket *sctp_socket; /* back pointer to socket */ 402110184Ssimokawa struct sctp_inpcb *sctp_ep; /* back pointer to ep */ 403110184Ssimokawa LIST_ENTRY(sctp_tcb) sctp_tcbhash; /* next link in hash 404110184Ssimokawa * table */ 405110184Ssimokawa LIST_ENTRY(sctp_tcb) sctp_tcblist; /* list of all of the 406110184Ssimokawa * TCB's */ 407110184Ssimokawa LIST_ENTRY(sctp_tcb) sctp_tcbrestarhash; /* next link in restart 408110184Ssimokawa * hash table */ 409110184Ssimokawa LIST_ENTRY(sctp_tcb) sctp_asocs; /* vtag hash list */ 410110184Ssimokawa struct sctp_block_entry *block_entry; /* pointer locked by socket 411110184Ssimokawa * send buffer */ 412110184Ssimokawa struct sctp_association asoc; 413110184Ssimokawa /*- 414110184Ssimokawa * freed_by_sorcv_sincelast is protected by the sockbuf_lock NOT the 415110184Ssimokawa * tcb_lock. Its special in this way to help avoid extra mutex calls 416110184Ssimokawa * in the reading of data. 417110184Ssimokawa */ 418110184Ssimokawa uint32_t freed_by_sorcv_sincelast; 419110184Ssimokawa uint32_t total_sends; 420110184Ssimokawa uint32_t total_recvs; 421110184Ssimokawa int freed_from_where; 422110184Ssimokawa uint16_t rport; /* remote port in network format */ 423110184Ssimokawa uint16_t resv; 424110184Ssimokawa struct mtx tcb_mtx; 425110184Ssimokawa struct mtx tcb_send_mtx; 426110184Ssimokawa}; 427110184Ssimokawa 428110184Ssimokawa 429110184Ssimokawa 430110184Ssimokawa#include <netinet/sctp_lock_bsd.h> 431110184Ssimokawa 432110184Ssimokawa 433110184Ssimokawa#if defined(_KERNEL) 434110184Ssimokawa 435110184Ssimokawaextern struct sctp_epinfo sctppcbinfo; 436110184Ssimokawa 437110184Ssimokawaint SCTP6_ARE_ADDR_EQUAL(struct in6_addr *a, struct in6_addr *b); 438110184Ssimokawa 439103285Sikobvoid sctp_fill_pcbinfo(struct sctp_pcbinfo *); 440103285Sikob 441103285Sikobstruct sctp_ifn * 442108503Ssimokawa sctp_find_ifn(void *ifn, uint32_t ifn_index); 443103285Sikob 444103285Sikobstruct sctp_vrf *sctp_allocate_vrf(int vrfid); 445108503Ssimokawastruct sctp_vrf *sctp_find_vrf(uint32_t vrfid); 446108503Ssimokawavoid sctp_free_vrf(struct sctp_vrf *vrf); 447103285Sikob 448103285Sikob/*- 449103285Sikob * Change address state, can be used if 450103285Sikob * O/S supports telling transports about 451110184Ssimokawa * changes to IFA/IFN's (link layer triggers). 452110184Ssimokawa * If a ifn goes down, we will do src-addr-selection 453110184Ssimokawa * and NOT use that, as a source address. This does 454103285Sikob * not stop the routing system from routing out 455103285Sikob * that interface, but we won't put it as a source. 456103285Sikob */ 457103285Sikobvoid sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index); 458103285Sikobvoid sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index); 459103285Sikob 460103285Sikobstruct sctp_ifa * 461103285Sikobsctp_add_addr_to_vrf(uint32_t vrfid, 462103285Sikob void *ifn, uint32_t ifn_index, uint32_t ifn_type, 463103285Sikob const char *if_name, 464103285Sikob void *ifa, struct sockaddr *addr, uint32_t ifa_flags, 465103285Sikob int dynamic_add); 466103285Sikob 467103285Sikobvoid sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu); 468103285Sikob 469103285Sikobvoid sctp_free_ifn(struct sctp_ifn *sctp_ifnp); 470108503Ssimokawavoid sctp_free_ifa(struct sctp_ifa *sctp_ifap); 471108503Ssimokawa 472108503Ssimokawa 473108503Ssimokawavoid 474108503Ssimokawasctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr, 475108503Ssimokawa uint32_t ifn_index, const char *if_name); 476108503Ssimokawa 477108503Ssimokawa 478108642Ssimokawa 479108642Ssimokawastruct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *); 480108642Ssimokawa 481108503Ssimokawastruct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t); 482108503Ssimokawa 483108503Ssimokawaint 484108503Ssimokawasctp_inpcb_bind(struct socket *, struct sockaddr *, 485108503Ssimokawa struct sctp_ifa *, struct thread *); 486108503Ssimokawa 487108503Ssimokawastruct sctp_tcb * 488108503Ssimokawasctp_findassociation_addr(struct mbuf *, int, int, 489103285Sikob struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb **, 490103285Sikob struct sctp_nets **, uint32_t vrf_id); 491103285Sikob 492103285Sikobstruct sctp_tcb * 493103285Sikobsctp_findassociation_addr_sa(struct sockaddr *, 494103285Sikob struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int, uint32_t); 495103285Sikob 496103285Sikobvoid 497108503Ssimokawasctp_move_pcb_and_assoc(struct sctp_inpcb *, struct sctp_inpcb *, 498103285Sikob struct sctp_tcb *); 499108503Ssimokawa 500108503Ssimokawa/*- 501108503Ssimokawa * For this call ep_addr, the to is the destination endpoint address of the 502108503Ssimokawa * peer (relative to outbound). The from field is only used if the TCP model 503108503Ssimokawa * is enabled and helps distingush amongst the subset bound (non-boundall). 504108503Ssimokawa * The TCP model MAY change the actual ep field, this is why it is passed. 505108503Ssimokawa */ 506108503Ssimokawastruct sctp_tcb * 507108503Ssimokawasctp_findassociation_ep_addr(struct sctp_inpcb **, 508108503Ssimokawa struct sockaddr *, struct sctp_nets **, struct sockaddr *, 509103285Sikob struct sctp_tcb *); 510103285Sikob 511103285Sikobstruct sctp_tcb * 512103285Sikobsctp_findassociation_ep_asocid(struct sctp_inpcb *, 513103285Sikob sctp_assoc_t, int); 514103285Sikob 515103285Sikobstruct sctp_tcb * 516103285Sikobsctp_findassociation_ep_asconf(struct mbuf *, int, int, 517103285Sikob struct sctphdr *, struct sctp_inpcb **, struct sctp_nets **); 518103285Sikob 519103285Sikobint sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id); 520103285Sikob 521103285Sikobint sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id); 522103285Sikob 523103285Sikobvoid sctp_inpcb_free(struct sctp_inpcb *, int, int); 524103285Sikob 525103285Sikobstruct sctp_tcb * 526103285Sikobsctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *, 527103285Sikob int, int *, uint32_t, uint32_t, struct thread *); 528103285Sikob 529103285Sikobint sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int); 530103285Sikob 531103285Sikob 532103285Sikobvoid sctp_delete_from_timewait(uint32_t); 533103285Sikob 534103285Sikobvoid 535103285Sikob sctp_add_vtag_to_timewait(uint32_t, uint32_t); 536103285Sikob 537103285Sikobvoid sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t); 538103285Sikob 539103285Sikobint sctp_insert_laddr(struct sctpladdr *, struct sctp_ifa *, uint32_t); 540103285Sikob 541103285Sikobvoid sctp_remove_laddr(struct sctp_laddr *); 542103285Sikob 543103285Sikobvoid sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *); 544103285Sikob 545103285Sikobint sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, int, int); 546103285Sikob 547103285Sikobvoid sctp_remove_net(struct sctp_tcb *, struct sctp_nets *); 548103285Sikob 549103285Sikobint sctp_del_remote_addr(struct sctp_tcb *, struct sockaddr *); 550103285Sikob 551103285Sikobvoid sctp_pcb_init(void); 552103285Sikob 553103285Sikob 554103285Sikobvoid sctp_add_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); 555103285Sikobvoid sctp_del_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *); 556103285Sikob 557103285Sikobint 558103285Sikobsctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int, int, 559103285Sikob int, struct sctphdr *, struct sockaddr *); 560103285Sikob 561103285Sikobint 562103285Sikobsctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *, 563103285Sikob struct sctp_nets *); 564103285Sikob 565103285Sikobint sctp_is_vtag_good(struct sctp_inpcb *, uint32_t, struct timeval *); 566103285Sikob 567103285Sikob/* void sctp_drain(void); */ 568103285Sikob 569103285Sikobint sctp_destination_is_reachable(struct sctp_tcb *, struct sockaddr *); 570103285Sikob 571103285Sikob/*- 572103285Sikob * Null in last arg inpcb indicate run on ALL ep's. Specific inp in last arg 573103285Sikob * indicates run on ONLY assoc's of the specified endpoint. 574103285Sikob */ 575103285Sikobint 576103285Sikobsctp_initiate_iterator(inp_func inpf, 577103285Sikob asoc_func af, 578103285Sikob inp_func inpe, 579103285Sikob uint32_t, uint32_t, 580103285Sikob uint32_t, void *, 581103285Sikob uint32_t, 582103285Sikob end_func ef, 583110336Ssimokawa struct sctp_inpcb *, 584103285Sikob uint8_t co_off); 585103285Sikob 586103285Sikob#endif /* _KERNEL */ 587103285Sikob#endif /* !__sctp_pcb_h__ */ 588110336Ssimokawa