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_LOCK_BSD_H_ 37 #define _NETINET_SCTP_LOCK_BSD_H_ 38 39 /* 40 * General locking concepts: The goal of our locking is to of course provide 41 * consistency and yet minimize overhead. We will attempt to use 42 * non-recursive locks which are supposed to be quite inexpensive. Now in 43 * order to do this the goal is that most functions are not aware of locking. 44 * Once we have a TCB we lock it and unlock when we are through. This means 45 * that the TCB lock is kind-of a "global" lock when working on an 46 * association. Caution must be used when asserting a TCB_LOCK since if we 47 * recurse we deadlock. 48 * 49 * Most other locks (INP and INFO) attempt to localize the locking i.e. we try 50 * to contain the lock and unlock within the function that needs to lock it. 51 * This sometimes mean we do extra locks and unlocks and lose a bit of 52 * efficiency, but if the performance statements about non-recursive locks are 53 * true this should not be a problem. One issue that arises with this only 54 * lock when needed is that if an implicit association setup is done we have 55 * a problem. If at the time I lookup an association I have NULL in the tcb 56 * return, by the time I call to create the association some other processor 57 * could have created it. This is what the CREATE lock on the endpoint. 58 * Places where we will be implicitly creating the association OR just 59 * creating an association (the connect call) will assert the CREATE_INP 60 * lock. This will assure us that during all the lookup of INP and INFO if 61 * another creator is also locking/looking up we can gate the two to 62 * synchronize. So the CREATE_INP lock is also another one we must use 63 * extreme caution in locking to make sure we don't hit a re-entrancy issue. 64 * 65 */ 66 67 /* 68 * When working with the global SCTP lists we lock and unlock the INP_INFO 69 * lock. So when we go to lookup an association we will want to do a 70 * SCTP_INP_INFO_RLOCK() and then when we want to add a new association to 71 * the SCTP_BASE_INFO() list's we will do a SCTP_INP_INFO_WLOCK(). 72 */ 73 74 #define SCTP_IPI_COUNT_INIT() 75 76 #define SCTP_STATLOG_INIT_LOCK() 77 #define SCTP_STATLOG_DESTROY() 78 #define SCTP_STATLOG_LOCK() 79 #define SCTP_STATLOG_UNLOCK() 80 81 #define SCTP_INP_INFO_LOCK_INIT() do { \ 82 rw_init(&SCTP_BASE_INFO(ipi_ep_mtx), "sctp-info"); \ 83 } while (0) 84 85 #define SCTP_INP_INFO_LOCK_DESTROY() do { \ 86 if (rw_wowned(&SCTP_BASE_INFO(ipi_ep_mtx))) { \ 87 rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ 88 } \ 89 rw_destroy(&SCTP_BASE_INFO(ipi_ep_mtx)); \ 90 } while (0) 91 92 #define SCTP_INP_INFO_RLOCK() do { \ 93 rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ 94 } while (0) 95 96 #define SCTP_INP_INFO_WLOCK() do { \ 97 rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ 98 } while (0) 99 100 #define SCTP_INP_INFO_RUNLOCK() do { \ 101 rw_runlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ 102 } while (0) 103 104 #define SCTP_INP_INFO_WUNLOCK() do { \ 105 rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ 106 } while (0) 107 108 #define SCTP_INP_INFO_LOCK_ASSERT() do { \ 109 rw_assert(&SCTP_BASE_INFO(ipi_ep_mtx), RA_LOCKED); \ 110 } while (0) 111 112 #define SCTP_INP_INFO_RLOCK_ASSERT() do { \ 113 rw_assert(&SCTP_BASE_INFO(ipi_ep_mtx), RA_RLOCKED); \ 114 } while (0) 115 116 #define SCTP_INP_INFO_WLOCK_ASSERT() do { \ 117 rw_assert(&SCTP_BASE_INFO(ipi_ep_mtx), RA_WLOCKED); \ 118 } while (0) 119 120 #define SCTP_MCORE_QLOCK_INIT(cpstr) do { \ 121 mtx_init(&(cpstr)->que_mtx, "sctp-mcore_queue","queue_lock", \ 122 MTX_DEF | MTX_DUPOK); \ 123 } while (0) 124 125 #define SCTP_MCORE_QDESTROY(cpstr) do { \ 126 if (mtx_owned(&(cpstr)->core_mtx)) { \ 127 mtx_unlock(&(cpstr)->que_mtx); \ 128 } \ 129 mtx_destroy(&(cpstr)->que_mtx); \ 130 } while (0) 131 132 #define SCTP_MCORE_QLOCK(cpstr) do { \ 133 mtx_lock(&(cpstr)->que_mtx); \ 134 } while (0) 135 136 #define SCTP_MCORE_QUNLOCK(cpstr) do { \ 137 mtx_unlock(&(cpstr)->que_mtx); \ 138 } while (0) 139 140 #define SCTP_MCORE_LOCK_INIT(cpstr) do { \ 141 mtx_init(&(cpstr)->core_mtx, "sctp-cpulck","cpu_proc_lock", \ 142 MTX_DEF | MTX_DUPOK); \ 143 } while (0) 144 145 #define SCTP_MCORE_DESTROY(cpstr) do { \ 146 if (mtx_owned(&(cpstr)->core_mtx)) { \ 147 mtx_unlock(&(cpstr)->core_mtx); \ 148 } \ 149 mtx_destroy(&(cpstr)->core_mtx); \ 150 } while (0) 151 152 #define SCTP_MCORE_LOCK(cpstr) do { \ 153 mtx_lock(&(cpstr)->core_mtx); \ 154 } while (0) 155 156 #define SCTP_MCORE_UNLOCK(cpstr) do { \ 157 mtx_unlock(&(cpstr)->core_mtx); \ 158 } while (0) 159 160 #define SCTP_IPI_ADDR_INIT() do { \ 161 rw_init(&SCTP_BASE_INFO(ipi_addr_mtx), "sctp-addr"); \ 162 } while (0) 163 164 #define SCTP_IPI_ADDR_DESTROY() do { \ 165 if (rw_wowned(&SCTP_BASE_INFO(ipi_addr_mtx))) { \ 166 rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ 167 } \ 168 rw_destroy(&SCTP_BASE_INFO(ipi_addr_mtx)); \ 169 } while (0) 170 171 #define SCTP_IPI_ADDR_RLOCK() do { \ 172 rw_rlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ 173 } while (0) 174 175 #define SCTP_IPI_ADDR_WLOCK() do { \ 176 rw_wlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ 177 } while (0) 178 179 #define SCTP_IPI_ADDR_RUNLOCK() do { \ 180 rw_runlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ 181 } while (0) 182 183 #define SCTP_IPI_ADDR_WUNLOCK() do { \ 184 rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \ 185 } while (0) 186 187 #define SCTP_IPI_ADDR_LOCK_ASSERT() do { \ 188 rw_assert(&SCTP_BASE_INFO(ipi_addr_mtx), RA_LOCKED); \ 189 } while (0) 190 191 #define SCTP_IPI_ADDR_WLOCK_ASSERT() do { \ 192 rw_assert(&SCTP_BASE_INFO(ipi_addr_mtx), RA_WLOCKED); \ 193 } while (0) 194 195 #define SCTP_IPI_ITERATOR_WQ_INIT() do { \ 196 mtx_init(&sctp_it_ctl.ipi_iterator_wq_mtx, "sctp-it-wq", \ 197 "sctp_it_wq", MTX_DEF); \ 198 } while (0) 199 200 #define SCTP_IPI_ITERATOR_WQ_DESTROY() do { \ 201 mtx_destroy(&sctp_it_ctl.ipi_iterator_wq_mtx); \ 202 } while (0) 203 204 #define SCTP_IPI_ITERATOR_WQ_LOCK() do { \ 205 mtx_lock(&sctp_it_ctl.ipi_iterator_wq_mtx); \ 206 } while (0) 207 208 #define SCTP_IPI_ITERATOR_WQ_UNLOCK() do { \ 209 mtx_unlock(&sctp_it_ctl.ipi_iterator_wq_mtx); \ 210 } while (0) 211 212 #define SCTP_IP_PKTLOG_INIT() do { \ 213 mtx_init(&SCTP_BASE_INFO(ipi_pktlog_mtx), "sctp-pktlog", \ 214 "packetlog", MTX_DEF); \ 215 } while (0) 216 217 #define SCTP_IP_PKTLOG_DESTROY() do { \ 218 mtx_destroy(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ 219 } while (0) 220 221 #define SCTP_IP_PKTLOG_LOCK() do { \ 222 mtx_lock(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ 223 } while (0) 224 225 #define SCTP_IP_PKTLOG_UNLOCK() do { \ 226 mtx_unlock(&SCTP_BASE_INFO(ipi_pktlog_mtx)); \ 227 } while (0) 228 229 /* 230 * The INP locks we will use for locking an SCTP endpoint, so for example if 231 * we want to change something at the endpoint level for example random_store 232 * or cookie secrets we lock the INP level. 233 */ 234 235 #define SCTP_INP_READ_LOCK_INIT(_inp) do { \ 236 mtx_init(&(_inp)->inp_rdata_mtx, "sctp-read", "inpr", \ 237 MTX_DEF | MTX_DUPOK); \ 238 } while (0) 239 240 #define SCTP_INP_READ_LOCK_DESTROY(_inp) do { \ 241 mtx_destroy(&(_inp)->inp_rdata_mtx); \ 242 } while (0) 243 244 #define SCTP_INP_READ_LOCK(_inp) do { \ 245 mtx_lock(&(_inp)->inp_rdata_mtx); \ 246 } while (0) 247 248 #define SCTP_INP_READ_UNLOCK(_inp) do { \ 249 mtx_unlock(&(_inp)->inp_rdata_mtx); \ 250 } while (0) 251 252 #define SCTP_INP_READ_LOCK_ASSERT(_inp) do { \ 253 KASSERT(mtx_owned(&(_inp)->inp_rdata_mtx), \ 254 ("Don't own INP read queue lock")); \ 255 } while (0) 256 257 #define SCTP_INP_LOCK_INIT(_inp) do { \ 258 mtx_init(&(_inp)->inp_mtx, "sctp-inp", "inp", \ 259 MTX_DEF | MTX_DUPOK); \ 260 } while (0) 261 262 #define SCTP_INP_LOCK_DESTROY(_inp) do { \ 263 mtx_destroy(&(_inp)->inp_mtx); \ 264 } while (0) 265 266 #define SCTP_INP_LOCK_CONTENDED(_inp) \ 267 ((_inp)->inp_mtx.mtx_lock & MTX_CONTESTED) 268 269 #define SCTP_INP_READ_CONTENDED(_inp) \ 270 ((_inp)->inp_rdata_mtx.mtx_lock & MTX_CONTESTED) 271 272 #ifdef SCTP_LOCK_LOGGING 273 #define SCTP_INP_RLOCK(_inp) do { \ 274 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ 275 sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_INP); \ 276 mtx_lock(&(_inp)->inp_mtx); \ 277 } while (0) 278 279 #define SCTP_INP_WLOCK(_inp) do { \ 280 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ 281 sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_INP); \ 282 mtx_lock(&(_inp)->inp_mtx); \ 283 } while (0) 284 #else 285 #define SCTP_INP_RLOCK(_inp) do { \ 286 mtx_lock(&(_inp)->inp_mtx); \ 287 } while (0) 288 289 #define SCTP_INP_WLOCK(_inp) do { \ 290 mtx_lock(&(_inp)->inp_mtx); \ 291 } while (0) 292 #endif 293 294 #define SCTP_INP_RUNLOCK(_inp) do { \ 295 mtx_unlock(&(_inp)->inp_mtx); \ 296 } while (0) 297 298 #define SCTP_INP_WUNLOCK(_inp) do { \ 299 mtx_unlock(&(_inp)->inp_mtx); \ 300 } while (0) 301 302 #define SCTP_INP_RLOCK_ASSERT(_inp) do { \ 303 KASSERT(mtx_owned(&(_inp)->inp_mtx), \ 304 ("Don't own INP read lock")); \ 305 } while (0) 306 307 #define SCTP_INP_WLOCK_ASSERT(_inp) do { \ 308 KASSERT(mtx_owned(&(_inp)->inp_mtx), \ 309 ("Don't own INP write lock")); \ 310 } while (0) 311 312 #define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1) 313 #define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1) 314 315 #define SCTP_ASOC_CREATE_LOCK_INIT(_inp) do { \ 316 mtx_init(&(_inp)->inp_create_mtx, "sctp-create", "inp_create", \ 317 MTX_DEF | MTX_DUPOK); \ 318 } while (0) 319 320 #define SCTP_ASOC_CREATE_LOCK_DESTROY(_inp) do { \ 321 mtx_destroy(&(_inp)->inp_create_mtx); \ 322 } while (0) 323 324 #ifdef SCTP_LOCK_LOGGING 325 #define SCTP_ASOC_CREATE_LOCK(_inp) do { \ 326 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ 327 sctp_log_lock(_inp, NULL, SCTP_LOG_LOCK_CREATE); \ 328 mtx_lock(&(_inp)->inp_create_mtx); \ 329 } while (0) 330 #else 331 #define SCTP_ASOC_CREATE_LOCK(_inp) do { \ 332 mtx_lock(&(_inp)->inp_create_mtx); \ 333 } while (0) 334 #endif 335 336 #define SCTP_ASOC_CREATE_UNLOCK(_inp) do { \ 337 mtx_unlock(&(_inp)->inp_create_mtx); \ 338 } while (0) 339 340 #define SCTP_ASOC_CREATE_LOCK_CONTENDED(_inp) \ 341 ((_inp)->inp_create_mtx.mtx_lock & MTX_CONTESTED) 342 343 /* 344 * For the majority of things (once we have found the association) we will 345 * lock the actual association mutex. This will protect all the assoiciation 346 * level queues and streams and such. We will need to lock the socket layer 347 * when we stuff data up into the receiving sb_mb. I.e. we will need to do an 348 * extra SOCKBUF_LOCK(&so->so_rcv) even though the association is locked. 349 */ 350 351 #define SCTP_TCB_LOCK_INIT(_tcb) do { \ 352 mtx_init(&(_tcb)->tcb_mtx, "sctp-tcb", "tcb", \ 353 MTX_DEF | MTX_DUPOK); \ 354 } while (0) 355 356 #define SCTP_TCB_LOCK_DESTROY(_tcb) do { \ 357 mtx_destroy(&(_tcb)->tcb_mtx); \ 358 } while (0) 359 360 #ifdef SCTP_LOCK_LOGGING 361 #define SCTP_TCB_LOCK(_tcb) do { \ 362 if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) \ 363 sctp_log_lock(_tcb->sctp_ep, _tcb, SCTP_LOG_LOCK_TCB); \ 364 mtx_lock(&(_tcb)->tcb_mtx); \ 365 } while (0) 366 #else 367 #define SCTP_TCB_LOCK(_tcb) do { \ 368 mtx_lock(&(_tcb)->tcb_mtx); \ 369 } while (0) 370 371 #endif 372 373 #define SCTP_TCB_TRYLOCK(_tcb) \ 374 mtx_trylock(&(_tcb)->tcb_mtx) 375 376 #define SCTP_TCB_UNLOCK(_tcb) do { \ 377 mtx_unlock(&(_tcb)->tcb_mtx); \ 378 } while (0) 379 380 #define SCTP_TCB_UNLOCK_IFOWNED(_tcb) do { \ 381 if (mtx_owned(&(_tcb)->tcb_mtx)) \ 382 mtx_unlock(&(_tcb)->tcb_mtx); \ 383 } while (0) 384 385 #define SCTP_TCB_LOCK_ASSERT(_tcb) do { \ 386 KASSERT(mtx_owned(&(_tcb)->tcb_mtx), \ 387 ("Don't own TCB lock")); \ 388 } while (0) 389 390 #define SCTP_ITERATOR_LOCK_INIT() do { \ 391 mtx_init(&sctp_it_ctl.it_mtx, "sctp-it", "iterator", MTX_DEF); \ 392 } while (0) 393 394 #define SCTP_ITERATOR_LOCK_DESTROY() do { \ 395 mtx_destroy(&sctp_it_ctl.it_mtx); \ 396 } while (0) 397 398 #define SCTP_ITERATOR_LOCK() \ 399 do { \ 400 KASSERT(!mtx_owned(&sctp_it_ctl.it_mtx), \ 401 ("Own the iterator lock")); \ 402 mtx_lock(&sctp_it_ctl.it_mtx); \ 403 } while (0) 404 405 #define SCTP_ITERATOR_UNLOCK() do { \ 406 mtx_unlock(&sctp_it_ctl.it_mtx); \ 407 } while (0) 408 409 #define SCTP_WQ_ADDR_INIT() do { \ 410 mtx_init(&SCTP_BASE_INFO(wq_addr_mtx), \ 411 "sctp-addr-wq","sctp_addr_wq", MTX_DEF); \ 412 } while (0) 413 414 #define SCTP_WQ_ADDR_DESTROY() do { \ 415 if (mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx))) { \ 416 mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ 417 } \ 418 mtx_destroy(&SCTP_BASE_INFO(wq_addr_mtx)); \ 419 } while (0) 420 421 #define SCTP_WQ_ADDR_LOCK() do { \ 422 mtx_lock(&SCTP_BASE_INFO(wq_addr_mtx)); \ 423 } while (0) 424 425 #define SCTP_WQ_ADDR_UNLOCK() do { \ 426 mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \ 427 } while (0) 428 429 #define SCTP_WQ_ADDR_LOCK_ASSERT() do { \ 430 KASSERT(mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx)), \ 431 ("Don't own the ADDR-WQ lock")); \ 432 } while (0) 433 434 #define SCTP_INCR_EP_COUNT() do { \ 435 atomic_add_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ 436 } while (0) 437 438 #define SCTP_DECR_EP_COUNT() do { \ 439 atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \ 440 } while (0) 441 442 #define SCTP_INCR_ASOC_COUNT() do { \ 443 atomic_add_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ 444 } while (0) 445 446 #define SCTP_DECR_ASOC_COUNT() do { \ 447 atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \ 448 } while (0) 449 450 #define SCTP_INCR_LADDR_COUNT() do { \ 451 atomic_add_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ 452 } while (0) 453 454 #define SCTP_DECR_LADDR_COUNT() do { \ 455 atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \ 456 } while (0) 457 458 #define SCTP_INCR_RADDR_COUNT() do { \ 459 atomic_add_int(&SCTP_BASE_INFO(ipi_count_raddr), 1); \ 460 } while (0) 461 462 #define SCTP_DECR_RADDR_COUNT() do { \ 463 atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_raddr),1); \ 464 } while (0) 465 466 #define SCTP_INCR_CHK_COUNT() do { \ 467 atomic_add_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \ 468 } while (0) 469 470 #define SCTP_DECR_CHK_COUNT() do { \ 471 KASSERT(SCTP_BASE_INFO(ipi_count_chunk) > 0, \ 472 ("ipi_count_chunk would become negative")); \ 473 if (SCTP_BASE_INFO(ipi_count_chunk) != 0) \ 474 atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_chunk), \ 475 1); \ 476 } while (0) 477 478 #define SCTP_INCR_READQ_COUNT() do { \ 479 atomic_add_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \ 480 } while (0) 481 482 #define SCTP_DECR_READQ_COUNT() do { \ 483 atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \ 484 } while (0) 485 486 #define SCTP_INCR_STRMOQ_COUNT() do { \ 487 atomic_add_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ 488 } while (0) 489 490 #define SCTP_DECR_STRMOQ_COUNT() do { \ 491 atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \ 492 } while (0) 493 494 #if defined(SCTP_SO_LOCK_TESTING) 495 #define SCTP_INP_SO(sctpinp) \ 496 (sctpinp)->ip_inp.inp.inp_socket 497 #define SCTP_SOCKET_LOCK(so, refcnt) 498 #define SCTP_SOCKET_UNLOCK(so, refcnt) 499 #endif 500 501 #endif 502