/*
* 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
*/
/*
*/
#include <errno.h>
#include <fcntl.h>
#include <priv_utils.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <zone.h>
#include <libipadm.h>
#include <libdladm.h>
#include <libdllink.h>
#include <errno.h>
#include <string.h>
#include <libinetutil.h>
#include <unistd.h>
#include <libipadm_impl.h>
#define ROUNDUP_LONG(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof (long) - 1))) : sizeof (long))
typedef struct ngz_walk_data_s {
char *ngz_ifname;
/*
* Tell the kernel to add, delete or change a route
*/
static void
int action, /* RTM_DELETE, etc */
char *ifname,
int flags)
{
static int rt_sock_seqno = 0;
struct {
} w;
long cc;
(void) memset(&w, 0, sizeof (w));
}
} else {
return;
}
}
if (cc < 0) {
action == RTM_DELETE)) {
if (action == RTM_CHANGE) {
goto again;
}
return;
}
return;
return;
}
}
static void
int action, /* RTM_DELETE, etc */
char *ifname,
int flags)
{
static int rt_sock_seqno = 0;
struct {
} w;
long cc;
(void) memset(&w, 0, sizeof (w));
if (prefix_length == IPV6_ABITS) {
} else {
return;
}
w.w_rtm.rtm_msglen +=
ROUNDUP_LONG(sizeof (struct sockaddr_in6));
}
if (cc < 0) {
action == RTM_DELETE)) {
if (action == RTM_CHANGE) {
goto again;
}
return;
}
return;
return;
}
}
/*
* Return TRUE if running in a Solaris 10 Container.
*/
static boolean_t
{
return (B_FALSE);
}
/*
* Configure addresses on link. `buf' is a string of comma-separated
* IP addresses.
*/
static ipadm_status_t
{
char *cp;
&ipaddr);
if (ipstatus != IPADM_SUCCESS)
return (ipstatus);
/*
* ipadm_set_addr does the appropriate name resolution and
* sets up the ipadm_static_addr field.
*/
if (ipstatus != IPADM_SUCCESS) {
return (ipstatus);
}
(IPADM_OPT_ACTIVE | IPADM_OPT_UP));
if (ipstatus != IPADM_SUCCESS) {
return (ipstatus);
}
}
return (IPADM_SUCCESS);
}
/*
* The (*persist_if)() will set up persistent information for the interface,
* based on what interface families are required, so just resolve the
* address and inform the callback about the linkname, and required address
* families.
*/
static ipadm_status_t
{
/* remove the /<masklen> that's always added by zoneadmd */
/* resolve the address to find the family */
if (ipstatus != IPADM_SUCCESS)
return (ipstatus);
case AF_INET:
break;
case AF_INET6:
break;
default:
return (IPADM_BAD_ADDR);
}
}
return (IPADM_SUCCESS);
}
static void
{
if (rtsock == -1)
return;
if (IN6_IS_ADDR_UNSPECIFIED(&defrouter))
break;
if (isv6) {
} else {
}
}
}
/*
* Wrapper function to zone_getattr() for retrieving from-gz attributes that
* were made availabe for exclusive IP non-global zones by zoneadmd from teh
* global zone.
*/
static ipadm_status_t
{
return (IPADM_NO_MEMORY);
return (ipadm_errno2status(errno));
}
return (IPADM_SUCCESS);
}
/*
* Callback function that configures a single datalink in a non-global zone.
*/
static int
{
if (ipstatus != IPADM_SUCCESS)
goto fail;
if (dlstatus != DLADM_STATUS_OK)
return (DLADM_WALK_CONTINUE);
/*
* if ifname has been specified, then skip interfaces that don't match
*/
return (DLADM_WALK_CONTINUE);
/*
* Plumb the interface and configure addresses on for S10 Containers.
* We need to always do this for S10C because ipadm persistent
* configuration is not available in S10C. For ipkg zones,
* we skip the actual plumbing/configuration, but will call the
* (*ngz_persist_if)() callback to create the persistent state for the
* interface. The interface will be configured in ipkg zones when
* ipadm_enable_if() is invoked to restore persistent configuration.
*/
if (is_ipmgmtd && !s10c) {
return (DLADM_WALK_CONTINUE);
}
if (ipstatus != IPADM_SUCCESS)
goto fail;
/* apply any default router information. */
if (ipstatus != IPADM_SUCCESS)
goto fail;
return (DLADM_WALK_CONTINUE);
fail:
return (DLADM_WALK_TERMINATE);
}
return (DLADM_WALK_CONTINUE);
}
/*
* ipmgmt_net_from_gz_init() initializes exclusive-IP stack non-global zones by
* extracting configuration that has been saved in the kernel and applying
* that information to the appropriate datalinks for the zone. If an ifname
* argument is passed in, only the selected IP interface corresponding to
* datalink will be initialized, otherwise all datalinks will be plumbed for IP
* and IP address and route information will be configured.
*/
{
return (IPADM_NOTSUP);
return (IPADM_ENXIO);
return (IPADM_SUCCESS); /* nothing to initialize */
NULL) != DLADM_STATUS_OK) {
return (IPADM_ENXIO);
}
} else {
}
return (nwd.ngz_ipstatus);
}