1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #include <sys/types.h> 28 #include <sys/systm.h> 29 #include <sys/stream.h> 30 #include <sys/cmn_err.h> 31 #include <sys/kmem.h> 32 #define _SUN_TPI_VERSION 2 33 #include <sys/tihdr.h> 34 #include <sys/stropts.h> 35 #include <sys/strsubr.h> 36 #include <sys/socket.h> 37 #include <sys/tsol/tndb.h> 38 39 #include <netinet/in.h> 40 #include <netinet/ip6.h> 41 42 #include <inet/common.h> 43 #include <inet/ip.h> 44 #include <inet/ip6.h> 45 #include <inet/ipclassifier.h> 46 #include <inet/ipsec_impl.h> 47 48 #include "sctp_impl.h" 49 #include "sctp_addr.h" 50 51 /* 52 * Common accept code. Called by sctp_conn_request. 53 * cr_pkt is the INIT / INIT ACK packet. 54 */ 55 static int 56 sctp_accept_comm(sctp_t *listener, sctp_t *acceptor, mblk_t *cr_pkt, 57 uint_t ip_hdr_len, sctp_init_chunk_t *iack) 58 { 59 60 sctp_hdr_t *sctph; 61 sctp_chunk_hdr_t *ich; 62 sctp_init_chunk_t *init; 63 int err; 64 uint_t sctp_options; 65 conn_t *aconnp; 66 conn_t *lconnp; 67 cred_t *cr; 68 sctp_stack_t *sctps = listener->sctp_sctps; 69 70 sctph = (sctp_hdr_t *)(cr_pkt->b_rptr + ip_hdr_len); 71 ASSERT(OK_32PTR(sctph)); 72 73 acceptor->sctp_lport = listener->sctp_lport; 74 acceptor->sctp_fport = sctph->sh_sport; 75 76 ich = (sctp_chunk_hdr_t *)(iack + 1); 77 init = (sctp_init_chunk_t *)(ich + 1); 78 79 /* acceptor isn't in any fanouts yet, so don't need to hold locks */ 80 ASSERT(acceptor->sctp_faddrs == NULL); 81 err = sctp_get_addrparams(acceptor, listener, cr_pkt, ich, 82 &sctp_options); 83 if (err != 0) 84 return (err); 85 86 aconnp = acceptor->sctp_connp; 87 lconnp = listener->sctp_connp; 88 if (lconnp->conn_mlp_type != mlptSingle) { 89 cr = aconnp->conn_peercred = DB_CRED(cr_pkt); 90 if (cr != NULL) 91 crhold(cr); 92 } 93 94 if ((err = sctp_set_hdraddrs(acceptor)) != 0) 95 return (err); 96 97 if ((sctp_options & SCTP_PRSCTP_OPTION) && 98 listener->sctp_prsctp_aware && sctps->sctps_prsctp_enabled) { 99 acceptor->sctp_prsctp_aware = B_TRUE; 100 } else { 101 acceptor->sctp_prsctp_aware = B_FALSE; 102 } 103 /* The new sctp_t is fully bound now. */ 104 acceptor->sctp_connp->conn_fully_bound = B_TRUE; 105 106 /* Get initial TSNs */ 107 acceptor->sctp_ltsn = ntohl(iack->sic_inittsn); 108 acceptor->sctp_recovery_tsn = acceptor->sctp_lastack_rxd = 109 acceptor->sctp_ltsn - 1; 110 acceptor->sctp_adv_pap = acceptor->sctp_lastack_rxd; 111 /* Serial numbers are initialized to the same value as the TSNs */ 112 acceptor->sctp_lcsn = acceptor->sctp_ltsn; 113 114 if (!sctp_initialize_params(acceptor, init, iack)) 115 return (ENOMEM); 116 117 /* 118 * Copy sctp_secret from the listener in case we need to validate 119 * a possibly delayed cookie. 120 */ 121 bcopy(listener->sctp_secret, acceptor->sctp_secret, SCTP_SECRET_LEN); 122 bcopy(listener->sctp_old_secret, acceptor->sctp_old_secret, 123 SCTP_SECRET_LEN); 124 acceptor->sctp_last_secret_update = lbolt64; 125 126 /* 127 * After acceptor is inserted in the hash list, it can be found. 128 * So we need to lock it here. 129 */ 130 RUN_SCTP(acceptor); 131 132 sctp_conn_hash_insert(&sctps->sctps_conn_fanout[ 133 SCTP_CONN_HASH(sctps, acceptor->sctp_ports)], acceptor, 0); 134 sctp_bind_hash_insert(&sctps->sctps_bind_fanout[ 135 SCTP_BIND_HASH(ntohs(acceptor->sctp_lport))], acceptor, 0); 136 137 /* 138 * No need to check for multicast destination since ip will only pass 139 * up multicasts to those that have expressed interest 140 * TODO: what about rejecting broadcasts? 141 * Also check that source is not a multicast or broadcast address. 142 */ 143 /* XXXSCTP */ 144 acceptor->sctp_state = SCTPS_ESTABLISHED; 145 acceptor->sctp_assoc_start_time = (uint32_t)lbolt; 146 /* 147 * listener->sctp_rwnd should be the default window size or a 148 * window size changed via SO_RCVBUF option. 149 */ 150 acceptor->sctp_rwnd = listener->sctp_rwnd; 151 acceptor->sctp_irwnd = acceptor->sctp_rwnd; 152 acceptor->sctp_pd_point = acceptor->sctp_rwnd; 153 acceptor->sctp_upcalls = listener->sctp_upcalls; 154 #if 0 155 bcopy(&listener->sctp_upcalls, &acceptor->sctp_upcalls, 156 sizeof (sctp_upcalls_t)); 157 #endif 158 159 return (0); 160 } 161 162 /* Process the COOKIE packet, mp, directed at the listener 'sctp' */ 163 sctp_t * 164 sctp_conn_request(sctp_t *sctp, mblk_t *mp, uint_t ifindex, uint_t ip_hdr_len, 165 sctp_init_chunk_t *iack, mblk_t *ipsec_mp) 166 { 167 sctp_t *eager; 168 uint_t ipvers; 169 ip6_t *ip6h; 170 int err; 171 conn_t *connp, *econnp; 172 sctp_stack_t *sctps; 173 struct sock_proto_props sopp; 174 175 /* 176 * No need to check for duplicate as this is the listener 177 * and we are holding the lock. This means that no new 178 * connection can be created out of it. And since the 179 * fanout already done cannot find a match, it means that 180 * there is no duplicate. 181 */ 182 ipvers = IPH_HDR_VERSION(mp->b_rptr); 183 ASSERT(ipvers == IPV6_VERSION || ipvers == IPV4_VERSION); 184 ASSERT(OK_32PTR(mp->b_rptr)); 185 186 if ((eager = sctp_create_eager(sctp)) == NULL) { 187 return (NULL); 188 } 189 190 if (ipvers != IPV4_VERSION) { 191 ip6h = (ip6_t *)mp->b_rptr; 192 if (IN6_IS_ADDR_LINKLOCAL(&ip6h->ip6_src)) 193 eager->sctp_linklocal = 1; 194 /* 195 * Record ifindex (might be zero) to tie this connection to 196 * that interface if either the listener was bound or 197 * if the connection is using link-local addresses. 198 */ 199 if (sctp->sctp_bound_if == ifindex || 200 IN6_IS_ADDR_LINKLOCAL(&ip6h->ip6_src)) 201 eager->sctp_bound_if = ifindex; 202 /* 203 * XXX broken. bound_if is always overwritten by statement 204 * below. What is the right thing to do here? 205 */ 206 eager->sctp_bound_if = sctp->sctp_bound_if; 207 } 208 209 connp = sctp->sctp_connp; 210 sctps = sctp->sctp_sctps; 211 econnp = eager->sctp_connp; 212 213 if (connp->conn_policy != NULL) { 214 ipsec_in_t *ii; 215 216 ASSERT(ipsec_mp != NULL); 217 ii = (ipsec_in_t *)(ipsec_mp->b_rptr); 218 ASSERT(ii->ipsec_in_policy == NULL); 219 IPPH_REFHOLD(connp->conn_policy); 220 ii->ipsec_in_policy = connp->conn_policy; 221 222 ipsec_mp->b_datap->db_type = IPSEC_POLICY_SET; 223 if (!ip_bind_ipsec_policy_set(econnp, ipsec_mp)) { 224 sctp_close_eager(eager); 225 BUMP_MIB(&sctps->sctps_mib, sctpListenDrop); 226 return (NULL); 227 } 228 } 229 230 if (ipsec_mp != NULL) { 231 /* 232 * XXX need to fix the cached policy issue here. 233 * We temporarily set the conn_src/conn_rem here so 234 * that IPsec can use it for the latched policy 235 * selector. This is obvioursly wrong as SCTP can 236 * use different addresses... 237 */ 238 if (ipvers == IPV4_VERSION) { 239 ipha_t *ipha; 240 241 ipha = (ipha_t *)mp->b_rptr; 242 econnp->conn_src = ipha->ipha_dst; 243 econnp->conn_rem = ipha->ipha_src; 244 } else { 245 econnp->conn_srcv6 = ip6h->ip6_dst; 246 econnp->conn_remv6 = ip6h->ip6_src; 247 } 248 } 249 if (ipsec_conn_cache_policy(econnp, ipvers == IPV4_VERSION) != 0) { 250 sctp_close_eager(eager); 251 BUMP_MIB(&sctps->sctps_mib, sctpListenDrop); 252 return (NULL); 253 } 254 255 err = sctp_accept_comm(sctp, eager, mp, ip_hdr_len, iack); 256 if (err) { 257 sctp_close_eager(eager); 258 BUMP_MIB(&sctps->sctps_mib, sctpListenDrop); 259 return (NULL); 260 } 261 262 /* 263 * On a clustered note send this notification to the clustering 264 * subsystem. 265 */ 266 if (cl_sctp_connect != NULL) { 267 uchar_t *slist; 268 uchar_t *flist; 269 size_t fsize; 270 size_t ssize; 271 272 fsize = sizeof (in6_addr_t) * eager->sctp_nfaddrs; 273 ssize = sizeof (in6_addr_t) * eager->sctp_nsaddrs; 274 slist = kmem_alloc(ssize, KM_NOSLEEP); 275 flist = kmem_alloc(fsize, KM_NOSLEEP); 276 if (slist == NULL || flist == NULL) { 277 if (slist != NULL) 278 kmem_free(slist, ssize); 279 if (flist != NULL) 280 kmem_free(flist, fsize); 281 sctp_close_eager(eager); 282 BUMP_MIB(&sctps->sctps_mib, sctpListenDrop); 283 SCTP_KSTAT(sctps, sctp_cl_connect); 284 return (NULL); 285 } 286 /* The clustering module frees these list */ 287 sctp_get_saddr_list(eager, slist, ssize); 288 sctp_get_faddr_list(eager, flist, fsize); 289 (*cl_sctp_connect)(eager->sctp_family, slist, 290 eager->sctp_nsaddrs, eager->sctp_lport, flist, 291 eager->sctp_nfaddrs, eager->sctp_fport, B_FALSE, 292 (cl_sctp_handle_t)eager); 293 } 294 295 /* Connection established, so send up the conn_ind */ 296 if ((eager->sctp_ulpd = sctp->sctp_ulp_newconn(sctp->sctp_ulpd, 297 (sock_lower_handle_t)eager, NULL, NULL, 0, 298 &eager->sctp_upcalls)) == NULL) { 299 sctp_close_eager(eager); 300 BUMP_MIB(&sctps->sctps_mib, sctpListenDrop); 301 return (NULL); 302 } 303 ASSERT(SCTP_IS_DETACHED(eager)); 304 eager->sctp_detached = B_FALSE; 305 bzero(&sopp, sizeof (sopp)); 306 sopp.sopp_flags = SOCKOPT_MAXBLK|SOCKOPT_WROFF; 307 sopp.sopp_maxblk = strmsgsz; 308 if (eager->sctp_family == AF_INET) { 309 sopp.sopp_wroff = sctps->sctps_wroff_xtra + 310 sizeof (sctp_data_hdr_t) + sctp->sctp_hdr_len; 311 } else { 312 sopp.sopp_wroff = sctps->sctps_wroff_xtra + 313 sizeof (sctp_data_hdr_t) + sctp->sctp_hdr6_len; 314 } 315 eager->sctp_ulp_prop(eager->sctp_ulpd, &sopp); 316 return (eager); 317 } 318 319 /* 320 * Connect to a peer - this function inserts the sctp in the 321 * bind and conn fanouts, sends the INIT, and replies to the client 322 * with an OK ack. 323 */ 324 int 325 sctp_connect(sctp_t *sctp, const struct sockaddr *dst, uint32_t addrlen) 326 { 327 sin_t *sin; 328 sin6_t *sin6; 329 in6_addr_t dstaddr; 330 in_port_t dstport; 331 mblk_t *initmp; 332 sctp_tf_t *tbf; 333 sctp_t *lsctp; 334 char buf[INET6_ADDRSTRLEN]; 335 int sleep = sctp->sctp_cansleep ? KM_SLEEP : KM_NOSLEEP; 336 int hdrlen; 337 ip6_rthdr_t *rth; 338 int err; 339 sctp_faddr_t *cur_fp; 340 sctp_stack_t *sctps = sctp->sctp_sctps; 341 struct sock_proto_props sopp; 342 343 /* 344 * Determine packet type based on type of address passed in 345 * the request should contain an IPv4 or IPv6 address. 346 * Make sure that address family matches the type of 347 * family of the the address passed down 348 */ 349 if (addrlen < sizeof (sin_t)) { 350 return (EINVAL); 351 } 352 switch (dst->sa_family) { 353 case AF_INET: 354 sin = (sin_t *)dst; 355 356 /* Check for attempt to connect to non-unicast */ 357 if (CLASSD(sin->sin_addr.s_addr) || 358 (sin->sin_addr.s_addr == INADDR_BROADCAST)) { 359 ip0dbg(("sctp_connect: non-unicast\n")); 360 return (EINVAL); 361 } 362 if (sctp->sctp_connp->conn_ipv6_v6only) 363 return (EAFNOSUPPORT); 364 365 /* convert to v6 mapped */ 366 /* Check for attempt to connect to INADDR_ANY */ 367 if (sin->sin_addr.s_addr == INADDR_ANY) { 368 struct in_addr v4_addr; 369 /* 370 * SunOS 4.x and 4.3 BSD allow an application 371 * to connect a TCP socket to INADDR_ANY. 372 * When they do this, the kernel picks the 373 * address of one interface and uses it 374 * instead. The kernel usually ends up 375 * picking the address of the loopback 376 * interface. This is an undocumented feature. 377 * However, we provide the same thing here 378 * in case any TCP apps that use this feature 379 * are being ported to SCTP... 380 */ 381 v4_addr.s_addr = htonl(INADDR_LOOPBACK); 382 IN6_INADDR_TO_V4MAPPED(&v4_addr, &dstaddr); 383 } else { 384 IN6_INADDR_TO_V4MAPPED(&sin->sin_addr, &dstaddr); 385 } 386 dstport = sin->sin_port; 387 if (sin->sin_family == AF_INET) { 388 hdrlen = sctp->sctp_hdr_len; 389 } else { 390 hdrlen = sctp->sctp_hdr6_len; 391 } 392 break; 393 case AF_INET6: 394 sin6 = (sin6_t *)dst; 395 /* Check for attempt to connect to non-unicast. */ 396 if ((addrlen < sizeof (sin6_t)) || 397 IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { 398 ip0dbg(("sctp_connect: non-unicast\n")); 399 return (EINVAL); 400 } 401 if (sctp->sctp_connp->conn_ipv6_v6only && 402 IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { 403 return (EAFNOSUPPORT); 404 } 405 /* check for attempt to connect to unspec */ 406 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { 407 dstaddr = ipv6_loopback; 408 } else { 409 dstaddr = sin6->sin6_addr; 410 if (IN6_IS_ADDR_LINKLOCAL(&dstaddr)) 411 sctp->sctp_linklocal = 1; 412 } 413 dstport = sin6->sin6_port; 414 hdrlen = sctp->sctp_hdr6_len; 415 break; 416 default: 417 dprint(1, ("sctp_connect: unknown family %d\n", 418 dst->sa_family)); 419 return (EAFNOSUPPORT); 420 } 421 422 (void) inet_ntop(AF_INET6, &dstaddr, buf, sizeof (buf)); 423 dprint(1, ("sctp_connect: attempting connect to %s...\n", buf)); 424 425 RUN_SCTP(sctp); 426 427 if (sctp->sctp_family != dst->sa_family || 428 (sctp->sctp_connp->conn_state_flags & CONN_CLOSING)) { 429 WAKE_SCTP(sctp); 430 return (EINVAL); 431 } 432 433 switch (sctp->sctp_state) { 434 case SCTPS_IDLE: { 435 struct sockaddr_storage ss; 436 437 /* 438 * We support a quick connect capability here, allowing 439 * clients to transition directly from IDLE to COOKIE_WAIT. 440 * sctp_bindi will pick an unused port, insert the connection 441 * in the bind hash and transition to BOUND state. SCTP 442 * picks and uses what it considers the optimal local address 443 * set (just like specifiying INADDR_ANY to bind()). 444 */ 445 dprint(1, ("sctp_connect: idle, attempting bind...\n")); 446 ASSERT(sctp->sctp_nsaddrs == 0); 447 448 bzero(&ss, sizeof (ss)); 449 ss.ss_family = sctp->sctp_family; 450 WAKE_SCTP(sctp); 451 if ((err = sctp_bind(sctp, (struct sockaddr *)&ss, 452 sizeof (ss))) != 0) { 453 return (err); 454 } 455 RUN_SCTP(sctp); 456 /* FALLTHRU */ 457 } 458 459 case SCTPS_BOUND: 460 ASSERT(sctp->sctp_nsaddrs > 0); 461 462 /* do the connect */ 463 /* XXX check for attempt to connect to self */ 464 sctp->sctp_fport = dstport; 465 466 ASSERT(sctp->sctp_iphc); 467 ASSERT(sctp->sctp_iphc6); 468 469 /* 470 * Don't allow this connection to completely duplicate 471 * an existing connection. 472 * 473 * Ensure that the duplicate check and insertion is atomic. 474 */ 475 sctp_conn_hash_remove(sctp); 476 tbf = &sctps->sctps_conn_fanout[SCTP_CONN_HASH(sctps, 477 sctp->sctp_ports)]; 478 mutex_enter(&tbf->tf_lock); 479 lsctp = sctp_lookup(sctp, &dstaddr, tbf, &sctp->sctp_ports, 480 SCTPS_COOKIE_WAIT); 481 if (lsctp != NULL) { 482 /* found a duplicate connection */ 483 mutex_exit(&tbf->tf_lock); 484 SCTP_REFRELE(lsctp); 485 WAKE_SCTP(sctp); 486 return (EADDRINUSE); 487 } 488 /* 489 * OK; set up the peer addr (this may grow after we get 490 * the INIT ACK from the peer with additional addresses). 491 */ 492 if ((err = sctp_add_faddr(sctp, &dstaddr, sleep, 493 B_FALSE)) != 0) { 494 mutex_exit(&tbf->tf_lock); 495 WAKE_SCTP(sctp); 496 return (err); 497 } 498 cur_fp = sctp->sctp_faddrs; 499 500 /* No valid src addr, return. */ 501 if (cur_fp->state == SCTP_FADDRS_UNREACH) { 502 mutex_exit(&tbf->tf_lock); 503 WAKE_SCTP(sctp); 504 return (EADDRNOTAVAIL); 505 } 506 507 sctp->sctp_primary = cur_fp; 508 sctp->sctp_current = cur_fp; 509 sctp->sctp_mss = cur_fp->sfa_pmss; 510 sctp_conn_hash_insert(tbf, sctp, 1); 511 mutex_exit(&tbf->tf_lock); 512 513 /* initialize composite headers */ 514 if ((err = sctp_set_hdraddrs(sctp)) != 0) { 515 sctp_conn_hash_remove(sctp); 516 WAKE_SCTP(sctp); 517 return (err); 518 } 519 520 /* 521 * Massage a routing header (if present) putting the first hop 522 * in ip6_dst. 523 */ 524 rth = ip_find_rthdr_v6(sctp->sctp_ip6h, 525 (uint8_t *)sctp->sctp_sctph6); 526 if (rth != NULL) { 527 (void) ip_massage_options_v6(sctp->sctp_ip6h, rth, 528 sctps->sctps_netstack); 529 } 530 531 /* 532 * Turn off the don't fragment bit on the (only) faddr, 533 * so that if one of the messages exchanged during the 534 * initialization sequence exceeds the path mtu, it 535 * at least has a chance to get there. SCTP does no 536 * fragmentation of initialization messages. The DF bit 537 * will be turned on again in sctp_send_cookie_echo() 538 * (but the cookie echo will still be sent with the df bit 539 * off). 540 */ 541 cur_fp->df = B_FALSE; 542 543 /* Mark this address as alive */ 544 cur_fp->state = SCTP_FADDRS_ALIVE; 545 546 /* This sctp_t is fully bound now. */ 547 sctp->sctp_connp->conn_fully_bound = B_TRUE; 548 549 /* Send the INIT to the peer */ 550 SCTP_FADDR_TIMER_RESTART(sctp, cur_fp, cur_fp->rto); 551 sctp->sctp_state = SCTPS_COOKIE_WAIT; 552 /* 553 * sctp_init_mp() could result in modifying the source 554 * address list, so take the hash lock. 555 */ 556 mutex_enter(&tbf->tf_lock); 557 initmp = sctp_init_mp(sctp); 558 if (initmp == NULL) { 559 mutex_exit(&tbf->tf_lock); 560 /* 561 * It may happen that all the source addresses 562 * (loopback/link local) are removed. In that case, 563 * faile the connect. 564 */ 565 if (sctp->sctp_nsaddrs == 0) { 566 sctp_conn_hash_remove(sctp); 567 SCTP_FADDR_TIMER_STOP(cur_fp); 568 WAKE_SCTP(sctp); 569 return (EADDRNOTAVAIL); 570 } 571 572 /* Otherwise, let the retransmission timer retry */ 573 WAKE_SCTP(sctp); 574 goto notify_ulp; 575 } 576 mutex_exit(&tbf->tf_lock); 577 578 /* 579 * On a clustered note send this notification to the clustering 580 * subsystem. 581 */ 582 if (cl_sctp_connect != NULL) { 583 uchar_t *slist; 584 uchar_t *flist; 585 size_t ssize; 586 size_t fsize; 587 588 fsize = sizeof (in6_addr_t) * sctp->sctp_nfaddrs; 589 ssize = sizeof (in6_addr_t) * sctp->sctp_nsaddrs; 590 slist = kmem_alloc(ssize, KM_SLEEP); 591 flist = kmem_alloc(fsize, KM_SLEEP); 592 /* The clustering module frees the lists */ 593 sctp_get_saddr_list(sctp, slist, ssize); 594 sctp_get_faddr_list(sctp, flist, fsize); 595 (*cl_sctp_connect)(sctp->sctp_family, slist, 596 sctp->sctp_nsaddrs, sctp->sctp_lport, 597 flist, sctp->sctp_nfaddrs, sctp->sctp_fport, 598 B_TRUE, (cl_sctp_handle_t)sctp); 599 } 600 WAKE_SCTP(sctp); 601 /* OK to call IP_PUT() here instead of sctp_add_sendq(). */ 602 CONN_INC_REF(sctp->sctp_connp); 603 initmp->b_flag |= MSGHASREF; 604 IP_PUT(initmp, sctp->sctp_connp, sctp->sctp_current->isv4); 605 BUMP_LOCAL(sctp->sctp_opkts); 606 607 notify_ulp: 608 bzero(&sopp, sizeof (sopp)); 609 sopp.sopp_flags = SOCKOPT_WROFF; 610 sopp.sopp_wroff = sctps->sctps_wroff_xtra + hdrlen + 611 sizeof (sctp_data_hdr_t); 612 sctp->sctp_ulp_prop(sctp->sctp_ulpd, &sopp); 613 614 return (0); 615 default: 616 ip0dbg(("sctp_connect: invalid state. %d\n", sctp->sctp_state)); 617 WAKE_SCTP(sctp); 618 return (EINVAL); 619 } 620 } 621