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