/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <errno.h>
#include <libinetutil.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Create a list of the addresses on physical interface `ifname' with at least
* one of the flags in `set' set and all of the flags in `clear' clear.
* Return the number of items in the list, or -1 on failure.
*/
int
{
char *cp;
int save_errno;
/*
* We need both IPv4 and IPv6 sockets to query both IPv4 and IPv6
* interfaces below.
*/
goto fail;
}
/*
* Get the number of network interfaces of type `family'.
*/
goto fail;
/*
* Pad the interface count to detect when additional interfaces have
* been configured between SIOCGLIFNUM and SIOCGLIFCONF.
*/
goto fail;
goto fail;
/*
* If every lifr_req slot is taken, then additional interfaces must
* have been plumbed between the SIOCGLIFNUM and the SIOCGLIFCONF.
* Recalculate to make sure we didn't miss any interfaces.
*/
goto again;
/*
* Populate the ifaddrlistx by querying each matching interface. If a
* query ioctl returns ENXIO, then the interface must have been
* removed after the SIOCGLIFCONF completed -- so we just ignore it.
*/
*cp = '\0';
continue;
*cp = ':';
continue;
goto fail;
}
continue;
/*
* We've got a match; allocate a new record.
*/
goto fail;
naddr++;
}
return (naddr);
fail:
save_errno = errno;
errno = save_errno;
return (-1);
}
/*
* Free the provided ifaddrlistx_t.
*/
void
{
}
}