/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <dhcp_impl.h>
#include <netinet/inetutil.h>
#include <sys/systeminfo.h>
#include <strings.h>
#include <libdevinfo.h>
#include <sys/isa_defs.h>
#include <unistd.h>
#include <fcntl.h>
#include <netdb.h>
#include <alloca.h>
#include <stdio.h>
#include <bootinfo.h>
#include <bootinfo_aux.h>
/*
* Callback structure used when walking the device tree.
*/
typedef struct {
} cb_t;
/*
* Handles on devinfo stuff.
*/
/*
* Root filesystem type string.
*/
/*
* Handles on DHCP's packet list and interface-name.
*/
/*
* Deallocate dhcp_pl.
*/
static void
dhcp_info_end(void)
{
}
dhcp_ifn[0] = '\0';
}
/*
* Determine whether the kernel has a cached DHCP ACK, and if so
* initialize dhcp_pl and dhcp_ifn.
*/
static boolean_t
dhcp_info_init(void)
{
char dummy;
long dhcacksz;
char *ackp;
/*
* See whether the kernel has a cached DHCP ACK, and if so get it.
* If there is no DHCP ACK, then the returned length is equal to
* the size of an empty string.
*/
sizeof (dummy))) == sizeof ("")) {
return (B_TRUE);
}
goto cleanup;
}
goto cleanup;
}
/*
* The first IFNAMSIZ bytes are reserved for the interface name;
* the ACK follows.
*/
/*
* Convert and scan the options.
*/
goto cleanup;
}
goto cleanup;
}
goto cleanup;
}
/*
* Set the interface-name.
*/
if (!ret) {
}
}
return (ret);
}
/*
* Deallocate devinfo stuff.
*/
static void
destroy_snapshot(void)
{
if (phdl != DI_PROM_HANDLE_NIL) {
}
if (root_node != DI_NODE_NIL) {
}
}
/*
* Take a snapshot of the device tree, i.e. get a devinfo handle and
* a PROM handle.
*/
static boolean_t
snapshot_devtree(void)
{
/*
* Deallocate any existing devinfo stuff first.
*/
return (B_FALSE);
}
return (B_TRUE);
}
/*
* Get the value of the named property on the named node in root.
*/
static char *
{
int len;
/*
* Locate nodename within '/'.
*/
node != DI_NODE_NIL;
break;
}
}
if (node == DI_NODE_NIL) {
return (NULL);
}
/*
* Scan all properties of /nodename for the 'propname' property.
*/
pp != DI_PROM_PROP_NIL;
break;
}
}
if (pp == DI_PROM_PROP_NIL) {
return (NULL);
}
/*
* Found the property; copy out its length and return its value.
*/
}
return (val);
}
/*
* Strip any trailing arguments from a device path.
* Returned memory must be freed by caller.
*/
static char *
{
char *p;
*p = '\0';
}
}
return (stripped_path);
}
/*
* Return the "bootpath" property (sans arguments) from /chosen.
* Returned memory must be freed by caller.
*/
static char *
get_bootpath(void)
{
char *path;
}
/*
* Return the "net" property (sans arguments) from /aliases.
* Returned memory must be freed by caller.
*/
static char *
get_netalias(void)
{
char *path;
}
/*
* Callback used by path2node().
*/
static int
{
}
return (ret);
}
/*
* Map a device path to its matching di_node_t.
*/
static di_node_t
{
}
/*
* Check whether node corresponds to a network device.
*/
static boolean_t
{
char *type;
}
/*
* Initialise bootmisc with the rootfs-type.
*/
static boolean_t
rootfs_type_init(void)
{
}
}
}
/*
* Initialise bootmisc with the interface-name of the primary network device,
* and the net-config-strategy employed in configuring that device.
*/
static boolean_t
{
}
/*
* Determine whether the interface was configured manually.
*/
static boolean_t
manual_if_init(void)
{
char *ncs;
char *devpath;
int instance;
char *drvname;
/*
* If net-config-strategy isn't "manual", don't go any further.
*/
return (B_FALSE);
}
/*
* First check the 'bootpath' property of /chosen to see whether
* it specifies the path of a network device; if so, use this.
*/
!is_network_device(node)) {
/*
* Must have been booted from CD-ROM or disk; attempt to
* use the path defined by the 'net' property of /aliases.
*/
!is_network_device(node)) {
goto cleanup;
}
}
/*
* Get the driver name and instance number of this node.
* We may have to load the driver.
*/
goto cleanup;
}
/*
* Attempt to load the driver, create a new snapshot of the
* (possibly changed) device tree and re-compute our node.
*/
if (!snapshot_devtree() ||
goto cleanup;
}
}
}
/*
* Construct the interface name.
*/
if (instance == -1) {
} else {
}
return (ret);
}
/*
* Determine whether the interface was configured via DHCP.
*/
static boolean_t
dhcp_if_init(void)
{
}
static boolean_t
bootmisc_init(void)
{
return (rootfs_type_init() &&
(manual_if_init() || dhcp_if_init()));
}
/*
* Functions dealing with bootinfo initialization/cleanup.
*/
bi_init_bootinfo(void)
{
return (B_TRUE);
}
return (B_FALSE);
}
void
bi_end_bootinfo(void)
{
}
/*
* Function dealing with /chosen data.
*/
{
char *val;
return (B_FALSE);
}
}
return (B_TRUE);
}
/*
* Function dealing with DHCP data.
*/
{
return (dhcp_getinfo_pl(dhcp_pl,
}