summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/cmd/cmd-inet/lib/nwamd/ncu.c9
-rw-r--r--usr/src/cmd/dladm/dladm.c35
-rw-r--r--usr/src/cmd/dlmgmtd/dlmgmt_db.c26
-rw-r--r--usr/src/cmd/dlmgmtd/dlmgmt_util.c7
-rw-r--r--usr/src/lib/libdladm/common/libdlmgmt.c17
-rw-r--r--usr/src/uts/common/io/mac/mac_provider.c4
-rw-r--r--usr/src/uts/common/sys/dls_mgmt.h2
7 files changed, 73 insertions, 27 deletions
diff --git a/usr/src/cmd/cmd-inet/lib/nwamd/ncu.c b/usr/src/cmd/cmd-inet/lib/nwamd/ncu.c
index 439ae35f35..52d03076f7 100644
--- a/usr/src/cmd/cmd-inet/lib/nwamd/ncu.c
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/ncu.c
@@ -37,6 +37,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <values.h>
+#include <zone.h>
#include "conditions.h"
#include "events.h"
@@ -1562,6 +1563,8 @@ void
nwamd_walk_physical_configuration(void)
{
nwam_ncp_handle_t ncph;
+ datalink_class_t dlclass = DATALINK_CLASS_PHYS;
+ zoneid_t zoneid = getzoneid();
(void) pthread_mutex_lock(&active_ncp_mutex);
if (strcmp(active_ncp, NWAM_NCP_NAME_AUTOMATIC) == 0 &&
@@ -1580,9 +1583,13 @@ nwamd_walk_physical_configuration(void)
NWAM_FLAG_NCU_TYPE_LINK, NULL);
}
+ /* In non-global zones NWAM can support VNICs */
+ if (zoneid != GLOBAL_ZONEID)
+ dlclass |= DATALINK_CLASS_VNIC;
+
/* create NCUs for interfaces without NCUs */
(void) dladm_walk(ncu_create_link_action_event, dld_handle, ncph,
- DATALINK_CLASS_PHYS, DATALINK_ANY_MEDIATYPE, DLADM_OPT_ACTIVE);
+ dlclass, DATALINK_ANY_MEDIATYPE, DLADM_OPT_ACTIVE);
if (strcmp(active_ncp, NWAM_NCP_NAME_AUTOMATIC) != 0 ||
active_ncph == NULL) {
diff --git a/usr/src/cmd/dladm/dladm.c b/usr/src/cmd/dladm/dladm.c
index c6c19724a4..8efdb32d0e 100644
--- a/usr/src/cmd/dladm/dladm.c
+++ b/usr/src/cmd/dladm/dladm.c
@@ -6580,8 +6580,15 @@ print_linkprop_cb(ofmt_arg_t *ofarg, char *buf, uint_t bufsize)
* the persistent value of a non-persistable link property,
* simply skip the output.
*/
- if (statep->ls_status != DLADM_STATUS_OK)
+ if (statep->ls_status != DLADM_STATUS_OK) {
+ /*
+ * Ignore the temponly error when we skip printing
+ * link properties to avoid returning failure on exit.
+ */
+ if (statep->ls_retstatus == DLADM_STATUS_TEMPONLY)
+ statep->ls_retstatus = DLADM_STATUS_OK;
goto skip;
+ }
ptr = statep->ls_line;
break;
case LINKPROP_PERM:
@@ -7230,8 +7237,6 @@ audit_secobj(char *auth, char *class, char *obj,
(void) adt_end_session(ah);
}
-#define MAX_SECOBJS 32
-#define MAX_SECOBJ_NAMELEN 32
static void
do_create_secobj(int argc, char **argv, const char *use)
{
@@ -7370,19 +7375,17 @@ do_delete_secobj(int argc, char **argv, const char *use)
}
}
- if (optind == (argc - 1)) {
- token = argv[optind];
- if (token == NULL)
- die("secure object name required");
- while ((c = *token++) != NULL) {
- if (c == ',')
- nfields++;
- }
- token = strdup(argv[optind]);
- if (token == NULL)
- die("no memory");
- } else if (optind != argc)
- usage();
+ if (optind != (argc - 1))
+ die("secure object name required");
+
+ token = argv[optind];
+ while ((c = *token++) != NULL) {
+ if (c == ',')
+ nfields++;
+ }
+ token = strdup(argv[optind]);
+ if (token == NULL)
+ die("no memory");
success = check_auth(LINK_SEC_AUTH);
audit_secobj(LINK_SEC_AUTH, "unknown", argv[optind], success, B_FALSE);
diff --git a/usr/src/cmd/dlmgmtd/dlmgmt_db.c b/usr/src/cmd/dlmgmtd/dlmgmt_db.c
index 7cb9e2ce78..99307dbc03 100644
--- a/usr/src/cmd/dlmgmtd/dlmgmt_db.c
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_db.c
@@ -814,6 +814,12 @@ parse_linkprops(char *buf, dlmgmt_link_t *linkp)
curr = buf + i + 1;
}
+ /* Correct any erroneous IPTUN datalink class constant in the file */
+ if (linkp->ll_class == 0x60) {
+ linkp->ll_class = DATALINK_CLASS_IPTUN;
+ rewrite_needed = B_TRUE;
+ }
+
return (0);
parse_fail:
@@ -1119,8 +1125,8 @@ process_db_read(dlmgmt_db_req_t *req, FILE *fp)
}
link_in_file.ll_zoneid = req->ls_zoneid;
- link_in_db = avl_find(&dlmgmt_name_avl, &link_in_file,
- &name_where);
+ link_in_db = link_by_name(link_in_file.ll_link,
+ link_in_file.ll_zoneid);
if (link_in_db != NULL) {
/*
* If the link in the database already has the flag
@@ -1166,9 +1172,13 @@ process_db_read(dlmgmt_db_req_t *req, FILE *fp)
newlink->ll_linkid = dlmgmt_nextlinkid;
if (avl_find(&dlmgmt_id_avl, newlink, &id_where) !=
NULL) {
+ dlmgmt_log(LOG_WARNING, "Link ID %d is already"
+ " in use, destroying link %s",
+ newlink->ll_linkid, newlink->ll_link);
link_destroy(newlink);
continue;
}
+
if ((req->ls_flags & DLMGMT_ACTIVE) &&
link_activate(newlink) != 0) {
dlmgmt_log(LOG_WARNING, "Unable to activate %s",
@@ -1176,8 +1186,18 @@ process_db_read(dlmgmt_db_req_t *req, FILE *fp)
link_destroy(newlink);
continue;
}
- avl_insert(&dlmgmt_name_avl, newlink, name_where);
+
avl_insert(&dlmgmt_id_avl, newlink, id_where);
+ /*
+ * link_activate call above can insert newlink in
+ * dlmgmt_name_avl tree when activating a link that is
+ * assigned to a NGZ.
+ */
+ if (avl_find(&dlmgmt_name_avl, newlink,
+ &name_where) == NULL)
+ avl_insert(&dlmgmt_name_avl, newlink,
+ name_where);
+
dlmgmt_advance(newlink);
newlink->ll_flags |= req->ls_flags;
}
diff --git a/usr/src/cmd/dlmgmtd/dlmgmt_util.c b/usr/src/cmd/dlmgmtd/dlmgmt_util.c
index 96b2b3b826..004c8f257b 100644
--- a/usr/src/cmd/dlmgmtd/dlmgmt_util.c
+++ b/usr/src/cmd/dlmgmtd/dlmgmt_util.c
@@ -367,7 +367,7 @@ int
link_activate(dlmgmt_link_t *linkp)
{
int err = 0;
- zoneid_t zoneid;
+ zoneid_t zoneid = ALL_ZONES;
if (zone_check_datalink(&zoneid, linkp->ll_linkid) == 0) {
/*
@@ -379,7 +379,10 @@ link_activate(dlmgmt_link_t *linkp)
err = EEXIST;
goto done;
}
- avl_remove(&dlmgmt_name_avl, linkp);
+
+ if (avl_find(&dlmgmt_name_avl, linkp, NULL) != NULL)
+ avl_remove(&dlmgmt_name_avl, linkp);
+
linkp->ll_zoneid = zoneid;
avl_add(&dlmgmt_name_avl, linkp);
avl_add(&dlmgmt_loan_avl, linkp);
diff --git a/usr/src/lib/libdladm/common/libdlmgmt.c b/usr/src/lib/libdladm/common/libdlmgmt.c
index 49c70b4c6e..4b0753417c 100644
--- a/usr/src/lib/libdladm/common/libdlmgmt.c
+++ b/usr/src/lib/libdladm/common/libdlmgmt.c
@@ -56,7 +56,8 @@ dladm_door_call(dladm_handle_t handle, void *arg, size_t asize, void *rbuf,
{
door_arg_t darg;
int door_fd;
- dladm_status_t status = DLADM_STATUS_OK;
+ dladm_status_t status;
+ boolean_t reopen = B_FALSE;
darg.data_ptr = arg;
darg.data_size = asize;
@@ -65,11 +66,23 @@ dladm_door_call(dladm_handle_t handle, void *arg, size_t asize, void *rbuf,
darg.rbuf = rbuf;
darg.rsize = *rsizep;
+reopen:
/* The door descriptor is opened if it isn't already */
if ((status = dladm_door_fd(handle, &door_fd)) != DLADM_STATUS_OK)
return (status);
- if (door_call(door_fd, &darg) == -1)
+ if (door_call(door_fd, &darg) == -1) {
+ /*
+ * Stale door descriptor is possible if dlmgmtd was re-started
+ * since last door_fd open so try re-opening door file.
+ */
+ if (!reopen && errno == EBADF) {
+ (void) close(handle->door_fd);
+ handle->door_fd = -1;
+ reopen = B_TRUE;
+ goto reopen;
+ }
status = dladm_errno2status(errno);
+ }
if (status != DLADM_STATUS_OK)
return (status);
diff --git a/usr/src/uts/common/io/mac/mac_provider.c b/usr/src/uts/common/io/mac/mac_provider.c
index 98faffef47..2c9affa22e 100644
--- a/usr/src/uts/common/io/mac/mac_provider.c
+++ b/usr/src/uts/common/io/mac/mac_provider.c
@@ -1357,10 +1357,10 @@ mac_prop_info_set_default_str(mac_prop_info_handle_t ph, const char *str)
if (pr->pr_default == NULL)
return;
- if (strlen(str) > pr->pr_default_size)
+ if (strlen(str) >= pr->pr_default_size)
pr->pr_errno = ENOBUFS;
else
- (void) strlcpy(pr->pr_default, str, strlen(str));
+ (void) strlcpy(pr->pr_default, str, pr->pr_default_size);
pr->pr_flags |= MAC_PROP_INFO_DEFAULT;
}
diff --git a/usr/src/uts/common/sys/dls_mgmt.h b/usr/src/uts/common/sys/dls_mgmt.h
index 8cf04ea9f7..b4032c24d6 100644
--- a/usr/src/uts/common/sys/dls_mgmt.h
+++ b/usr/src/uts/common/sys/dls_mgmt.h
@@ -45,7 +45,7 @@ typedef enum {
DATALINK_CLASS_ETHERSTUB = 0x10,
DATALINK_CLASS_SIMNET = 0x20,
DATALINK_CLASS_BRIDGE = 0x40,
- DATALINK_CLASS_IPTUN = 0x60,
+ DATALINK_CLASS_IPTUN = 0x80,
DATALINK_CLASS_PART = 0x100
} datalink_class_t;