b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * CDDL HEADER START
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * The contents of this file are subject to the terms of the
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * Common Development and Distribution License (the "License").
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * You may not use this file except in compliance with the License.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * See the License for the specific language governing permissions
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * and limitations under the License.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * When distributing Covered Code, include this CDDL HEADER in each
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * If applicable, add the following below this CDDL HEADER, with the
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * fields enclosed by brackets "[]" replaced with your own identifying
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * information: Portions Copyright [yyyy] [name of copyright owner]
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * CDDL HEADER END
721fffe35d40e548a5a58dc53a2ec9c6762172d9Kacheong Poon * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * Use is subject to license terms.
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri * Just pass the ioctl to IP and the result to the caller.
af4c679f647cf088543c762e33d41a3ac52cfa14Sean McEnroe if (lookupname("/dev/udp", UIO_SYSSPACE, FOLLOW, NULLVPP, &kkvp) == 0) {
af4c679f647cf088543c762e33d41a3ac52cfa14Sean McEnroe if (t_kopen((file_t *)NULL, kkvp->v_rdev, FREAD|FWRITE,
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * Check if the IP interface named by `lifrp' is RDS-capable.
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * Strip off the logical interface portion before getting
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * intimate with the name.
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * loopback is considered RDS-capable
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem rds_transport_ops->rds_transport_if_lookup_by_name(drv));
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * Issue an SIOCGLIFCONF down to IP and return the result in `lifcp'.
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * lifcp->lifc_buf is dynamically allocated to be *bufsizep bytes.
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem if ((err = rds_do_ip_ioctl(SIOCGIFNUM, sizeof (int), &nifs)) != 0)
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * Pad the interface count to account for additional interfaces that
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * may have been configured between the SIOCGLIFNUM and SIOCGLIFCONF.
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem lifcp->lifc_len = *bufsizep = (nifs * sizeof (struct lifreq));
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem err = rds_do_ip_ioctl(SIOCGLIFCONF, sizeof (struct lifconf), lifcp);
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem if (err != 0) {
c1f8b08e52d9b30bd55daeac694e3a7f50d3cd21agiri return (0);
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem for (lifrp = lifc.lifc_req, i = 0; i < nifs; i++, lifrp++) {
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem STRUCT_SET_HANDLE(ifc, iocp->ioc_flag, (struct ifconf *)addr);
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri mp1 = mi_copyout_alloc(q, mp, ubuf_addr, ubuf_size, B_FALSE);
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem MBLKTAIL(mp1) >= sizeof (struct ifreq); i++, lifrp++) {
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * Skip entries that are impossible to return with
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem * SIOCGIFCONF, or not RDS-capable.
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem ifrp->ifr_addr = *(struct sockaddr *)&lifrp->lifr_addr;
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem err = rds_do_ip_ioctl(iocp->ioc_cmd, sizeof (struct ifreq),
e11c3f44f531fdff80941ce57c065d2ae861cefcmeem ((struct iocblk *)(uintptr_t)mp->b_rptr)->ioc_flag, addr);
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri mp1 = mi_copyout_alloc(q, mp, STRUCT_FGETP(sb, buf), addrlen,
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri if (err == 0) {
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri struct iocblk *iocp = (struct iocblk *)(uintptr_t)mp->b_rptr;
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri copyin_size = sizeof (int);
b86efd96f8acd85ddaa930a2f0c1d664237e4aafagiri struct iocblk *iocp = (struct iocblk *)(uintptr_t)mp->b_rptr;