Mercurial > illumos > illumos-gate
changeset 12965:7a5c324190b8
6936702 dlmgmtd restart in global zone leaves exclusive stack zones in down state
6942573 stale dlmgmtd door handle may result in unusable networking features
6938483 NWAM should not ignore VNICs in non-global zones
6931751 DATALINK_CLASS_IPTUN should be 0x80 not 0x60
6939454 dladm show_linkprop -p <private property> truncates DEFAULT value by one character
6928716 dladm delete-secobj passing uninitialized memory
6896251 dladm show-linkprop -P always exits with 1
author | Rishi Srivatsavai <Rishi.Srivatsavai@Sun.COM> |
---|---|
date | Thu, 29 Jul 2010 02:14:42 -0400 |
parents | 1de2e15ec41a |
children | 0d2f176e1e5e |
files | usr/src/cmd/cmd-inet/lib/nwamd/ncu.c usr/src/cmd/dladm/dladm.c usr/src/cmd/dlmgmtd/dlmgmt_db.c usr/src/cmd/dlmgmtd/dlmgmt_util.c usr/src/lib/libdladm/common/libdlmgmt.c usr/src/uts/common/io/mac/mac_provider.c usr/src/uts/common/sys/dls_mgmt.h |
diffstat | 7 files changed, 73 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/lib/nwamd/ncu.c Wed Jul 28 23:06:01 2010 -0700 +++ b/usr/src/cmd/cmd-inet/lib/nwamd/ncu.c Thu Jul 29 02:14:42 2010 -0400 @@ -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 @@ 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 @@ 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) {
--- a/usr/src/cmd/dladm/dladm.c Wed Jul 28 23:06:01 2010 -0700 +++ b/usr/src/cmd/dladm/dladm.c Thu Jul 29 02:14:42 2010 -0400 @@ -6580,8 +6580,15 @@ * 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 @@ (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 @@ } } - 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);
--- a/usr/src/cmd/dlmgmtd/dlmgmt_db.c Wed Jul 28 23:06:01 2010 -0700 +++ b/usr/src/cmd/dlmgmtd/dlmgmt_db.c Thu Jul 29 02:14:42 2010 -0400 @@ -814,6 +814,12 @@ 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 @@ } 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 @@ 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 @@ 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; }
--- a/usr/src/cmd/dlmgmtd/dlmgmt_util.c Wed Jul 28 23:06:01 2010 -0700 +++ b/usr/src/cmd/dlmgmtd/dlmgmt_util.c Thu Jul 29 02:14:42 2010 -0400 @@ -367,7 +367,7 @@ 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 @@ 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);
--- a/usr/src/lib/libdladm/common/libdlmgmt.c Wed Jul 28 23:06:01 2010 -0700 +++ b/usr/src/lib/libdladm/common/libdlmgmt.c Thu Jul 29 02:14:42 2010 -0400 @@ -56,7 +56,8 @@ { 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 @@ 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);
--- a/usr/src/uts/common/io/mac/mac_provider.c Wed Jul 28 23:06:01 2010 -0700 +++ b/usr/src/uts/common/io/mac/mac_provider.c Thu Jul 29 02:14:42 2010 -0400 @@ -1357,10 +1357,10 @@ 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; }
--- a/usr/src/uts/common/sys/dls_mgmt.h Wed Jul 28 23:06:01 2010 -0700 +++ b/usr/src/uts/common/sys/dls_mgmt.h Thu Jul 29 02:14:42 2010 -0400 @@ -45,7 +45,7 @@ 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;