rds_ioctl.c revision 721fffe35d40e548a5a58dc53a2ec9c6762172d9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <net/if_types.h>
#include <sys/pathname.h>
/*
* Just pass the ioctl to IP and the result to the caller.
*/
int
{
int err = 0;
} else {
return (EPROTO);
}
} else {
return (EPROTO);
}
return (err);
}
/*
* Check if the IP interface named by `lifrp' is RDS-capable.
*/
static boolean_t
{
char drv[MAXLINKNAMELEN];
char *cp;
return (B_TRUE);
/*
* Strip off the logical interface portion before getting
* intimate with the name.
*/
*cp = '\0';
/*
* loopback is considered RDS-capable
*/
return (B_TRUE);
}
}
/*
* Issue an SIOCGLIFCONF down to IP and return the result in `lifcp'.
* lifcp->lifc_buf is dynamically allocated to be *bufsizep bytes.
*/
static int
{
int err;
int nifs;
return (err);
/*
* Pad the interface count to account for additional interfaces that
* may have been configured between the SIOCGLIFNUM and SIOCGLIFCONF.
*/
nifs += 4;
return (ENOMEM);
if (err != 0) {
return (err);
}
return (0);
}
void
{
void *addr;
int err = 0;
goto done;
}
case SIOCGIFNUM: {
break;
retval++;
}
}
break;
}
case O_SIOCGIFCONF:
case SIOCGIFCONF: {
int ubuf_size;
int i, nifs;
break;
break;
}
/*
* Skip entries that are impossible to return with
* SIOCGIFCONF, or not RDS-capable.
*/
continue;
}
IFNAMSIZ);
ifrp++;
}
break;
}
case SIOCGIFMTU:
case SIOCGIFFLAGS:
addr);
break;
case TI_GETMYNAME: {
int addrlen;
B_TRUE);
return;
}
break;
default:
err = EOPNOTSUPP;
break;
}
if (err == 0) {
mi_copyout(q, mp);
return;
}
done:
}
void
{
int copyin_size;
return;
}
case O_SIOCGIFCONF:
case SIOCGIFCONF:
else
break;
case SIOCGIFNUM:
copyin_size = sizeof (int);
break;
case SIOCGIFFLAGS:
case SIOCGIFMTU:
copyin_size = sizeof (struct ifreq);
break;
case TI_GETMYNAME:
break;
}
}
void
{
case O_SIOCGIFCONF:
case SIOCGIFCONF:
case SIOCGIFNUM:
case SIOCGIFMTU:
case SIOCGIFFLAGS:
case TI_GETMYNAME:
rds_ioctl_copyin_setup(q, mp);
break;
default:
break;
}
}
{
int i, nifs;
struct sockaddr_in *sinp;
return (B_FALSE);
if (rds_capable_interface(lifrp) &&
break;
}
}
return (retval);
}