10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*252Svi117747 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/types.h> 300Sstevel@tonic-gate #include <sys/systm.h> 310Sstevel@tonic-gate #include <sys/stream.h> 320Sstevel@tonic-gate #include <sys/cmn_err.h> 330Sstevel@tonic-gate #include <sys/socket.h> 340Sstevel@tonic-gate #include <sys/kmem.h> 350Sstevel@tonic-gate #include <sys/strsubr.h> 360Sstevel@tonic-gate #include <sys/strsun.h> 370Sstevel@tonic-gate 380Sstevel@tonic-gate #include <netinet/in.h> 390Sstevel@tonic-gate #include <netinet/ip6.h> 400Sstevel@tonic-gate #include <netinet/sctp.h> 410Sstevel@tonic-gate 420Sstevel@tonic-gate #include <inet/common.h> 430Sstevel@tonic-gate #include <inet/ip.h> 440Sstevel@tonic-gate #include <inet/ip6.h> 450Sstevel@tonic-gate #include <inet/mib2.h> 460Sstevel@tonic-gate #include "sctp_impl.h" 470Sstevel@tonic-gate #include "sctp_asconf.h" 480Sstevel@tonic-gate #include "sctp_addr.h" 490Sstevel@tonic-gate 500Sstevel@tonic-gate typedef struct sctp_asconf_s { 510Sstevel@tonic-gate mblk_t *head; 520Sstevel@tonic-gate uint32_t cid; 530Sstevel@tonic-gate } sctp_asconf_t; 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* 560Sstevel@tonic-gate * The ASCONF chunk per-parameter request interface. ph is the 570Sstevel@tonic-gate * parameter header for the parameter in the request, and cid 580Sstevel@tonic-gate * is the parameters correlation ID. cont should be set to 1 590Sstevel@tonic-gate * if the ASCONF framework should continue processing request 600Sstevel@tonic-gate * parameters following this one, or 0 if it should stop. If 610Sstevel@tonic-gate * cont is -1, this indicates complete memory depletion, which 620Sstevel@tonic-gate * will cause the ASCONF framework to abort building a reply. If 630Sstevel@tonic-gate * act is 1, the callback should take whatever action it needs 640Sstevel@tonic-gate * to fulfil this request. If act is 0, this request has already 650Sstevel@tonic-gate * been processed, so the callback should only verify and pass 660Sstevel@tonic-gate * back error parameters, and not take any action. 670Sstevel@tonic-gate * 680Sstevel@tonic-gate * The callback should return an mblk with any reply enclosed, 690Sstevel@tonic-gate * with the correlation ID in the first four bytes of the 700Sstevel@tonic-gate * message. A NULL return implies implicit success to the 710Sstevel@tonic-gate * requestor. 720Sstevel@tonic-gate */ 730Sstevel@tonic-gate typedef mblk_t *sctp_asconf_func_t(sctp_t *, sctp_parm_hdr_t *ph, uint32_t cid, 740Sstevel@tonic-gate sctp_faddr_t *, int *cont, int act); 750Sstevel@tonic-gate 760Sstevel@tonic-gate /* 770Sstevel@tonic-gate * The ASCONF chunk per-parameter ACK interface. ph is the parameter 780Sstevel@tonic-gate * header for the parameter returned in the ACK, and oph is the 790Sstevel@tonic-gate * original parameter sent out in the ASCONF request. 800Sstevel@tonic-gate * If the peer implicitly responded OK (by not including an 810Sstevel@tonic-gate * explicit OK for the request), ph will be NULL. 820Sstevel@tonic-gate * ph can also point to an Unrecognized Parameter parameter, 830Sstevel@tonic-gate * in which case the peer did not understand the request 840Sstevel@tonic-gate * parameter. 850Sstevel@tonic-gate * 860Sstevel@tonic-gate * ph and oph parameter headers are in host byte order. Encapsulated 870Sstevel@tonic-gate * parameters will still be in network byte order. 880Sstevel@tonic-gate */ 890Sstevel@tonic-gate typedef void sctp_asconf_ack_func_t(sctp_t *, sctp_parm_hdr_t *ph, 900Sstevel@tonic-gate sctp_parm_hdr_t *oph, sctp_faddr_t *); 910Sstevel@tonic-gate 920Sstevel@tonic-gate typedef struct { 930Sstevel@tonic-gate uint16_t id; 940Sstevel@tonic-gate sctp_asconf_func_t *asconf; 950Sstevel@tonic-gate sctp_asconf_ack_func_t *asconf_ack; 960Sstevel@tonic-gate } dispatch_t; 970Sstevel@tonic-gate 980Sstevel@tonic-gate static sctp_asconf_func_t sctp_addip_req, sctp_setprim_req, 990Sstevel@tonic-gate sctp_asconf_unrec_parm; 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate static sctp_asconf_ack_func_t sctp_addip_ack, sctp_setprim_ack, 1020Sstevel@tonic-gate sctp_asconf_ack_unrec_parm; 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate static const dispatch_t sctp_asconf_dispatch_tbl[] = { 1050Sstevel@tonic-gate /* ID ASCONF ASCONF_ACK */ 1060Sstevel@tonic-gate { PARM_ADD_IP, sctp_addip_req, sctp_addip_ack }, 1070Sstevel@tonic-gate { PARM_DEL_IP, sctp_addip_req, sctp_addip_ack }, 1080Sstevel@tonic-gate { PARM_SET_PRIMARY, sctp_setprim_req, sctp_setprim_ack } 1090Sstevel@tonic-gate }; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate static const dispatch_t sctp_asconf_default_dispatch = { 1120Sstevel@tonic-gate 0, sctp_asconf_unrec_parm, sctp_asconf_ack_unrec_parm 1130Sstevel@tonic-gate }; 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate /* 1160Sstevel@tonic-gate * ASCONF framework 1170Sstevel@tonic-gate */ 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate static const dispatch_t * 1200Sstevel@tonic-gate sctp_lookup_asconf_dispatch(int id) 1210Sstevel@tonic-gate { 1220Sstevel@tonic-gate int i; 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate for (i = 0; i < A_CNT(sctp_asconf_dispatch_tbl); i++) { 1250Sstevel@tonic-gate if (sctp_asconf_dispatch_tbl[i].id == id) { 1260Sstevel@tonic-gate return (sctp_asconf_dispatch_tbl + i); 1270Sstevel@tonic-gate } 1280Sstevel@tonic-gate } 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate return (&sctp_asconf_default_dispatch); 1310Sstevel@tonic-gate } 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate /* 1340Sstevel@tonic-gate * Frees mp on failure 1350Sstevel@tonic-gate */ 1360Sstevel@tonic-gate static mblk_t * 1370Sstevel@tonic-gate sctp_asconf_prepend_errwrap(mblk_t *mp, uint32_t cid) 1380Sstevel@tonic-gate { 1390Sstevel@tonic-gate mblk_t *wmp; 1400Sstevel@tonic-gate sctp_parm_hdr_t *wph; 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* Prepend a wrapper err cause ind param */ 1430Sstevel@tonic-gate wmp = allocb(sizeof (*wph) + sizeof (cid), BPRI_MED); 1440Sstevel@tonic-gate if (wmp == NULL) { 1450Sstevel@tonic-gate freemsg(mp); 1460Sstevel@tonic-gate return (NULL); 1470Sstevel@tonic-gate } 1480Sstevel@tonic-gate wmp->b_wptr += sizeof (*wph) + sizeof (cid); 1490Sstevel@tonic-gate wph = (sctp_parm_hdr_t *)wmp->b_rptr; 1500Sstevel@tonic-gate wph->sph_type = htons(PARM_ERROR_IND); 1510Sstevel@tonic-gate wph->sph_len = htons(msgdsize(mp) + sizeof (*wph) + sizeof (cid)); 1520Sstevel@tonic-gate bcopy(&cid, wph + 1, sizeof (uint32_t)); 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate wmp->b_cont = mp; 1550Sstevel@tonic-gate return (wmp); 1560Sstevel@tonic-gate } 1570Sstevel@tonic-gate 1580Sstevel@tonic-gate /*ARGSUSED*/ 1590Sstevel@tonic-gate static mblk_t * 1600Sstevel@tonic-gate sctp_asconf_unrec_parm(sctp_t *sctp, sctp_parm_hdr_t *ph, uint32_t cid, 1610Sstevel@tonic-gate sctp_faddr_t *fp, int *cont, int act) 1620Sstevel@tonic-gate { 1630Sstevel@tonic-gate mblk_t *mp = NULL; 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate /* Unrecognized param; check the high order bits */ 1660Sstevel@tonic-gate if ((ph->sph_type & 0xc000) == 0xc000) { 1670Sstevel@tonic-gate /* report unrecognized param, and keep processing */ 1680Sstevel@tonic-gate sctp_add_unrec_parm(ph, &mp); 1690Sstevel@tonic-gate if (mp == NULL) { 1700Sstevel@tonic-gate *cont = -1; 1710Sstevel@tonic-gate return (NULL); 1720Sstevel@tonic-gate } 1730Sstevel@tonic-gate /* Prepend a the CID and a wrapper err cause ind param */ 1740Sstevel@tonic-gate mp = sctp_asconf_prepend_errwrap(mp, cid); 1750Sstevel@tonic-gate if (mp == NULL) { 1760Sstevel@tonic-gate *cont = -1; 1770Sstevel@tonic-gate return (NULL); 1780Sstevel@tonic-gate } 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate *cont = 1; 1810Sstevel@tonic-gate return (mp); 1820Sstevel@tonic-gate } 1830Sstevel@tonic-gate if (ph->sph_type & 0x4000) { 1840Sstevel@tonic-gate /* Stop processing and drop; report unrecognized param */ 1850Sstevel@tonic-gate sctp_add_unrec_parm(ph, &mp); 1860Sstevel@tonic-gate if (mp == NULL) { 1870Sstevel@tonic-gate *cont = -1; 1880Sstevel@tonic-gate return (NULL); 1890Sstevel@tonic-gate } 1900Sstevel@tonic-gate /* Prepend a the CID and a wrapper err cause ind param */ 1910Sstevel@tonic-gate mp = sctp_asconf_prepend_errwrap(mp, cid); 1920Sstevel@tonic-gate if (mp == NULL) { 1930Sstevel@tonic-gate *cont = -1; 1940Sstevel@tonic-gate return (NULL); 1950Sstevel@tonic-gate } 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate *cont = 0; 1980Sstevel@tonic-gate return (mp); 1990Sstevel@tonic-gate } 2000Sstevel@tonic-gate if (ph->sph_type & 0x8000) { 2010Sstevel@tonic-gate /* skip and continue processing */ 2020Sstevel@tonic-gate *cont = 1; 2030Sstevel@tonic-gate return (NULL); 2040Sstevel@tonic-gate } 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate /* 2 high bits are clear; stop processing and drop packet */ 2070Sstevel@tonic-gate *cont = 0; 2080Sstevel@tonic-gate return (NULL); 2090Sstevel@tonic-gate } 2100Sstevel@tonic-gate 2110Sstevel@tonic-gate /*ARGSUSED*/ 2120Sstevel@tonic-gate static void 2130Sstevel@tonic-gate sctp_asconf_ack_unrec_parm(sctp_t *sctp, sctp_parm_hdr_t *ph, 2140Sstevel@tonic-gate sctp_parm_hdr_t *oph, sctp_faddr_t *fp) 2150Sstevel@tonic-gate { 2160Sstevel@tonic-gate ASSERT(ph); 2170Sstevel@tonic-gate sctp_error_event(sctp, (sctp_chunk_hdr_t *)ph); 2180Sstevel@tonic-gate } 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate static void 2210Sstevel@tonic-gate sctp_asconf_init(sctp_asconf_t *asc) 2220Sstevel@tonic-gate { 2230Sstevel@tonic-gate ASSERT(asc != NULL); 2240Sstevel@tonic-gate 2250Sstevel@tonic-gate asc->head = NULL; 2260Sstevel@tonic-gate asc->cid = 0; 2270Sstevel@tonic-gate } 2280Sstevel@tonic-gate 2290Sstevel@tonic-gate static int 2300Sstevel@tonic-gate sctp_asconf_add(sctp_asconf_t *asc, mblk_t *mp) 2310Sstevel@tonic-gate { 2320Sstevel@tonic-gate uint32_t *cp; 2330Sstevel@tonic-gate 2340Sstevel@tonic-gate /* XXX can't exceed MTU */ 2350Sstevel@tonic-gate 2360Sstevel@tonic-gate cp = (uint32_t *)(mp->b_rptr + sizeof (sctp_parm_hdr_t)); 2370Sstevel@tonic-gate *cp = asc->cid++; 2380Sstevel@tonic-gate 2390Sstevel@tonic-gate if (asc->head == NULL) 2400Sstevel@tonic-gate asc->head = mp; 2410Sstevel@tonic-gate else 2420Sstevel@tonic-gate linkb(asc->head, mp); 2430Sstevel@tonic-gate 2440Sstevel@tonic-gate return (0); 2450Sstevel@tonic-gate } 2460Sstevel@tonic-gate 2470Sstevel@tonic-gate static void 2480Sstevel@tonic-gate sctp_asconf_destroy(sctp_asconf_t *asc) 2490Sstevel@tonic-gate { 2500Sstevel@tonic-gate if (asc->head != NULL) { 2510Sstevel@tonic-gate freemsg(asc->head); 2520Sstevel@tonic-gate asc->head = NULL; 2530Sstevel@tonic-gate } 2540Sstevel@tonic-gate asc->cid = 0; 2550Sstevel@tonic-gate } 2560Sstevel@tonic-gate 2570Sstevel@tonic-gate static int 2580Sstevel@tonic-gate sctp_asconf_send(sctp_t *sctp, sctp_asconf_t *asc, sctp_faddr_t *fp) 2590Sstevel@tonic-gate { 2600Sstevel@tonic-gate mblk_t *mp, *nmp; 2610Sstevel@tonic-gate sctp_chunk_hdr_t *ch; 2620Sstevel@tonic-gate boolean_t isv4; 2630Sstevel@tonic-gate size_t msgsize; 2640Sstevel@tonic-gate 2650Sstevel@tonic-gate ASSERT(asc != NULL && asc->head != NULL); 2660Sstevel@tonic-gate 2670Sstevel@tonic-gate isv4 = (fp != NULL) ? fp->isv4 : sctp->sctp_current->isv4; 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate /* SCTP chunk header + Serial Number + Address Param TLV */ 2700Sstevel@tonic-gate msgsize = sizeof (*ch) + sizeof (uint32_t) + 2710Sstevel@tonic-gate (isv4 ? PARM_ADDR4_LEN : PARM_ADDR6_LEN); 2720Sstevel@tonic-gate 2730Sstevel@tonic-gate mp = allocb(msgsize, BPRI_MED); 2740Sstevel@tonic-gate if (mp == NULL) 2750Sstevel@tonic-gate return (ENOMEM); 2760Sstevel@tonic-gate 2770Sstevel@tonic-gate mp->b_wptr += msgsize; 2780Sstevel@tonic-gate mp->b_cont = asc->head; 2790Sstevel@tonic-gate 2800Sstevel@tonic-gate ch = (sctp_chunk_hdr_t *)mp->b_rptr; 2810Sstevel@tonic-gate ch->sch_id = CHUNK_ASCONF; 2820Sstevel@tonic-gate ch->sch_flags = 0; 2830Sstevel@tonic-gate ch->sch_len = htons(msgdsize(mp)); 2840Sstevel@tonic-gate 2850Sstevel@tonic-gate nmp = msgpullup(mp, -1); 2860Sstevel@tonic-gate if (nmp == NULL) { 2870Sstevel@tonic-gate freeb(mp); 2880Sstevel@tonic-gate return (ENOMEM); 2890Sstevel@tonic-gate } 2900Sstevel@tonic-gate 2910Sstevel@tonic-gate /* Clean up the temporary mblk chain */ 2920Sstevel@tonic-gate freemsg(mp); 2930Sstevel@tonic-gate asc->head = NULL; 2940Sstevel@tonic-gate asc->cid = 0; 2950Sstevel@tonic-gate 2960Sstevel@tonic-gate /* Queue it ... */ 2970Sstevel@tonic-gate if (sctp->sctp_cxmit_list == NULL) { 2980Sstevel@tonic-gate sctp->sctp_cxmit_list = nmp; 2990Sstevel@tonic-gate } else { 3000Sstevel@tonic-gate linkb(sctp->sctp_cxmit_list, nmp); 3010Sstevel@tonic-gate } 3020Sstevel@tonic-gate 3030Sstevel@tonic-gate BUMP_LOCAL(sctp->sctp_obchunks); 3040Sstevel@tonic-gate 3050Sstevel@tonic-gate /* And try to send it. */ 3060Sstevel@tonic-gate sctp_wput_asconf(sctp, fp); 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate return (0); 3090Sstevel@tonic-gate } 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate /* 3120Sstevel@tonic-gate * If the peer does not understand an ASCONF chunk, we simply 3130Sstevel@tonic-gate * clear out the cxmit_list, since we can send nothing further 3140Sstevel@tonic-gate * that the peer will understand. 3150Sstevel@tonic-gate * 3160Sstevel@tonic-gate * Assumes chunk length has already been checked. 3170Sstevel@tonic-gate */ 3180Sstevel@tonic-gate /*ARGSUSED*/ 3190Sstevel@tonic-gate void 3200Sstevel@tonic-gate sctp_asconf_unrec_chunk(sctp_t *sctp, sctp_chunk_hdr_t *ch) 3210Sstevel@tonic-gate { 3220Sstevel@tonic-gate if (sctp->sctp_cxmit_list == NULL) { 3230Sstevel@tonic-gate /* Nothing pending */ 3240Sstevel@tonic-gate return; 3250Sstevel@tonic-gate } 3260Sstevel@tonic-gate 3270Sstevel@tonic-gate freemsg(sctp->sctp_cxmit_list); 3280Sstevel@tonic-gate sctp->sctp_cxmit_list = NULL; 3290Sstevel@tonic-gate } 3300Sstevel@tonic-gate 3310Sstevel@tonic-gate void 3320Sstevel@tonic-gate sctp_input_asconf(sctp_t *sctp, sctp_chunk_hdr_t *ch, sctp_faddr_t *fp) 3330Sstevel@tonic-gate { 3340Sstevel@tonic-gate const dispatch_t *dp; 3350Sstevel@tonic-gate mblk_t *hmp; 3360Sstevel@tonic-gate mblk_t *mp; 3370Sstevel@tonic-gate uint32_t *idp; 3380Sstevel@tonic-gate uint32_t *hidp; 3390Sstevel@tonic-gate ssize_t rlen; 3400Sstevel@tonic-gate sctp_parm_hdr_t *ph; 3410Sstevel@tonic-gate sctp_chunk_hdr_t *ach; 3420Sstevel@tonic-gate int cont; 3430Sstevel@tonic-gate int act; 3440Sstevel@tonic-gate uint16_t plen; 3450Sstevel@tonic-gate 3460Sstevel@tonic-gate ASSERT(ch->sch_id == CHUNK_ASCONF); 3470Sstevel@tonic-gate 3480Sstevel@tonic-gate idp = (uint32_t *)(ch + 1); 3490Sstevel@tonic-gate rlen = ntohs(ch->sch_len) - sizeof (*ch) - sizeof (*idp); 3500Sstevel@tonic-gate 3510Sstevel@tonic-gate if (rlen < 0 || rlen < sizeof (*idp)) { 3520Sstevel@tonic-gate /* nothing there; bail out */ 3530Sstevel@tonic-gate return; 3540Sstevel@tonic-gate } 3550Sstevel@tonic-gate 3560Sstevel@tonic-gate /* Check for duplicates */ 3570Sstevel@tonic-gate *idp = ntohl(*idp); 3580Sstevel@tonic-gate if (*idp == (sctp->sctp_fcsn + 1)) { 3590Sstevel@tonic-gate act = 1; 3600Sstevel@tonic-gate } else if (*idp == sctp->sctp_fcsn) { 3610Sstevel@tonic-gate act = 0; 3620Sstevel@tonic-gate } else { 3630Sstevel@tonic-gate /* stale or malicious packet; drop */ 3640Sstevel@tonic-gate return; 3650Sstevel@tonic-gate } 3660Sstevel@tonic-gate 3670Sstevel@tonic-gate /* Create the ASCONF_ACK header */ 3680Sstevel@tonic-gate hmp = sctp_make_mp(sctp, fp, sizeof (*ach) + sizeof (*idp)); 3690Sstevel@tonic-gate if (hmp == NULL) { 3700Sstevel@tonic-gate /* Let the peer retransmit */ 3710Sstevel@tonic-gate return; 3720Sstevel@tonic-gate } 3730Sstevel@tonic-gate ach = (sctp_chunk_hdr_t *)hmp->b_wptr; 3740Sstevel@tonic-gate ach->sch_id = CHUNK_ASCONF_ACK; 3750Sstevel@tonic-gate ach->sch_flags = 0; 3760Sstevel@tonic-gate /* Set the length later */ 3770Sstevel@tonic-gate hidp = (uint32_t *)(ach + 1); 3780Sstevel@tonic-gate *hidp = htonl(*idp); 3790Sstevel@tonic-gate hmp->b_wptr = (uchar_t *)(hidp + 1); 3800Sstevel@tonic-gate 3810Sstevel@tonic-gate /* Move to the Address Parameter */ 3820Sstevel@tonic-gate ph = (sctp_parm_hdr_t *)(idp + 1); 3830Sstevel@tonic-gate if (rlen <= ntohs(ph->sph_len)) { 3840Sstevel@tonic-gate freeb(hmp); 3850Sstevel@tonic-gate return; 3860Sstevel@tonic-gate } 3870Sstevel@tonic-gate 3880Sstevel@tonic-gate /* 3890Sstevel@tonic-gate * We already have the association here, so this address parameter 3900Sstevel@tonic-gate * doesn't seem to be very useful, should we make sure this is part 3910Sstevel@tonic-gate * of the association and send an error, if not? 3920Sstevel@tonic-gate * Ignore it for now. 3930Sstevel@tonic-gate */ 3940Sstevel@tonic-gate rlen -= ntohs(ph->sph_len); 3950Sstevel@tonic-gate ph = (sctp_parm_hdr_t *)((char *)ph + ntohs(ph->sph_len)); 3960Sstevel@tonic-gate cont = 1; 3970Sstevel@tonic-gate while (rlen > 0 && cont) { 3980Sstevel@tonic-gate /* Sanity checks */ 3990Sstevel@tonic-gate if (rlen < sizeof (*ph)) 4000Sstevel@tonic-gate break; 4010Sstevel@tonic-gate plen = ntohs(ph->sph_len); 4020Sstevel@tonic-gate if (plen < sizeof (*ph) || plen > rlen) { 4030Sstevel@tonic-gate break; 4040Sstevel@tonic-gate } 4050Sstevel@tonic-gate idp = (uint32_t *)(ph + 1); 4060Sstevel@tonic-gate dp = sctp_lookup_asconf_dispatch(ntohs(ph->sph_type)); 4070Sstevel@tonic-gate ASSERT(dp); 4080Sstevel@tonic-gate if (dp->asconf) { 4090Sstevel@tonic-gate mp = dp->asconf(sctp, ph, *idp, fp, &cont, act); 4100Sstevel@tonic-gate if (cont == -1) { 4110Sstevel@tonic-gate /* 4120Sstevel@tonic-gate * Not even enough memory to create 4130Sstevel@tonic-gate * an out-of-resources error. Free 4140Sstevel@tonic-gate * everything and return; the peer 4150Sstevel@tonic-gate * should retransmit. 4160Sstevel@tonic-gate */ 4170Sstevel@tonic-gate freemsg(hmp); 4180Sstevel@tonic-gate return; 4190Sstevel@tonic-gate } 4200Sstevel@tonic-gate if (mp != NULL) { 4210Sstevel@tonic-gate linkb(hmp, mp); 4220Sstevel@tonic-gate } 4230Sstevel@tonic-gate } 4240Sstevel@tonic-gate ph = sctp_next_parm(ph, &rlen); 4250Sstevel@tonic-gate if (ph == NULL) 4260Sstevel@tonic-gate break; 4270Sstevel@tonic-gate } 4280Sstevel@tonic-gate 4290Sstevel@tonic-gate /* Now that the params have been processed, increment the fcsn */ 4300Sstevel@tonic-gate if (act) { 4310Sstevel@tonic-gate sctp->sctp_fcsn++; 4320Sstevel@tonic-gate } 4330Sstevel@tonic-gate BUMP_LOCAL(sctp->sctp_obchunks); 4340Sstevel@tonic-gate 4350Sstevel@tonic-gate if (fp->isv4) 4360Sstevel@tonic-gate ach->sch_len = htons(msgdsize(hmp) - sctp->sctp_hdr_len); 4370Sstevel@tonic-gate else 4380Sstevel@tonic-gate ach->sch_len = htons(msgdsize(hmp) - sctp->sctp_hdr6_len); 4390Sstevel@tonic-gate sctp_set_iplen(sctp, hmp); 4400Sstevel@tonic-gate 4410Sstevel@tonic-gate sctp_add_sendq(sctp, hmp); 4420Sstevel@tonic-gate sctp_validate_peer(sctp); 4430Sstevel@tonic-gate } 4440Sstevel@tonic-gate 4450Sstevel@tonic-gate static sctp_parm_hdr_t * 4460Sstevel@tonic-gate sctp_lookup_asconf_param(sctp_parm_hdr_t *ph, uint32_t cid, ssize_t rlen) 4470Sstevel@tonic-gate { 4480Sstevel@tonic-gate uint32_t *idp; 4490Sstevel@tonic-gate 4500Sstevel@tonic-gate while (rlen > 0) { 4510Sstevel@tonic-gate idp = (uint32_t *)(ph + 1); 4520Sstevel@tonic-gate if (*idp == cid) { 4530Sstevel@tonic-gate return (ph); 4540Sstevel@tonic-gate } 4550Sstevel@tonic-gate ph = sctp_next_parm(ph, &rlen); 4560Sstevel@tonic-gate if (ph == NULL) 4570Sstevel@tonic-gate break; 4580Sstevel@tonic-gate } 4590Sstevel@tonic-gate return (NULL); 4600Sstevel@tonic-gate } 4610Sstevel@tonic-gate 4620Sstevel@tonic-gate void 4630Sstevel@tonic-gate sctp_input_asconf_ack(sctp_t *sctp, sctp_chunk_hdr_t *ch, sctp_faddr_t *fp) 4640Sstevel@tonic-gate { 4650Sstevel@tonic-gate const dispatch_t *dp; 4660Sstevel@tonic-gate uint32_t *idp; 4670Sstevel@tonic-gate uint32_t *snp; 4680Sstevel@tonic-gate ssize_t rlen; 4690Sstevel@tonic-gate ssize_t plen; 4700Sstevel@tonic-gate sctp_parm_hdr_t *ph; 4710Sstevel@tonic-gate sctp_parm_hdr_t *oph; 4720Sstevel@tonic-gate sctp_parm_hdr_t *fph; 4730Sstevel@tonic-gate mblk_t *mp; 4740Sstevel@tonic-gate sctp_chunk_hdr_t *och; 4750Sstevel@tonic-gate int redosrcs = 0; 4760Sstevel@tonic-gate uint16_t param_len; 4770Sstevel@tonic-gate 4780Sstevel@tonic-gate ASSERT(ch->sch_id == CHUNK_ASCONF_ACK); 4790Sstevel@tonic-gate 4800Sstevel@tonic-gate snp = (uint32_t *)(ch + 1); 4810Sstevel@tonic-gate rlen = ntohs(ch->sch_len) - sizeof (*ch) - sizeof (*snp); 4820Sstevel@tonic-gate if (rlen < 0) { 4830Sstevel@tonic-gate return; 4840Sstevel@tonic-gate } 4850Sstevel@tonic-gate 4860Sstevel@tonic-gate /* Accept only an ACK for the current serial number */ 4870Sstevel@tonic-gate *snp = ntohl(*snp); 4880Sstevel@tonic-gate if (sctp->sctp_cxmit_list == NULL || *snp != (sctp->sctp_lcsn - 1)) { 4890Sstevel@tonic-gate /* Need to send an abort */ 4900Sstevel@tonic-gate return; 4910Sstevel@tonic-gate } 4920Sstevel@tonic-gate sctp->sctp_cchunk_pend = 0; 4930Sstevel@tonic-gate SCTP_FADDR_RC_TIMER_STOP(fp); 4940Sstevel@tonic-gate 4950Sstevel@tonic-gate /* 4960Sstevel@tonic-gate * Pass explicit replies to callbacks: 4970Sstevel@tonic-gate * For each reply in the ACK, look up the corresponding 4980Sstevel@tonic-gate * original parameter in the request using the correlation 4990Sstevel@tonic-gate * ID, and pass it to the right callback. 5000Sstevel@tonic-gate */ 5010Sstevel@tonic-gate och = (sctp_chunk_hdr_t *)sctp->sctp_cxmit_list->b_rptr; 5020Sstevel@tonic-gate 5030Sstevel@tonic-gate plen = ntohs(och->sch_len) - sizeof (*och) - sizeof (*idp); 5040Sstevel@tonic-gate idp = (uint32_t *)(och + 1); 5050Sstevel@tonic-gate 5060Sstevel@tonic-gate /* Get to the 1st ASCONF param, need to skip Address TLV parm */ 5070Sstevel@tonic-gate fph = (sctp_parm_hdr_t *)(idp + 1); 5080Sstevel@tonic-gate plen -= ntohs(fph->sph_len); 5090Sstevel@tonic-gate fph = (sctp_parm_hdr_t *)((char *)fph + ntohs(fph->sph_len)); 5100Sstevel@tonic-gate ph = (sctp_parm_hdr_t *)(snp + 1); 5110Sstevel@tonic-gate while (rlen > 0) { 5120Sstevel@tonic-gate /* Sanity checks */ 5130Sstevel@tonic-gate if (rlen < sizeof (*ph)) { 5140Sstevel@tonic-gate break; 5150Sstevel@tonic-gate } 5160Sstevel@tonic-gate param_len = ntohs(ph->sph_len); 5170Sstevel@tonic-gate if (param_len < sizeof (*ph) || param_len > rlen) { 5180Sstevel@tonic-gate break; 5190Sstevel@tonic-gate } 5200Sstevel@tonic-gate idp = (uint32_t *)(ph + 1); 5210Sstevel@tonic-gate oph = sctp_lookup_asconf_param(fph, *idp, plen); 5220Sstevel@tonic-gate if (oph != NULL) { 5230Sstevel@tonic-gate dp = sctp_lookup_asconf_dispatch(ntohs(oph->sph_type)); 5240Sstevel@tonic-gate ASSERT(dp); 5250Sstevel@tonic-gate if (dp->asconf_ack) { 5260Sstevel@tonic-gate dp->asconf_ack(sctp, ph, oph, fp); 5270Sstevel@tonic-gate 5280Sstevel@tonic-gate /* hack. see below */ 5290Sstevel@tonic-gate if (oph->sph_type == htons(PARM_ADD_IP) || 5300Sstevel@tonic-gate oph->sph_type == htons(PARM_DEL_IP)) { 5310Sstevel@tonic-gate redosrcs = 1; 5320Sstevel@tonic-gate } 5330Sstevel@tonic-gate } 5340Sstevel@tonic-gate } 5350Sstevel@tonic-gate 5360Sstevel@tonic-gate ph = sctp_next_parm(ph, &rlen); 5370Sstevel@tonic-gate if (ph == NULL) 5380Sstevel@tonic-gate break; 5390Sstevel@tonic-gate } 5400Sstevel@tonic-gate 5410Sstevel@tonic-gate /* 5420Sstevel@tonic-gate * Pass implicit replies to callbacks: 5430Sstevel@tonic-gate * For each original request, look up its parameter 5440Sstevel@tonic-gate * in the ACK. If there is no corresponding reply, 5450Sstevel@tonic-gate * call the callback with a NULL parameter, indicating 5460Sstevel@tonic-gate * success. 5470Sstevel@tonic-gate */ 5480Sstevel@tonic-gate rlen = plen; 5490Sstevel@tonic-gate plen = ntohs(ch->sch_len) - sizeof (*ch) - sizeof (*idp); 5500Sstevel@tonic-gate oph = fph; 5510Sstevel@tonic-gate fph = (sctp_parm_hdr_t *)((char *)ch + sizeof (sctp_chunk_hdr_t) + 5520Sstevel@tonic-gate sizeof (uint32_t)); 5530Sstevel@tonic-gate while (rlen > 0) { 5540Sstevel@tonic-gate idp = (uint32_t *)(oph + 1); 5550Sstevel@tonic-gate ph = sctp_lookup_asconf_param(fph, *idp, plen); 5560Sstevel@tonic-gate if (ph == NULL) { 5570Sstevel@tonic-gate dp = sctp_lookup_asconf_dispatch(ntohs(oph->sph_type)); 5580Sstevel@tonic-gate ASSERT(dp); 5590Sstevel@tonic-gate if (dp->asconf_ack) { 5600Sstevel@tonic-gate dp->asconf_ack(sctp, NULL, oph, fp); 5610Sstevel@tonic-gate 5620Sstevel@tonic-gate /* hack. see below */ 5630Sstevel@tonic-gate if (oph->sph_type == htons(PARM_ADD_IP) || 5640Sstevel@tonic-gate oph->sph_type == htons(PARM_DEL_IP)) { 5650Sstevel@tonic-gate redosrcs = 1; 5660Sstevel@tonic-gate } 5670Sstevel@tonic-gate } 5680Sstevel@tonic-gate } 5690Sstevel@tonic-gate oph = sctp_next_parm(oph, &rlen); 5700Sstevel@tonic-gate if (oph == NULL) { 5710Sstevel@tonic-gate break; 5720Sstevel@tonic-gate } 5730Sstevel@tonic-gate } 5740Sstevel@tonic-gate 5750Sstevel@tonic-gate /* We can now free up the first chunk in the cxmit list */ 5760Sstevel@tonic-gate mp = sctp->sctp_cxmit_list; 5770Sstevel@tonic-gate sctp->sctp_cxmit_list = mp->b_cont; 5780Sstevel@tonic-gate mp->b_cont = NULL; 5790Sstevel@tonic-gate 5800Sstevel@tonic-gate fp = SCTP_CHUNK_DEST(mp); 5810Sstevel@tonic-gate ASSERT(fp != NULL && fp->suna >= MBLKL(mp)); 5820Sstevel@tonic-gate fp->suna -= MBLKL(mp); 5830Sstevel@tonic-gate freeb(mp); 5840Sstevel@tonic-gate 5850Sstevel@tonic-gate /* can now send the next control chunk */ 5860Sstevel@tonic-gate if (sctp->sctp_cxmit_list != NULL) 5870Sstevel@tonic-gate sctp_wput_asconf(sctp, NULL); 5880Sstevel@tonic-gate 5890Sstevel@tonic-gate /* 5900Sstevel@tonic-gate * If an add-ip or del-ip has completed (successfully or 5910Sstevel@tonic-gate * unsuccessfully), the pool of available source addresses 5920Sstevel@tonic-gate * may have changed, so we need to redo faddr source 5930Sstevel@tonic-gate * address selections. This is a bit of a hack since 5940Sstevel@tonic-gate * this really belongs in the add/del-ip code. However, 5950Sstevel@tonic-gate * that code consists of callbacks called for *each* 5960Sstevel@tonic-gate * add/del-ip parameter, and sctp_redo_faddr_srcs() is 5970Sstevel@tonic-gate * expensive enough that we really don't want to be 5980Sstevel@tonic-gate * doing it for each one. So we do it once here. 5990Sstevel@tonic-gate */ 6000Sstevel@tonic-gate if (redosrcs) 6010Sstevel@tonic-gate sctp_redo_faddr_srcs(sctp); 6020Sstevel@tonic-gate } 6030Sstevel@tonic-gate 6040Sstevel@tonic-gate static void 6050Sstevel@tonic-gate sctp_rc_timer(sctp_t *sctp, sctp_faddr_t *fp) 6060Sstevel@tonic-gate { 6070Sstevel@tonic-gate #define SCTP_CLR_SENT_FLAG(mp) ((mp)->b_flag &= ~SCTP_CHUNK_FLAG_SENT) 6080Sstevel@tonic-gate sctp_faddr_t *nfp; 6090Sstevel@tonic-gate sctp_faddr_t *ofp; 6100Sstevel@tonic-gate 6110Sstevel@tonic-gate ASSERT(fp != NULL); 6120Sstevel@tonic-gate 6130Sstevel@tonic-gate fp->rc_timer_running = 0; 6140Sstevel@tonic-gate 6150Sstevel@tonic-gate if (sctp->sctp_state != SCTPS_ESTABLISHED || 6160Sstevel@tonic-gate sctp->sctp_cxmit_list == NULL) { 6170Sstevel@tonic-gate return; 6180Sstevel@tonic-gate } 6190Sstevel@tonic-gate /* 6200Sstevel@tonic-gate * Not a retransmission, this was deferred due to some error 6210Sstevel@tonic-gate * condition 6220Sstevel@tonic-gate */ 6230Sstevel@tonic-gate if (!SCTP_CHUNK_ISSENT(sctp->sctp_cxmit_list)) { 6240Sstevel@tonic-gate sctp_wput_asconf(sctp, fp); 6250Sstevel@tonic-gate return; 6260Sstevel@tonic-gate } 6270Sstevel@tonic-gate /* 6280Sstevel@tonic-gate * The sent flag indicates if the msg has been sent on this fp. 6290Sstevel@tonic-gate */ 6300Sstevel@tonic-gate SCTP_CLR_SENT_FLAG(sctp->sctp_cxmit_list); 6310Sstevel@tonic-gate /* Retransmission */ 6320Sstevel@tonic-gate if (sctp->sctp_strikes >= sctp->sctp_pa_max_rxt) { 6330Sstevel@tonic-gate /* time to give up */ 6340Sstevel@tonic-gate BUMP_MIB(&sctp_mib, sctpAborted); 6350Sstevel@tonic-gate sctp_assoc_event(sctp, SCTP_COMM_LOST, 0, NULL); 6360Sstevel@tonic-gate sctp_clean_death(sctp, ETIMEDOUT); 6370Sstevel@tonic-gate return; 6380Sstevel@tonic-gate } 6390Sstevel@tonic-gate if (fp->strikes >= fp->max_retr) { 6400Sstevel@tonic-gate if (sctp_faddr_dead(sctp, fp, SCTP_FADDRS_DOWN) == -1) 6410Sstevel@tonic-gate return; 6420Sstevel@tonic-gate } 6430Sstevel@tonic-gate 6440Sstevel@tonic-gate fp->strikes++; 6450Sstevel@tonic-gate sctp->sctp_strikes++; 6460Sstevel@tonic-gate SCTP_CALC_RXT(fp, sctp->sctp_rto_max); 6470Sstevel@tonic-gate 6480Sstevel@tonic-gate nfp = sctp_rotate_faddr(sctp, fp); 6490Sstevel@tonic-gate sctp->sctp_cchunk_pend = 0; 6500Sstevel@tonic-gate ofp = SCTP_CHUNK_DEST(sctp->sctp_cxmit_list); 6510Sstevel@tonic-gate SCTP_SET_CHUNK_DEST(sctp->sctp_cxmit_list, NULL); 6520Sstevel@tonic-gate ASSERT(ofp != NULL && ofp == fp); 6530Sstevel@tonic-gate ASSERT(ofp->suna >= MBLKL(sctp->sctp_cxmit_list)); 6540Sstevel@tonic-gate /* 6550Sstevel@tonic-gate * Enter slow start for this destination. 6560Sstevel@tonic-gate * XXX anything in the data path that needs to be considered? 6570Sstevel@tonic-gate */ 6580Sstevel@tonic-gate ofp->ssthresh = ofp->cwnd / 2; 6590Sstevel@tonic-gate if (ofp->ssthresh < 2 * ofp->sfa_pmss) 6600Sstevel@tonic-gate ofp->ssthresh = 2 * ofp->sfa_pmss; 6610Sstevel@tonic-gate ofp->cwnd = ofp->sfa_pmss; 6620Sstevel@tonic-gate ofp->pba = 0; 6630Sstevel@tonic-gate ofp->suna -= MBLKL(sctp->sctp_cxmit_list); 6640Sstevel@tonic-gate /* 6650Sstevel@tonic-gate * The rexmit flags is used to determine if a serial number needs to 6660Sstevel@tonic-gate * be assigned or not, so once set we leave it there. 6670Sstevel@tonic-gate */ 6680Sstevel@tonic-gate if (!SCTP_CHUNK_WANT_REXMIT(sctp->sctp_cxmit_list)) 6690Sstevel@tonic-gate SCTP_CHUNK_REXMIT(sctp->sctp_cxmit_list); 6700Sstevel@tonic-gate sctp_wput_asconf(sctp, nfp); 6710Sstevel@tonic-gate #undef SCTP_CLR_SENT_FLAG 6720Sstevel@tonic-gate } 6730Sstevel@tonic-gate 6740Sstevel@tonic-gate void 6750Sstevel@tonic-gate sctp_wput_asconf(sctp_t *sctp, sctp_faddr_t *fp) 6760Sstevel@tonic-gate { 6770Sstevel@tonic-gate #define SCTP_SET_SENT_FLAG(mp) ((mp)->b_flag = SCTP_CHUNK_FLAG_SENT) 6780Sstevel@tonic-gate 6790Sstevel@tonic-gate mblk_t *mp; 6800Sstevel@tonic-gate mblk_t *ipmp; 6810Sstevel@tonic-gate uint32_t *snp; 6820Sstevel@tonic-gate sctp_parm_hdr_t *ph; 6830Sstevel@tonic-gate boolean_t isv4; 6840Sstevel@tonic-gate 6850Sstevel@tonic-gate if (sctp->sctp_cchunk_pend || sctp->sctp_cxmit_list == NULL || 6860Sstevel@tonic-gate /* Queue it for later transmission if not yet established */ 6870Sstevel@tonic-gate sctp->sctp_state < SCTPS_ESTABLISHED) { 6880Sstevel@tonic-gate ip2dbg(("sctp_wput_asconf: cchunk pending? (%d) or null "\ 6890Sstevel@tonic-gate "sctp_cxmit_list? (%s) or incorrect state? (%x)\n", 6900Sstevel@tonic-gate sctp->sctp_cchunk_pend, sctp->sctp_cxmit_list == NULL ? 6910Sstevel@tonic-gate "yes" : "no", sctp->sctp_state)); 6920Sstevel@tonic-gate return; 6930Sstevel@tonic-gate } 6940Sstevel@tonic-gate 6950Sstevel@tonic-gate if (fp == NULL) 6960Sstevel@tonic-gate fp = sctp->sctp_current; 6970Sstevel@tonic-gate 6980Sstevel@tonic-gate /* OK to send */ 6990Sstevel@tonic-gate ipmp = sctp_make_mp(sctp, fp, 0); 7000Sstevel@tonic-gate if (ipmp == NULL) { 7010Sstevel@tonic-gate SCTP_FADDR_RC_TIMER_RESTART(sctp, fp, fp->rto); 7020Sstevel@tonic-gate return; 7030Sstevel@tonic-gate } 7040Sstevel@tonic-gate mp = sctp->sctp_cxmit_list; 7050Sstevel@tonic-gate /* Fill in the mandatory Address Parameter TLV */ 7060Sstevel@tonic-gate isv4 = (fp != NULL) ? fp->isv4 : sctp->sctp_current->isv4; 7070Sstevel@tonic-gate ph = (sctp_parm_hdr_t *)(mp->b_rptr + sizeof (sctp_chunk_hdr_t) + 7080Sstevel@tonic-gate sizeof (uint32_t)); 7090Sstevel@tonic-gate if (isv4) { 7100Sstevel@tonic-gate ipha_t *ipha = (ipha_t *)ipmp->b_rptr; 7110Sstevel@tonic-gate in6_addr_t ipaddr; 7120Sstevel@tonic-gate ipaddr_t addr4; 7130Sstevel@tonic-gate 7140Sstevel@tonic-gate ph->sph_type = htons(PARM_ADDR4); 7150Sstevel@tonic-gate ph->sph_len = htons(PARM_ADDR4_LEN); 7160Sstevel@tonic-gate if (ipha->ipha_src != INADDR_ANY) { 7170Sstevel@tonic-gate bcopy(&ipha->ipha_src, ph + 1, IP_ADDR_LEN); 7180Sstevel@tonic-gate } else { 7190Sstevel@tonic-gate ipaddr = sctp_get_valid_addr(sctp, B_FALSE); 720*252Svi117747 /* 721*252Svi117747 * All the addresses are down. 722*252Svi117747 * Maybe we might have better luck next time. 723*252Svi117747 */ 724*252Svi117747 if (IN6_IS_ADDR_V4MAPPED_ANY(&ipaddr)) { 725*252Svi117747 SCTP_FADDR_RC_TIMER_RESTART(sctp, fp, fp->rto); 726*252Svi117747 freeb(ipmp); 727*252Svi117747 return; 728*252Svi117747 } 7290Sstevel@tonic-gate IN6_V4MAPPED_TO_IPADDR(&ipaddr, addr4); 7300Sstevel@tonic-gate bcopy(&addr4, ph + 1, IP_ADDR_LEN); 7310Sstevel@tonic-gate } 7320Sstevel@tonic-gate } else { 7330Sstevel@tonic-gate ip6_t *ip6 = (ip6_t *)ipmp->b_rptr; 7340Sstevel@tonic-gate in6_addr_t ipaddr; 7350Sstevel@tonic-gate 7360Sstevel@tonic-gate ph->sph_type = htons(PARM_ADDR6); 7370Sstevel@tonic-gate ph->sph_len = htons(PARM_ADDR6_LEN); 7380Sstevel@tonic-gate if (!IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { 7390Sstevel@tonic-gate bcopy(&ip6->ip6_src, ph + 1, IPV6_ADDR_LEN); 7400Sstevel@tonic-gate } else { 7410Sstevel@tonic-gate ipaddr = sctp_get_valid_addr(sctp, B_TRUE); 742*252Svi117747 /* 743*252Svi117747 * All the addresses are down. 744*252Svi117747 * Maybe we might have better luck next time. 745*252Svi117747 */ 746*252Svi117747 if (IN6_IS_ADDR_UNSPECIFIED(&ipaddr)) { 747*252Svi117747 SCTP_FADDR_RC_TIMER_RESTART(sctp, fp, fp->rto); 748*252Svi117747 freeb(ipmp); 749*252Svi117747 return; 750*252Svi117747 } 7510Sstevel@tonic-gate bcopy(&ipaddr, ph + 1, IPV6_ADDR_LEN); 7520Sstevel@tonic-gate } 7530Sstevel@tonic-gate } 7540Sstevel@tonic-gate 7550Sstevel@tonic-gate /* Don't exceed CWND */ 7560Sstevel@tonic-gate if ((MBLKL(mp) > (fp->cwnd - fp->suna)) || 7570Sstevel@tonic-gate ((mp = dupb(sctp->sctp_cxmit_list)) == NULL)) { 7580Sstevel@tonic-gate SCTP_FADDR_RC_TIMER_RESTART(sctp, fp, fp->rto); 7590Sstevel@tonic-gate freeb(ipmp); 7600Sstevel@tonic-gate return; 7610Sstevel@tonic-gate } 7620Sstevel@tonic-gate 7630Sstevel@tonic-gate /* Set the serial number now, if sending for the first time */ 7640Sstevel@tonic-gate if (!SCTP_CHUNK_WANT_REXMIT(mp)) { 7650Sstevel@tonic-gate snp = (uint32_t *)(mp->b_rptr + sizeof (sctp_chunk_hdr_t)); 7660Sstevel@tonic-gate *snp = htonl(sctp->sctp_lcsn++); 7670Sstevel@tonic-gate } 7680Sstevel@tonic-gate SCTP_CHUNK_CLEAR_FLAGS(mp); 7690Sstevel@tonic-gate fp->suna += MBLKL(mp); 7700Sstevel@tonic-gate /* Attach the header and send the chunk */ 7710Sstevel@tonic-gate ipmp->b_cont = mp; 7720Sstevel@tonic-gate sctp_set_iplen(sctp, ipmp); 7730Sstevel@tonic-gate sctp->sctp_cchunk_pend = 1; 7740Sstevel@tonic-gate 7750Sstevel@tonic-gate SCTP_SET_SENT_FLAG(sctp->sctp_cxmit_list); 7760Sstevel@tonic-gate SCTP_SET_CHUNK_DEST(sctp->sctp_cxmit_list, fp); 7770Sstevel@tonic-gate sctp_add_sendq(sctp, ipmp); 7780Sstevel@tonic-gate SCTP_FADDR_RC_TIMER_RESTART(sctp, fp, fp->rto); 7790Sstevel@tonic-gate #undef SCTP_SET_SENT_FLAG 7800Sstevel@tonic-gate } 7810Sstevel@tonic-gate 7820Sstevel@tonic-gate /* 7830Sstevel@tonic-gate * Generate ASCONF error param, include errph, if present. 7840Sstevel@tonic-gate */ 7850Sstevel@tonic-gate static mblk_t * 7860Sstevel@tonic-gate sctp_asconf_adderr(int err, sctp_parm_hdr_t *errph, uint32_t cid) 7870Sstevel@tonic-gate { 7880Sstevel@tonic-gate mblk_t *mp; 7890Sstevel@tonic-gate sctp_parm_hdr_t *eph; 7900Sstevel@tonic-gate sctp_parm_hdr_t *wph; 7910Sstevel@tonic-gate size_t len; 7920Sstevel@tonic-gate size_t elen = 0; 7930Sstevel@tonic-gate 7940Sstevel@tonic-gate len = sizeof (*wph) + sizeof (*eph) + sizeof (cid); 7950Sstevel@tonic-gate if (errph != NULL) { 7960Sstevel@tonic-gate elen = ntohs(errph->sph_len); 7970Sstevel@tonic-gate len += elen; 7980Sstevel@tonic-gate } 7990Sstevel@tonic-gate mp = allocb(len, BPRI_MED); 8000Sstevel@tonic-gate if (mp == NULL) { 8010Sstevel@tonic-gate return (NULL); 8020Sstevel@tonic-gate } 8030Sstevel@tonic-gate wph = (sctp_parm_hdr_t *)mp->b_rptr; 8040Sstevel@tonic-gate /* error cause wrapper */ 8050Sstevel@tonic-gate wph->sph_type = htons(PARM_ERROR_IND); 8060Sstevel@tonic-gate wph->sph_len = htons(len); 8070Sstevel@tonic-gate bcopy(&cid, wph + 1, sizeof (uint32_t)); 8080Sstevel@tonic-gate 8090Sstevel@tonic-gate /* error cause */ 8100Sstevel@tonic-gate eph = (sctp_parm_hdr_t *)((char *)wph + sizeof (sctp_parm_hdr_t) + 8110Sstevel@tonic-gate sizeof (cid)); 8120Sstevel@tonic-gate eph->sph_type = htons(err); 8130Sstevel@tonic-gate eph->sph_len = htons(len - sizeof (*wph) - sizeof (cid)); 8140Sstevel@tonic-gate mp->b_wptr = (uchar_t *)(eph + 1); 8150Sstevel@tonic-gate 8160Sstevel@tonic-gate /* details */ 8170Sstevel@tonic-gate if (elen > 0) { 8180Sstevel@tonic-gate bcopy(errph, mp->b_wptr, elen); 8190Sstevel@tonic-gate mp->b_wptr += elen; 8200Sstevel@tonic-gate } 8210Sstevel@tonic-gate return (mp); 8220Sstevel@tonic-gate } 8230Sstevel@tonic-gate 8240Sstevel@tonic-gate static mblk_t * 8250Sstevel@tonic-gate sctp_check_addip_addr(sctp_parm_hdr_t *ph, sctp_parm_hdr_t *oph, int *cont, 8260Sstevel@tonic-gate uint32_t cid, in6_addr_t *raddr) 8270Sstevel@tonic-gate { 8280Sstevel@tonic-gate uint16_t atype; 8290Sstevel@tonic-gate uint16_t alen; 8300Sstevel@tonic-gate mblk_t *mp; 8310Sstevel@tonic-gate in6_addr_t addr; 8320Sstevel@tonic-gate ipaddr_t *addr4; 8330Sstevel@tonic-gate 8340Sstevel@tonic-gate atype = ntohs(ph->sph_type); 8350Sstevel@tonic-gate alen = ntohs(ph->sph_len); 8360Sstevel@tonic-gate 8370Sstevel@tonic-gate if (atype != PARM_ADDR4 && atype != PARM_ADDR6) { 8380Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, oph, cid); 8390Sstevel@tonic-gate if (mp == NULL) { 8400Sstevel@tonic-gate *cont = -1; 8410Sstevel@tonic-gate } 8420Sstevel@tonic-gate return (mp); 8430Sstevel@tonic-gate } 8440Sstevel@tonic-gate if ((atype == PARM_ADDR4 && alen < PARM_ADDR4_LEN) || 8450Sstevel@tonic-gate (atype == PARM_ADDR6 && alen < PARM_ADDR6_LEN)) { 8460Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, oph, cid); 8470Sstevel@tonic-gate if (mp == NULL) { 8480Sstevel@tonic-gate *cont = -1; 8490Sstevel@tonic-gate } 8500Sstevel@tonic-gate return (mp); 8510Sstevel@tonic-gate } 8520Sstevel@tonic-gate 8530Sstevel@tonic-gate /* Address parameter is present; extract and screen it */ 8540Sstevel@tonic-gate if (atype == PARM_ADDR4) { 8550Sstevel@tonic-gate addr4 = (ipaddr_t *)(ph + 1); 8560Sstevel@tonic-gate IN6_IPADDR_TO_V4MAPPED(*addr4, &addr); 8570Sstevel@tonic-gate 8580Sstevel@tonic-gate /* screen XXX loopback to scoping */ 8590Sstevel@tonic-gate if (*addr4 == 0 || *addr4 == INADDR_BROADCAST || 8600Sstevel@tonic-gate *addr4 == htonl(INADDR_LOOPBACK) || IN_MULTICAST(*addr4)) { 8610Sstevel@tonic-gate dprint(1, ("addip: addr not unicast: %x:%x:%x:%x\n", 8620Sstevel@tonic-gate SCTP_PRINTADDR(addr))); 8630Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, oph, 8640Sstevel@tonic-gate cid); 8650Sstevel@tonic-gate if (mp == NULL) { 8660Sstevel@tonic-gate *cont = -1; 8670Sstevel@tonic-gate } 8680Sstevel@tonic-gate return (mp); 8690Sstevel@tonic-gate } 8700Sstevel@tonic-gate /* 8710Sstevel@tonic-gate * XXX also need to check for subnet 8720Sstevel@tonic-gate * broadcasts. This should probably 8730Sstevel@tonic-gate * wait until we have full access 8740Sstevel@tonic-gate * to the ILL tables. 8750Sstevel@tonic-gate */ 8760Sstevel@tonic-gate 8770Sstevel@tonic-gate } else { 8780Sstevel@tonic-gate bcopy(ph + 1, &addr, sizeof (addr)); 8790Sstevel@tonic-gate 8800Sstevel@tonic-gate /* screen XXX loopback to scoping */ 8810Sstevel@tonic-gate if (IN6_IS_ADDR_LINKLOCAL(&addr) || 8820Sstevel@tonic-gate IN6_IS_ADDR_MULTICAST(&addr) || 8830Sstevel@tonic-gate IN6_IS_ADDR_LOOPBACK(&addr)) { 8840Sstevel@tonic-gate dprint(1, ("addip: addr not unicast: %x:%x:%x:%x\n", 8850Sstevel@tonic-gate SCTP_PRINTADDR(addr))); 8860Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, oph, 8870Sstevel@tonic-gate cid); 8880Sstevel@tonic-gate if (mp == NULL) { 8890Sstevel@tonic-gate *cont = -1; 8900Sstevel@tonic-gate } 8910Sstevel@tonic-gate return (mp); 8920Sstevel@tonic-gate } 8930Sstevel@tonic-gate 8940Sstevel@tonic-gate } 8950Sstevel@tonic-gate 8960Sstevel@tonic-gate /* OK */ 8970Sstevel@tonic-gate *raddr = addr; 8980Sstevel@tonic-gate return (NULL); 8990Sstevel@tonic-gate } 9000Sstevel@tonic-gate 9010Sstevel@tonic-gate /* 9020Sstevel@tonic-gate * Handles both add and delete address requests. 9030Sstevel@tonic-gate */ 9040Sstevel@tonic-gate static mblk_t * 9050Sstevel@tonic-gate sctp_addip_req(sctp_t *sctp, sctp_parm_hdr_t *ph, uint32_t cid, 9060Sstevel@tonic-gate sctp_faddr_t *fp, int *cont, int act) 9070Sstevel@tonic-gate { 9080Sstevel@tonic-gate in6_addr_t addr; 9090Sstevel@tonic-gate uint16_t type; 9100Sstevel@tonic-gate mblk_t *mp; 9110Sstevel@tonic-gate sctp_faddr_t *nfp; 9120Sstevel@tonic-gate sctp_parm_hdr_t *oph; 9130Sstevel@tonic-gate 9140Sstevel@tonic-gate *cont = 1; 9150Sstevel@tonic-gate 9160Sstevel@tonic-gate /* Send back an authorization error if addip is disabled */ 9170Sstevel@tonic-gate if (!sctp_addip_enabled) { 9180Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_UNAUTHORIZED, ph, cid); 9190Sstevel@tonic-gate if (mp == NULL) 9200Sstevel@tonic-gate *cont = -1; 9210Sstevel@tonic-gate return (mp); 9220Sstevel@tonic-gate } 9230Sstevel@tonic-gate /* Check input */ 9240Sstevel@tonic-gate if (ntohs(ph->sph_len) < (sizeof (*ph) * 2)) { 9250Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, ph, cid); 9260Sstevel@tonic-gate if (mp == NULL) { 9270Sstevel@tonic-gate *cont = -1; 9280Sstevel@tonic-gate } 9290Sstevel@tonic-gate return (mp); 9300Sstevel@tonic-gate } 9310Sstevel@tonic-gate 9320Sstevel@tonic-gate type = ntohs(ph->sph_type); 9330Sstevel@tonic-gate oph = ph; 9340Sstevel@tonic-gate ph = (sctp_parm_hdr_t *)((char *)ph + sizeof (sctp_parm_hdr_t) + 9350Sstevel@tonic-gate sizeof (cid)); 9360Sstevel@tonic-gate mp = sctp_check_addip_addr(ph, oph, cont, cid, &addr); 9370Sstevel@tonic-gate if (mp != NULL) 9380Sstevel@tonic-gate return (mp); 9390Sstevel@tonic-gate 9400Sstevel@tonic-gate if (type == PARM_ADD_IP) { 9410Sstevel@tonic-gate if (sctp_lookup_faddr(sctp, &addr) != NULL) { 9420Sstevel@tonic-gate /* Address is already part of association */ 9430Sstevel@tonic-gate dprint(1, ("addip: addr already here: %x:%x:%x:%x\n", 9440Sstevel@tonic-gate SCTP_PRINTADDR(addr))); 9450Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, oph, 9460Sstevel@tonic-gate cid); 9470Sstevel@tonic-gate if (mp == NULL) { 9480Sstevel@tonic-gate *cont = -1; 9490Sstevel@tonic-gate } 9500Sstevel@tonic-gate return (mp); 9510Sstevel@tonic-gate } 9520Sstevel@tonic-gate 9530Sstevel@tonic-gate if (!act) { 9540Sstevel@tonic-gate return (NULL); 9550Sstevel@tonic-gate } 9560Sstevel@tonic-gate /* Add the new address */ 9570Sstevel@tonic-gate mutex_enter(&sctp->sctp_conn_tfp->tf_lock); 9580Sstevel@tonic-gate if (sctp_add_faddr(sctp, &addr, KM_NOSLEEP) != 0) { 9590Sstevel@tonic-gate mutex_exit(&sctp->sctp_conn_tfp->tf_lock); 9600Sstevel@tonic-gate /* no memory */ 9610Sstevel@tonic-gate *cont = -1; 9620Sstevel@tonic-gate return (NULL); 9630Sstevel@tonic-gate } 9640Sstevel@tonic-gate mutex_exit(&sctp->sctp_conn_tfp->tf_lock); 9650Sstevel@tonic-gate sctp_intf_event(sctp, addr, SCTP_ADDR_ADDED, 0); 9660Sstevel@tonic-gate } else if (type == PARM_DEL_IP) { 9670Sstevel@tonic-gate nfp = sctp_lookup_faddr(sctp, &addr); 9680Sstevel@tonic-gate if (nfp == NULL) { 9690Sstevel@tonic-gate /* 9700Sstevel@tonic-gate * Peer is trying to delete an address that is not 9710Sstevel@tonic-gate * part of the association. 9720Sstevel@tonic-gate */ 9730Sstevel@tonic-gate dprint(1, ("delip: addr not here: %x:%x:%x:%x\n", 9740Sstevel@tonic-gate SCTP_PRINTADDR(addr))); 9750Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, oph, 9760Sstevel@tonic-gate cid); 9770Sstevel@tonic-gate if (mp == NULL) { 9780Sstevel@tonic-gate *cont = -1; 9790Sstevel@tonic-gate } 9800Sstevel@tonic-gate return (mp); 9810Sstevel@tonic-gate } 9820Sstevel@tonic-gate if (sctp->sctp_faddrs == nfp && nfp->next == NULL) { 9830Sstevel@tonic-gate /* Peer is trying to delete last address */ 9840Sstevel@tonic-gate dprint(1, ("delip: del last addr: %x:%x:%x:%x\n", 9850Sstevel@tonic-gate SCTP_PRINTADDR(addr))); 9860Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_DEL_LAST_ADDR, oph, 9870Sstevel@tonic-gate cid); 9880Sstevel@tonic-gate if (mp == NULL) { 9890Sstevel@tonic-gate *cont = -1; 9900Sstevel@tonic-gate } 9910Sstevel@tonic-gate return (mp); 9920Sstevel@tonic-gate } 9930Sstevel@tonic-gate if (nfp == fp) { 9940Sstevel@tonic-gate /* Peer is trying to delete source address */ 9950Sstevel@tonic-gate dprint(1, ("delip: del src addr: %x:%x:%x:%x\n", 9960Sstevel@tonic-gate SCTP_PRINTADDR(addr))); 9970Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_DEL_SRC_ADDR, oph, 9980Sstevel@tonic-gate cid); 9990Sstevel@tonic-gate if (mp == NULL) { 10000Sstevel@tonic-gate *cont = -1; 10010Sstevel@tonic-gate } 10020Sstevel@tonic-gate return (mp); 10030Sstevel@tonic-gate } 10040Sstevel@tonic-gate if (!act) { 10050Sstevel@tonic-gate return (NULL); 10060Sstevel@tonic-gate } 10070Sstevel@tonic-gate 10080Sstevel@tonic-gate sctp_unlink_faddr(sctp, nfp); 10090Sstevel@tonic-gate /* Update all references to the deleted faddr */ 10100Sstevel@tonic-gate if (sctp->sctp_primary == nfp) { 10110Sstevel@tonic-gate sctp->sctp_primary = fp; 10120Sstevel@tonic-gate } 10130Sstevel@tonic-gate if (sctp->sctp_current == nfp) { 10140Sstevel@tonic-gate sctp->sctp_current = fp; 10150Sstevel@tonic-gate sctp->sctp_mss = fp->sfa_pmss; 10160Sstevel@tonic-gate sctp_faddr2hdraddr(fp, sctp); 10170Sstevel@tonic-gate 10180Sstevel@tonic-gate if (!SCTP_IS_DETACHED(sctp)) { 10190Sstevel@tonic-gate sctp_set_ulp_prop(sctp); 10200Sstevel@tonic-gate } 10210Sstevel@tonic-gate } 10220Sstevel@tonic-gate if (sctp->sctp_lastdata == nfp) { 10230Sstevel@tonic-gate sctp->sctp_lastdata = fp; 10240Sstevel@tonic-gate } 10250Sstevel@tonic-gate if (sctp->sctp_shutdown_faddr == nfp) { 10260Sstevel@tonic-gate sctp->sctp_shutdown_faddr = nfp; 10270Sstevel@tonic-gate } 10280Sstevel@tonic-gate if (sctp->sctp_lastfaddr == nfp) { 10290Sstevel@tonic-gate for (fp = sctp->sctp_faddrs; fp->next; fp = fp->next) 10300Sstevel@tonic-gate ; 10310Sstevel@tonic-gate sctp->sctp_lastfaddr = fp; 10320Sstevel@tonic-gate } 10330Sstevel@tonic-gate sctp_intf_event(sctp, addr, SCTP_ADDR_REMOVED, 0); 10340Sstevel@tonic-gate } else { 10350Sstevel@tonic-gate ASSERT(0); 10360Sstevel@tonic-gate } 10370Sstevel@tonic-gate 10380Sstevel@tonic-gate /* Successful, don't need to return anything. */ 10390Sstevel@tonic-gate return (NULL); 10400Sstevel@tonic-gate } 10410Sstevel@tonic-gate 10420Sstevel@tonic-gate /* 10430Sstevel@tonic-gate * Handles both add and delete IP ACKs. 10440Sstevel@tonic-gate */ 10450Sstevel@tonic-gate /*ARGSUSED*/ 10460Sstevel@tonic-gate static void 10470Sstevel@tonic-gate sctp_addip_ack(sctp_t *sctp, sctp_parm_hdr_t *ph, sctp_parm_hdr_t *oph, 10480Sstevel@tonic-gate sctp_faddr_t *fp) 10490Sstevel@tonic-gate { 10500Sstevel@tonic-gate in6_addr_t addr; 10510Sstevel@tonic-gate sctp_saddr_ipif_t *sp; 10520Sstevel@tonic-gate ipaddr_t *addr4; 10530Sstevel@tonic-gate boolean_t backout = B_FALSE; 10540Sstevel@tonic-gate uint16_t type; 10550Sstevel@tonic-gate uint32_t *cid; 10560Sstevel@tonic-gate 10570Sstevel@tonic-gate /* If the peer doesn't understand Add-IP, remember it */ 10580Sstevel@tonic-gate if (ph != NULL && ph->sph_type == htons(PARM_UNRECOGNIZED)) { 10590Sstevel@tonic-gate sctp->sctp_understands_addip = B_FALSE; 10600Sstevel@tonic-gate backout = B_TRUE; 10610Sstevel@tonic-gate } 10620Sstevel@tonic-gate 10630Sstevel@tonic-gate /* 10640Sstevel@tonic-gate * If OK, continue with the add / delete action, otherwise 10650Sstevel@tonic-gate * back out the action. 10660Sstevel@tonic-gate */ 10670Sstevel@tonic-gate if (ph != NULL && ph->sph_type != htons(PARM_SUCCESS)) { 10680Sstevel@tonic-gate backout = B_TRUE; 10690Sstevel@tonic-gate sctp_error_event(sctp, (sctp_chunk_hdr_t *)ph); 10700Sstevel@tonic-gate } 10710Sstevel@tonic-gate 10720Sstevel@tonic-gate type = ntohs(oph->sph_type); 10730Sstevel@tonic-gate cid = (uint32_t *)(oph + 1); 10740Sstevel@tonic-gate oph = (sctp_parm_hdr_t *)(cid + 1); 10750Sstevel@tonic-gate if (oph->sph_type == htons(PARM_ADDR4)) { 10760Sstevel@tonic-gate addr4 = (ipaddr_t *)(oph + 1); 10770Sstevel@tonic-gate IN6_IPADDR_TO_V4MAPPED(*addr4, &addr); 10780Sstevel@tonic-gate } else { 10790Sstevel@tonic-gate bcopy(oph + 1, &addr, sizeof (addr)); 10800Sstevel@tonic-gate } 10810Sstevel@tonic-gate 10820Sstevel@tonic-gate sp = sctp_saddr_lookup(sctp, &addr); 10830Sstevel@tonic-gate ASSERT(sp != NULL); 10840Sstevel@tonic-gate 10850Sstevel@tonic-gate if (type == PARM_ADD_IP) { 10860Sstevel@tonic-gate if (backout) { 10870Sstevel@tonic-gate sctp_del_saddr(sctp, sp); 10880Sstevel@tonic-gate } else { 10890Sstevel@tonic-gate sp->saddr_ipif_dontsrc = 0; 10900Sstevel@tonic-gate } 10910Sstevel@tonic-gate } else if (type == PARM_DEL_IP) { 10920Sstevel@tonic-gate if (backout) { 10930Sstevel@tonic-gate sp->saddr_ipif_delete_pending = 0; 10940Sstevel@tonic-gate sp->saddr_ipif_dontsrc = 0; 10950Sstevel@tonic-gate } else { 10960Sstevel@tonic-gate sctp_del_saddr(sctp, sp); 10970Sstevel@tonic-gate } 10980Sstevel@tonic-gate } else { 10990Sstevel@tonic-gate /* Must be either PARM_ADD_IP or PARM_DEL_IP */ 11000Sstevel@tonic-gate ASSERT(0); 11010Sstevel@tonic-gate } 11020Sstevel@tonic-gate } 11030Sstevel@tonic-gate 11040Sstevel@tonic-gate /*ARGSUSED*/ 11050Sstevel@tonic-gate static mblk_t * 11060Sstevel@tonic-gate sctp_setprim_req(sctp_t *sctp, sctp_parm_hdr_t *ph, uint32_t cid, 11070Sstevel@tonic-gate sctp_faddr_t *fp, int *cont, int act) 11080Sstevel@tonic-gate { 11090Sstevel@tonic-gate mblk_t *mp; 11100Sstevel@tonic-gate sctp_parm_hdr_t *oph; 11110Sstevel@tonic-gate sctp_faddr_t *nfp; 11120Sstevel@tonic-gate in6_addr_t addr; 11130Sstevel@tonic-gate 11140Sstevel@tonic-gate *cont = 1; 11150Sstevel@tonic-gate 11160Sstevel@tonic-gate /* Check input */ 11170Sstevel@tonic-gate if (ntohs(ph->sph_len) < (sizeof (*ph) * 2)) { 11180Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, ph, cid); 11190Sstevel@tonic-gate if (mp == NULL) { 11200Sstevel@tonic-gate *cont = -1; 11210Sstevel@tonic-gate } 11220Sstevel@tonic-gate return (mp); 11230Sstevel@tonic-gate } 11240Sstevel@tonic-gate 11250Sstevel@tonic-gate oph = ph; 11260Sstevel@tonic-gate ph = (sctp_parm_hdr_t *)((char *)ph + sizeof (sctp_parm_hdr_t) + 11270Sstevel@tonic-gate sizeof (cid)); 11280Sstevel@tonic-gate mp = sctp_check_addip_addr(ph, oph, cont, cid, &addr); 11290Sstevel@tonic-gate if (mp != NULL) { 11300Sstevel@tonic-gate return (mp); 11310Sstevel@tonic-gate } 11320Sstevel@tonic-gate 11330Sstevel@tonic-gate nfp = sctp_lookup_faddr(sctp, &addr); 11340Sstevel@tonic-gate if (nfp == NULL) { 11350Sstevel@tonic-gate /* 11360Sstevel@tonic-gate * Peer is trying to set an address that is not 11370Sstevel@tonic-gate * part of the association. 11380Sstevel@tonic-gate */ 11390Sstevel@tonic-gate dprint(1, ("setprim: addr not here: %x:%x:%x:%x\n", 11400Sstevel@tonic-gate SCTP_PRINTADDR(addr))); 11410Sstevel@tonic-gate mp = sctp_asconf_adderr(SCTP_ERR_BAD_MANDPARM, oph, cid); 11420Sstevel@tonic-gate if (mp == NULL) { 11430Sstevel@tonic-gate *cont = -1; 11440Sstevel@tonic-gate } 11450Sstevel@tonic-gate return (mp); 11460Sstevel@tonic-gate } 11470Sstevel@tonic-gate 11480Sstevel@tonic-gate sctp_intf_event(sctp, addr, SCTP_ADDR_MADE_PRIM, 0); 11490Sstevel@tonic-gate sctp->sctp_primary = nfp; 11500Sstevel@tonic-gate if (nfp->state != SCTP_FADDRS_ALIVE || nfp == sctp->sctp_current) { 11510Sstevel@tonic-gate return (NULL); 11520Sstevel@tonic-gate } 11530Sstevel@tonic-gate sctp->sctp_current = nfp; 11540Sstevel@tonic-gate sctp->sctp_mss = nfp->sfa_pmss; 11550Sstevel@tonic-gate 11560Sstevel@tonic-gate /* Reset the addrs in the composite header */ 11570Sstevel@tonic-gate sctp_faddr2hdraddr(nfp, sctp); 11580Sstevel@tonic-gate if (!SCTP_IS_DETACHED(sctp)) { 11590Sstevel@tonic-gate sctp_set_ulp_prop(sctp); 11600Sstevel@tonic-gate } 11610Sstevel@tonic-gate 11620Sstevel@tonic-gate return (NULL); 11630Sstevel@tonic-gate } 11640Sstevel@tonic-gate 11650Sstevel@tonic-gate /*ARGSUSED*/ 11660Sstevel@tonic-gate static void 11670Sstevel@tonic-gate sctp_setprim_ack(sctp_t *sctp, sctp_parm_hdr_t *ph, sctp_parm_hdr_t *oph, 11680Sstevel@tonic-gate sctp_faddr_t *fp) 11690Sstevel@tonic-gate { 11700Sstevel@tonic-gate if (ph != NULL && ph->sph_type != htons(PARM_SUCCESS)) { 11710Sstevel@tonic-gate /* If the peer doesn't understand Add-IP, remember it */ 11720Sstevel@tonic-gate if (ph->sph_type == htons(PARM_UNRECOGNIZED)) { 11730Sstevel@tonic-gate sctp->sctp_understands_addip = B_FALSE; 11740Sstevel@tonic-gate } 11750Sstevel@tonic-gate sctp_error_event(sctp, (sctp_chunk_hdr_t *)ph); 11760Sstevel@tonic-gate } 11770Sstevel@tonic-gate 11780Sstevel@tonic-gate /* On success we do nothing */ 11790Sstevel@tonic-gate } 11800Sstevel@tonic-gate 11810Sstevel@tonic-gate int 11820Sstevel@tonic-gate sctp_add_ip(sctp_t *sctp, const void *addrs, uint32_t cnt) 11830Sstevel@tonic-gate { 11840Sstevel@tonic-gate struct sockaddr_in *sin4; 11850Sstevel@tonic-gate struct sockaddr_in6 *sin6; 11860Sstevel@tonic-gate mblk_t *mp; 11870Sstevel@tonic-gate int error = 0; 11880Sstevel@tonic-gate int i; 11890Sstevel@tonic-gate sctp_addip4_t *ad4; 11900Sstevel@tonic-gate sctp_addip6_t *ad6; 11910Sstevel@tonic-gate sctp_asconf_t asc[1]; 11920Sstevel@tonic-gate uint16_t type = htons(PARM_ADD_IP); 11930Sstevel@tonic-gate boolean_t v4mapped = B_FALSE; 11940Sstevel@tonic-gate 11950Sstevel@tonic-gate /* Does the peer understand ASCONF and Add-IP? */ 11960Sstevel@tonic-gate if (!sctp->sctp_understands_asconf || !sctp->sctp_understands_addip) 11970Sstevel@tonic-gate return (EOPNOTSUPP); 11980Sstevel@tonic-gate 11990Sstevel@tonic-gate sctp_asconf_init(asc); 12000Sstevel@tonic-gate 12010Sstevel@tonic-gate /* 12020Sstevel@tonic-gate * Screen addresses: 12030Sstevel@tonic-gate * If adding: 12040Sstevel@tonic-gate * o Must not already be a part of the association 12050Sstevel@tonic-gate * o Must be AF_INET or AF_INET6 12060Sstevel@tonic-gate * o XXX Must be valid source address for this node 12070Sstevel@tonic-gate * o Must be unicast 12080Sstevel@tonic-gate * o XXX Must fit scoping rules 12090Sstevel@tonic-gate * If deleting: 12100Sstevel@tonic-gate * o Must be part of the association 12110Sstevel@tonic-gate */ 12120Sstevel@tonic-gate for (i = 0; i < cnt; i++) { 12130Sstevel@tonic-gate switch (sctp->sctp_family) { 12140Sstevel@tonic-gate case AF_INET: 12150Sstevel@tonic-gate sin4 = (struct sockaddr_in *)addrs + i; 12160Sstevel@tonic-gate v4mapped = B_TRUE; 12170Sstevel@tonic-gate break; 12180Sstevel@tonic-gate 12190Sstevel@tonic-gate case AF_INET6: 12200Sstevel@tonic-gate sin6 = (struct sockaddr_in6 *)addrs + i; 12210Sstevel@tonic-gate break; 12220Sstevel@tonic-gate } 12230Sstevel@tonic-gate 12240Sstevel@tonic-gate if (v4mapped) { 12250Sstevel@tonic-gate mp = allocb(sizeof (*ad4), BPRI_MED); 12260Sstevel@tonic-gate if (mp == NULL) { 12270Sstevel@tonic-gate error = ENOMEM; 12280Sstevel@tonic-gate goto fail; 12290Sstevel@tonic-gate } 12300Sstevel@tonic-gate mp->b_wptr += sizeof (*ad4); 12310Sstevel@tonic-gate ad4 = (sctp_addip4_t *)mp->b_rptr; 12320Sstevel@tonic-gate ad4->sad4_addip_ph.sph_type = type; 12330Sstevel@tonic-gate ad4->sad4_addip_ph.sph_len = 12340Sstevel@tonic-gate htons(sizeof (sctp_parm_hdr_t) + 12350Sstevel@tonic-gate PARM_ADDR4_LEN + sizeof (ad4->asconf_req_cid)); 12360Sstevel@tonic-gate ad4->sad4_addr4_ph.sph_type = htons(PARM_ADDR4); 12370Sstevel@tonic-gate ad4->sad4_addr4_ph.sph_len = htons(PARM_ADDR4_LEN); 12380Sstevel@tonic-gate ad4->sad4_addr = sin4->sin_addr.s_addr; 12390Sstevel@tonic-gate } else { 12400Sstevel@tonic-gate mp = allocb(sizeof (*ad6), BPRI_MED); 12410Sstevel@tonic-gate if (mp == NULL) { 12420Sstevel@tonic-gate error = ENOMEM; 12430Sstevel@tonic-gate goto fail; 12440Sstevel@tonic-gate } 12450Sstevel@tonic-gate mp->b_wptr += sizeof (*ad6); 12460Sstevel@tonic-gate ad6 = (sctp_addip6_t *)mp->b_rptr; 12470Sstevel@tonic-gate ad6->sad6_addip_ph.sph_type = type; 12480Sstevel@tonic-gate ad6->sad6_addip_ph.sph_len = 12490Sstevel@tonic-gate htons(sizeof (sctp_parm_hdr_t) + 12500Sstevel@tonic-gate PARM_ADDR6_LEN + sizeof (ad6->asconf_req_cid)); 12510Sstevel@tonic-gate ad6->sad6_addr6_ph.sph_type = htons(PARM_ADDR6); 12520Sstevel@tonic-gate ad6->sad6_addr6_ph.sph_len = htons(PARM_ADDR6_LEN); 12530Sstevel@tonic-gate ad6->sad6_addr = sin6->sin6_addr; 12540Sstevel@tonic-gate } 12550Sstevel@tonic-gate error = sctp_asconf_add(asc, mp); 12560Sstevel@tonic-gate if (error != 0) 12570Sstevel@tonic-gate goto fail; 12580Sstevel@tonic-gate } 12590Sstevel@tonic-gate error = sctp_asconf_send(sctp, asc, sctp->sctp_current); 12600Sstevel@tonic-gate if (error != 0) 12610Sstevel@tonic-gate goto fail; 12620Sstevel@tonic-gate 12630Sstevel@tonic-gate return (0); 12640Sstevel@tonic-gate 12650Sstevel@tonic-gate fail: 12660Sstevel@tonic-gate sctp_asconf_destroy(asc); 12670Sstevel@tonic-gate return (error); 12680Sstevel@tonic-gate } 12690Sstevel@tonic-gate 12700Sstevel@tonic-gate int 12710Sstevel@tonic-gate sctp_del_ip(sctp_t *sctp, const void *addrs, uint32_t cnt) 12720Sstevel@tonic-gate { 12730Sstevel@tonic-gate struct sockaddr_in *sin4; 12740Sstevel@tonic-gate struct sockaddr_in6 *sin6; 12750Sstevel@tonic-gate mblk_t *mp; 12760Sstevel@tonic-gate int error = 0; 12770Sstevel@tonic-gate int i; 12780Sstevel@tonic-gate int addrcnt = 0; 12790Sstevel@tonic-gate sctp_addip4_t *ad4; 12800Sstevel@tonic-gate sctp_addip6_t *ad6; 12810Sstevel@tonic-gate sctp_asconf_t asc[1]; 12820Sstevel@tonic-gate sctp_saddr_ipif_t *nsp; 12830Sstevel@tonic-gate uint16_t type = htons(PARM_DEL_IP); 12840Sstevel@tonic-gate boolean_t v4mapped = B_FALSE; 12850Sstevel@tonic-gate in6_addr_t addr; 12860Sstevel@tonic-gate boolean_t asconf = B_TRUE; 12870Sstevel@tonic-gate 12880Sstevel@tonic-gate /* Does the peer understand ASCONF and Add-IP? */ 12890Sstevel@tonic-gate if (sctp->sctp_state <= SCTPS_LISTEN || !sctp_addip_enabled || 12900Sstevel@tonic-gate !sctp->sctp_understands_asconf || !sctp->sctp_understands_addip) { 12910Sstevel@tonic-gate asconf = B_FALSE; 12920Sstevel@tonic-gate } 12930Sstevel@tonic-gate 12940Sstevel@tonic-gate if (asconf) 12950Sstevel@tonic-gate sctp_asconf_init(asc); 12960Sstevel@tonic-gate /* 12970Sstevel@tonic-gate * Screen addresses: 12980Sstevel@tonic-gate * If adding: 12990Sstevel@tonic-gate * o Must not already be a part of the association 13000Sstevel@tonic-gate * o Must be AF_INET or AF_INET6 13010Sstevel@tonic-gate * o XXX Must be valid source address for this node 13020Sstevel@tonic-gate * o Must be unicast 13030Sstevel@tonic-gate * o XXX Must fit scoping rules 13040Sstevel@tonic-gate * If deleting: 13050Sstevel@tonic-gate * o Must be part of the association 13060Sstevel@tonic-gate */ 13070Sstevel@tonic-gate for (i = 0; i < cnt; i++) { 13080Sstevel@tonic-gate switch (sctp->sctp_family) { 13090Sstevel@tonic-gate case AF_INET: 13100Sstevel@tonic-gate sin4 = (struct sockaddr_in *)addrs + i; 13110Sstevel@tonic-gate v4mapped = B_TRUE; 13120Sstevel@tonic-gate IN6_IPADDR_TO_V4MAPPED(sin4->sin_addr.s_addr, &addr); 13130Sstevel@tonic-gate break; 13140Sstevel@tonic-gate 13150Sstevel@tonic-gate case AF_INET6: 13160Sstevel@tonic-gate sin6 = (struct sockaddr_in6 *)addrs + i; 13170Sstevel@tonic-gate addr = sin6->sin6_addr; 13180Sstevel@tonic-gate break; 13190Sstevel@tonic-gate } 13200Sstevel@tonic-gate nsp = sctp_saddr_lookup(sctp, &addr); 13210Sstevel@tonic-gate if (nsp == NULL) { 13220Sstevel@tonic-gate error = EADDRNOTAVAIL; 13230Sstevel@tonic-gate goto fail; 13240Sstevel@tonic-gate } 13250Sstevel@tonic-gate 13260Sstevel@tonic-gate if (!asconf) 13270Sstevel@tonic-gate continue; 13280Sstevel@tonic-gate 13290Sstevel@tonic-gate nsp->saddr_ipif_delete_pending = 1; 13300Sstevel@tonic-gate nsp->saddr_ipif_dontsrc = 1; 13310Sstevel@tonic-gate addrcnt++; 13320Sstevel@tonic-gate if (v4mapped) { 13330Sstevel@tonic-gate mp = allocb(sizeof (*ad4), BPRI_MED); 13340Sstevel@tonic-gate if (mp == NULL) { 13350Sstevel@tonic-gate error = ENOMEM; 13360Sstevel@tonic-gate goto fail; 13370Sstevel@tonic-gate } 13380Sstevel@tonic-gate mp->b_wptr += sizeof (*ad4); 13390Sstevel@tonic-gate ad4 = (sctp_addip4_t *)mp->b_rptr; 13400Sstevel@tonic-gate ad4->sad4_addip_ph.sph_type = type; 13410Sstevel@tonic-gate ad4->sad4_addip_ph.sph_len = 13420Sstevel@tonic-gate htons(sizeof (sctp_parm_hdr_t) + 13430Sstevel@tonic-gate PARM_ADDR4_LEN + sizeof (ad4->asconf_req_cid)); 13440Sstevel@tonic-gate ad4->sad4_addr4_ph.sph_type = htons(PARM_ADDR4); 13450Sstevel@tonic-gate ad4->sad4_addr4_ph.sph_len = htons(PARM_ADDR4_LEN); 13460Sstevel@tonic-gate ad4->sad4_addr = sin4->sin_addr.s_addr; 13470Sstevel@tonic-gate } else { 13480Sstevel@tonic-gate mp = allocb(sizeof (*ad6), BPRI_MED); 13490Sstevel@tonic-gate if (mp == NULL) { 13500Sstevel@tonic-gate error = ENOMEM; 13510Sstevel@tonic-gate goto fail; 13520Sstevel@tonic-gate } 13530Sstevel@tonic-gate mp->b_wptr += sizeof (*ad6); 13540Sstevel@tonic-gate ad6 = (sctp_addip6_t *)mp->b_rptr; 13550Sstevel@tonic-gate ad6->sad6_addip_ph.sph_type = type; 13560Sstevel@tonic-gate ad6->sad6_addip_ph.sph_len = 13570Sstevel@tonic-gate htons(sizeof (sctp_parm_hdr_t) + PARM_ADDR6_LEN + 13580Sstevel@tonic-gate sizeof (ad6->asconf_req_cid)); 13590Sstevel@tonic-gate ad6->sad6_addr6_ph.sph_type = htons(PARM_ADDR6); 13600Sstevel@tonic-gate ad6->sad6_addr6_ph.sph_len = htons(PARM_ADDR6_LEN); 13610Sstevel@tonic-gate ad6->sad6_addr = addr; 13620Sstevel@tonic-gate } 13630Sstevel@tonic-gate 13640Sstevel@tonic-gate error = sctp_asconf_add(asc, mp); 13650Sstevel@tonic-gate if (error != 0) 13660Sstevel@tonic-gate goto fail; 13670Sstevel@tonic-gate } 13680Sstevel@tonic-gate 13690Sstevel@tonic-gate if (!asconf) { 13700Sstevel@tonic-gate sctp_del_saddr_list(sctp, addrs, cnt, B_FALSE); 13710Sstevel@tonic-gate return (0); 13720Sstevel@tonic-gate } 13730Sstevel@tonic-gate error = sctp_asconf_send(sctp, asc, sctp->sctp_current); 13740Sstevel@tonic-gate if (error != 0) 13750Sstevel@tonic-gate goto fail; 13760Sstevel@tonic-gate sctp_redo_faddr_srcs(sctp); 13770Sstevel@tonic-gate return (0); 13780Sstevel@tonic-gate 13790Sstevel@tonic-gate fail: 13800Sstevel@tonic-gate if (!asconf) 13810Sstevel@tonic-gate return (error); 13820Sstevel@tonic-gate for (i = 0; i < addrcnt; i++) { 13830Sstevel@tonic-gate switch (sctp->sctp_family) { 13840Sstevel@tonic-gate case AF_INET: 13850Sstevel@tonic-gate sin4 = (struct sockaddr_in *)addrs + i; 13860Sstevel@tonic-gate IN6_INADDR_TO_V4MAPPED(&(sin4->sin_addr), &addr); 13870Sstevel@tonic-gate break; 13880Sstevel@tonic-gate case AF_INET6: 13890Sstevel@tonic-gate sin6 = (struct sockaddr_in6 *)addrs + i; 13900Sstevel@tonic-gate addr = sin6->sin6_addr; 13910Sstevel@tonic-gate break; 13920Sstevel@tonic-gate } 13930Sstevel@tonic-gate nsp = sctp_saddr_lookup(sctp, &addr); 13940Sstevel@tonic-gate ASSERT(nsp != NULL); 13950Sstevel@tonic-gate nsp->saddr_ipif_delete_pending = 0; 13960Sstevel@tonic-gate nsp->saddr_ipif_dontsrc = 0; 13970Sstevel@tonic-gate } 13980Sstevel@tonic-gate sctp_asconf_destroy(asc); 13990Sstevel@tonic-gate 14000Sstevel@tonic-gate return (error); 14010Sstevel@tonic-gate } 14020Sstevel@tonic-gate 14030Sstevel@tonic-gate int 14040Sstevel@tonic-gate sctp_set_peerprim(sctp_t *sctp, const void *inp, uint_t inlen) 14050Sstevel@tonic-gate { 14060Sstevel@tonic-gate const struct sctp_setprim *prim = inp; 14070Sstevel@tonic-gate const struct sockaddr_storage *ss; 14080Sstevel@tonic-gate struct sockaddr_in *sin; 14090Sstevel@tonic-gate struct sockaddr_in6 *sin6; 14100Sstevel@tonic-gate in6_addr_t addr; 14110Sstevel@tonic-gate mblk_t *mp; 14120Sstevel@tonic-gate sctp_saddr_ipif_t *sp; 14130Sstevel@tonic-gate sctp_addip4_t *ad4; 14140Sstevel@tonic-gate sctp_addip6_t *ad6; 14150Sstevel@tonic-gate sctp_asconf_t asc[1]; 14160Sstevel@tonic-gate int error = 0; 14170Sstevel@tonic-gate 14180Sstevel@tonic-gate /* Does the peer understand ASCONF and Add-IP? */ 14190Sstevel@tonic-gate if (!sctp->sctp_understands_asconf || !sctp->sctp_understands_addip) { 14200Sstevel@tonic-gate return (EOPNOTSUPP); 14210Sstevel@tonic-gate } 14220Sstevel@tonic-gate 14230Sstevel@tonic-gate if (inlen < sizeof (*prim)) 14240Sstevel@tonic-gate return (EINVAL); 14250Sstevel@tonic-gate 14260Sstevel@tonic-gate /* Don't do anything if we are not connected */ 14270Sstevel@tonic-gate if (sctp->sctp_state != SCTPS_ESTABLISHED) 14280Sstevel@tonic-gate return (EINVAL); 14290Sstevel@tonic-gate 14300Sstevel@tonic-gate ss = &prim->ssp_addr; 14310Sstevel@tonic-gate sin = NULL; 14320Sstevel@tonic-gate sin6 = NULL; 14330Sstevel@tonic-gate if (ss->ss_family == AF_INET) { 14340Sstevel@tonic-gate sin = (struct sockaddr_in *)ss; 14350Sstevel@tonic-gate IN6_IPADDR_TO_V4MAPPED(sin->sin_addr.s_addr, &addr); 14360Sstevel@tonic-gate } else if (ss->ss_family == AF_INET6) { 14370Sstevel@tonic-gate sin6 = (struct sockaddr_in6 *)ss; 14380Sstevel@tonic-gate addr = sin6->sin6_addr; 14390Sstevel@tonic-gate } else { 14400Sstevel@tonic-gate return (EAFNOSUPPORT); 14410Sstevel@tonic-gate } 14420Sstevel@tonic-gate sp = sctp_saddr_lookup(sctp, &addr); 14430Sstevel@tonic-gate if (sp == NULL) 14440Sstevel@tonic-gate return (EADDRNOTAVAIL); 14450Sstevel@tonic-gate sctp_asconf_init(asc); 14460Sstevel@tonic-gate if (sin) { 14470Sstevel@tonic-gate mp = allocb(sizeof (*ad4), BPRI_MED); 14480Sstevel@tonic-gate if (mp == NULL) { 14490Sstevel@tonic-gate error = ENOMEM; 14500Sstevel@tonic-gate goto fail; 14510Sstevel@tonic-gate } 14520Sstevel@tonic-gate mp->b_wptr += sizeof (*ad4); 14530Sstevel@tonic-gate ad4 = (sctp_addip4_t *)mp->b_rptr; 14540Sstevel@tonic-gate ad4->sad4_addip_ph.sph_type = htons(PARM_SET_PRIMARY); 14550Sstevel@tonic-gate ad4->sad4_addip_ph.sph_len = htons(sizeof (sctp_parm_hdr_t) + 14560Sstevel@tonic-gate PARM_ADDR4_LEN + sizeof (ad4->asconf_req_cid)); 14570Sstevel@tonic-gate ad4->sad4_addr4_ph.sph_type = htons(PARM_ADDR4); 14580Sstevel@tonic-gate ad4->sad4_addr4_ph.sph_len = htons(PARM_ADDR4_LEN); 14590Sstevel@tonic-gate ad4->sad4_addr = sin->sin_addr.s_addr; 14600Sstevel@tonic-gate } else { 14610Sstevel@tonic-gate mp = allocb(sizeof (*ad6), BPRI_MED); 14620Sstevel@tonic-gate if (mp == NULL) { 14630Sstevel@tonic-gate error = ENOMEM; 14640Sstevel@tonic-gate goto fail; 14650Sstevel@tonic-gate } 14660Sstevel@tonic-gate mp->b_wptr += sizeof (*ad6); 14670Sstevel@tonic-gate ad6 = (sctp_addip6_t *)mp->b_rptr; 14680Sstevel@tonic-gate ad6->sad6_addip_ph.sph_type = htons(PARM_SET_PRIMARY); 14690Sstevel@tonic-gate ad6->sad6_addip_ph.sph_len = htons(sizeof (sctp_parm_hdr_t) + 14700Sstevel@tonic-gate PARM_ADDR6_LEN + sizeof (ad6->asconf_req_cid)); 14710Sstevel@tonic-gate ad6->sad6_addr6_ph.sph_type = htons(PARM_ADDR6); 14720Sstevel@tonic-gate ad6->sad6_addr6_ph.sph_len = htons(PARM_ADDR6_LEN); 14730Sstevel@tonic-gate ad6->sad6_addr = sin6->sin6_addr; 14740Sstevel@tonic-gate } 14750Sstevel@tonic-gate 14760Sstevel@tonic-gate error = sctp_asconf_add(asc, mp); 14770Sstevel@tonic-gate if (error != 0) { 14780Sstevel@tonic-gate goto fail; 14790Sstevel@tonic-gate } 14800Sstevel@tonic-gate 14810Sstevel@tonic-gate error = sctp_asconf_send(sctp, asc, sctp->sctp_current); 14820Sstevel@tonic-gate if (error == 0) { 14830Sstevel@tonic-gate return (0); 14840Sstevel@tonic-gate } 14850Sstevel@tonic-gate 14860Sstevel@tonic-gate fail: 14870Sstevel@tonic-gate sctp_asconf_destroy(asc); 14880Sstevel@tonic-gate return (error); 14890Sstevel@tonic-gate } 1490