linkprop.c revision e75f0919bf9ec317db5c7166d0aaf1eed11debdb
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * CDDL HEADER START
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * The contents of this file are subject to the terms of the
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * Common Development and Distribution License (the "License").
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * You may not use this file except in compliance with the License.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * See the License for the specific language governing permissions
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * and limitations under the License.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * When distributing Covered Code, include this CDDL HEADER in each
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * If applicable, add the following below this CDDL HEADER, with the
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * fields enclosed by brackets "[]" replaced with your own identifying
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * information: Portions Copyright [yyyy] [name of copyright owner]
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * CDDL HEADER END
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * Use is subject to license terms.
#include <fcntl.h>
#include <unistd.h>
#include <libdevinfo.h>
#include <zone.h>
#include <libdllink.h>
#include <libdladm_impl.h>
#include <libdlwlan_impl.h>
#include <libdlwlan.h>
#include <libdlvlan.h>
#include <libdlvnic.h>
#include <libintl.h>
#include <dlfcn.h>
#include <link.h>
#include <libdladm.h>
#include <libdlstat.h>
#include <inttypes.h>
struct prop_desc;
typedef struct link_attr_s {
char *pp_name;
} link_attr_t;
uint_t);
struct prop_desc {
char *pd_name;
NULL, 0,
DL_ETHER }
sizeof (resource_prop_t))
const char *, char **, uint_t);
const char *, char **, uint_t *);
datalink_id_t, const char *, void *));
static dladm_status_t
for (j = 0; j < val_cnt; j++) {
goto done;
done:
return (status);
static dladm_status_t
return (DLADM_STATUS_BADARG);
return (DLADM_STATUS_BADARG);
return (DLADM_STATUS_TEMPONLY);
return (DLADM_STATUS_OK);
return (DLADM_STATUS_PROPRDONLY);
return (DLADM_STATUS_NOMEM);
goto done;
return (DLADM_STATUS_NOTSUP);
return (DLADM_STATUS_NOMEM);
if (defval) {
sizeof (val_desc_t));
goto done;
return (status);
if (needfree) {
for (i = 0; i < cnt; i++)
done:
return (status);
static dladm_status_t
NULL, 0);
return (status);
for (i = 0; i < DLADM_MAX_PROPS; i++) {
status = s;
if (s != DLADM_STATUS_OK &&
s != DLADM_STATUS_NOTSUP)
status = s;
if (!found) {
return (status);
return (DLADM_STATUS_BADARG);
return (status);
return (status);
return (DLADM_STATUS_BADARG);
NULL, 0);
return (status);
for (i = 0; i < DLADM_MAX_PROPS; i++) {
return (status);
return (DLADM_STATUS_BADARG);
for (i = 0; i < DLADM_MAX_PROPS; i++)
if (i == DLADM_MAX_PROPS) {
dld_flags));
return (DLADM_STATUS_NOTFOUND);
NULL, 0);
return (status);
return (DLADM_STATUS_BADARG);
return (DLADM_STATUS_BADARG);
switch (type) {
case DLADM_PROP_VAL_CURRENT:
case DLADM_PROP_VAL_PERM:
case DLADM_PROP_VAL_DEFAULT:
if (cnt == 0) {
for (i = 0; i < cnt; i++) {
return (DLADM_STATUS_TEMPONLY);
return (status);
return (DLADM_WALK_CONTINUE);
for (i = 0; i < valcnt; i++) {
sizeof (char *) * DLADM_MAX_PROP_VALCNT +
i * DLADM_PROP_VAL_MAX;
goto done;
done:
return (DLADM_WALK_CONTINUE);
NULL, 0);
return (DLADM_WALK_TERMINATE);
return (DLADM_WALK_CONTINUE);
} else if (any_media ||
0) == DLADM_STATUS_OK) &&
return (DLADM_STATUS_OK);
static dladm_status_t
char *cp;
if (flags != 0)
return (DLADM_STATUS_NOTSUP);
return (status);
return (DLADM_STATUS_OK);
void *dlhandle;
void *sym;
int ret;
return (ret);
static dladm_status_t
int ret;
goto cleanup;
if (add)
if (ret != 0) {
goto cleanup;
if (prof)
return (status);
static dladm_status_t
char *cp;
return (DLADM_STATUS_BADVALCNT);
return (status);
return (status);
return (status);
goto rollback1;
B_FALSE);
goto rollback2;
goto rollback2;
return (DLADM_STATUS_OK);
return (status);
static dladm_status_t
char *zone_name;
return (DLADM_STATUS_BADVALCNT);
return (DLADM_STATUS_NOMEM);
goto done;
goto done;
goto done;
sizeof (flags)) < 0) {
goto done;
goto done;
return (DLADM_STATUS_OK);
done:
return (status);
static dladm_status_t
return (status);
return (DLADM_STATUS_OK);
static dladm_status_t
return (DLADM_STATUS_BADVALCNT);
return (DLADM_STATUS_NOMEM);
return (status);
return (DLADM_STATUS_MINMAXBW);
return (DLADM_STATUS_OK);
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
return (DLADM_STATUS_TOOSMALL);
if (ncpus == 0) {
return (DLADM_STATUS_OK);
for (i = 0; i < ncpus; i++) {
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
case MAC_PROP_MAXBW:
case MAC_PROP_PRIO:
return (DLADM_STATUS_BADARG);
case MAC_PROP_MAXBW:
sizeof (uint64_t));
case MAC_PROP_PRIO:
sizeof (mac_priority_level_t));
return (DLADM_STATUS_BADARG);
return (status);
static dladm_status_t
return (status);
return (status);
return (status);
static dladm_status_t
int i, j, rc;
return (DLADM_STATUS_NOMEM);
for (i = 0; i < val_cnt; i++) {
errno = 0;
return (DLADM_STATUS_CPUMAX);
return (DLADM_STATUS_CPUERR);
return (DLADM_STATUS_CPUNOTONLINE);
for (i = 0; i < val_cnt; i++) {
for (j = 0; j < val_cnt; j++) {
return (DLADM_STATUS_BADARG);
return (DLADM_STATUS_OK);
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
return (DLADM_STATUS_OK);
static dladm_status_t
return (DLADM_STATUS_BADVALCNT);
return (DLADM_STATUS_NOMEM);
return (status);
return (DLADM_STATUS_BADVAL);
return (DLADM_STATUS_OK);
sizeof (mac_priority_level_t));
return (DLADM_STATUS_OK);
static dladm_status_t
int i, len;
return (DLADM_STATUS_NOTDEFINED);
return (DLADM_STATUS_OK);
done:
return (DLADM_STATUS_OK);
return (DLADM_STATUS_BADVAL);
return (DLADM_STATUS_BADVAL);
return (DLADM_STATUS_BADVAL);
return (DLADM_STATUS_OK);
return (DLADM_STATUS_BADVALCNT);
return (DLADM_STATUS_OK);
static dladm_status_t
char *module;
return (DLADM_STATUS_BADVALCNT);
return (DLADM_STATUS_NOMEM);
return (status);
return (DLADM_STATUS_OK);
static dladm_status_t
uint_t i;
return (DLADM_STATUS_NOMEM);
B_FALSE);
goto done;
goto done;
goto done;
done:
return (status);
static dladm_status_t
static dladm_status_t
switch (media) {
case DL_ETHER:
return (DLADM_STATUS_NOTSUP);
case DL_WIFI:
return (DLADM_STATUS_BADARG);
static dladm_status_t
return (DLADM_STATUS_NOMEM);
return (status);
static dladm_status_t
return (DLADM_STATUS_PROPRDONLY);
return (DLADM_STATUS_BADVALCNT);
done:
return (status);
static dladm_status_t
return (DLADM_STATUS_BADVALCNT);
goto done;
for (i = 0; i < MAX_SUPPORT_RATES; i++) {
i * DLADM_STRSIZE;
goto done;
for (i = 0; i < modval_cnt; i++) {
if (i == modval_cnt)
done:
return (status);
static dladm_status_t
int buflen)
static dladm_status_t
!= DLADM_STATUS_OK)
goto done;
goto done;
done:
return (status);
static dladm_status_t
int buflen)
static dladm_status_t
!= DLADM_STATUS_OK)
goto done;
case WL_PM_AM:
case WL_PM_MPS:
case WL_PM_FAST:
goto done;
done:
return (status);
static dladm_status_t
switch (*pm) {
case DLADM_WLAN_PM_OFF:
case DLADM_WLAN_PM_MAX:
case DLADM_WLAN_PM_FAST:
return (DLADM_STATUS_NOTSUP);
static dladm_status_t
return (DLADM_STATUS_BADVALCNT);
return (status);
static dladm_status_t
static dladm_status_t
!= DLADM_STATUS_OK)
goto done;
switch (radio) {
case B_TRUE:
case B_FALSE:
goto done;
done:
return (status);
static dladm_status_t
wl_radio_t r;
switch (*radio) {
case DLADM_WLAN_RADIO_ON:
r = B_TRUE;
case DLADM_WLAN_RADIO_OFF:
r = B_FALSE;
return (DLADM_STATUS_NOTSUP);
sizeof (r), B_TRUE));
static dladm_status_t
return (DLADM_STATUS_BADVALCNT);
return (status);
static dladm_status_t
return (status);
if (val_cnt == 0) {
goto done;
for (i = 0; i < val_cnt; i++) {
buf);
done:
return (status);
static dladm_status_t
return (status);
goto done;
goto done;
done:
return (status);
static dladm_status_t
return (DLADM_STATUS_BADARG);
return (status);
return (DLADM_STATUS_OK);
static link_attr_t *
link_attr_t *p;
static link_attr_t *
link_attr_t *p;
static dld_ioc_macprop_t *
int dsize;
return (NULL);
return (dip);
static dld_ioc_macprop_t *
link_attr_t *p;
static dld_ioc_macprop_t *
link_attr_t *p;
static dladm_status_t
void *val;
return (status);
done:
return (status);
return (status);
static dld_ioc_macprop_t *
return (NULL);
return (NULL);
return (dip);
static dladm_status_t
return (DLADM_STATUS_BADVAL);
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
switch (link_duplex) {
case LINK_DUPLEX_FULL:
case LINK_DUPLEX_HALF:
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
switch (link_state) {
case LINK_STATE_UP:
case LINK_STATE_DOWN:
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
return (DLADM_STATUS_OK);
static dladm_status_t
uint32_t v = 0;
return (status);
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
switch (mode) {
case LINK_TAGMODE_NORMAL:
case LINK_TAGMODE_VLANONLY:
return (DLADM_STATUS_OK);
static dladm_status_t
return (status);
case LINK_FLOWCTRL_NONE:
case LINK_FLOWCTRL_RX:
case LINK_FLOWCTRL_TX:
case LINK_FLOWCTRL_BI:
return (DLADM_STATUS_OK);
static dladm_status_t
int i, slen;
int bufsize = 0;
link_attr_t *p;
return (DLADM_STATUS_BADARG);
return (DLADM_STATUS_BADARG);
for (i = 0; i < val_cnt; i++) {
return (status);
slen = 0;
for (i = 0; i < val_cnt; i++) {
int plen = 0;
return (status);
static dladm_status_t
link_attr_t *p;
return (DLADM_STATUS_BADARG);
return (DLADM_STATUS_BADARG);
return (status);
return (status);
static dladm_status_t
bufsize =
for (i = 0; i < DLADM_MAX_PROP_VALCNT; i++) {
sizeof (char *) * DLADM_MAX_PROP_VALCNT +
i * DLADM_PROP_VAL_MAX;
return (status);
switch (wl_prop) {
case MAC_PROP_WL_ESSID:
return (WL_ESSID);
case MAC_PROP_WL_BSSID:
return (WL_BSSID);
case MAC_PROP_WL_BSSTYPE:
return (WL_BSS_TYPE);
case MAC_PROP_WL_LINKSTATUS:
return (WL_LINKSTATUS);
return (WL_DESIRED_RATES);
return (WL_SUPPORTED_RATES);
case MAC_PROP_WL_AUTH_MODE:
return (WL_AUTH_MODE);
case MAC_PROP_WL_ENCRYPTION:
return (WL_ENCRYPTION);
case MAC_PROP_WL_RSSI:
return (WL_RSSI);
case MAC_PROP_WL_PHY_CONFIG:
return (WL_PHY_CONFIG);
case MAC_PROP_WL_CAPABILITY:
return (WL_CAPABILITY);
case MAC_PROP_WL_WPA:
return (WL_WPA);
case MAC_PROP_WL_SCANRESULTS:
return (WL_SCANRESULTS);
case MAC_PROP_WL_POWER_MODE:
return (WL_POWER_MODE);
case MAC_PROP_WL_RADIO:
return (WL_RADIO);
case MAC_PROP_WL_ESS_LIST:
return (WL_ESS_LIST);
case MAC_PROP_WL_KEY_TAB:
return (WL_WEP_KEY_TAB);
case MAC_PROP_WL_CREATE_IBSS:
return (WL_CREATE_IBSS);
case MAC_PROP_WL_SETOPTIE:
return (WL_SETOPTIE);
case MAC_PROP_WL_DELKEY:
return (WL_DELKEY);
case MAC_PROP_WL_KEY:
return (WL_KEY);
case MAC_PROP_WL_MLME:
return (WL_MLME);
void *dp;
return (status);
return (DLADM_STATUS_BADARG);
return (DLADM_STATUS_TEMPONLY);
return (DLADM_STATUS_NOMEM);
if (set)
if (set) {
if (!set)
return (status);
static dladm_status_t
return (DLADM_STATUS_NOMEM);
return (status);
static dladm_status_t
return (DLADM_STATUS_NOMEM);
return (status);
return (DLADM_WALK_CONTINUE);
return (status);
static dladm_status_t
return (DLADM_STATUS_OK);
for (i = 0; i < DLADM_MAX_PROPS; i++) {
return (DLADM_STATUS_NOMEM);
return (DLADM_STATUS_BADARG);
return (status);
for (j = 0; j < DLADM_MAX_RSRC_PROP; j++) {
return (status);
return (status);
mrp);
return (status);
mrp);
return (status);
mrp);
return (status);
return (status);
return (buf);
&perms);
return (status);
return (status);
const char *nonprop[] = {
return (!is_nonprop);