summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-03-16 11:50:22 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-03-16 11:50:22 +0000
commitf7ea4da938aa53876e4566a132d9d832326ad270 (patch)
tree7d88dfc47eb279601e504146a26a561c45511904
parent24f08a0b0078137aab5851058a7a39188fdd4161 (diff)
parent82d15aec0ec806306291ef7cf6b85485d8645a69 (diff)
downloadillumos-joyent-f7ea4da938aa53876e4566a132d9d832326ad270.tar.gz
[illumos-gate merge]
commit 82d15aec0ec806306291ef7cf6b85485d8645a69 3446 Update bge to support missing 57xx/577xx devices (sun4v build) commit 21b8230d78c7bb568bc50de4ff4dec59a5ce74d6 3446 Update bge to support missing 57xx/577xx devices (sparc build) commit 9d4de077e3aa30b476ea992c9718c49688e68265 5643 _netdir_options(): _nderror is not set on failure commit 6935f61b0d202f1b87f0234824e4a6ab88c492ac 1101 NFS service fails to start after hostname change
-rw-r--r--usr/src/cmd/rpcbind/bind.xml16
-rw-r--r--usr/src/lib/libnsl/rpc/rpcb_clnt.c25
-rw-r--r--usr/src/lib/nametoaddr/straddr/common/straddr.c71
-rw-r--r--usr/src/uts/common/gssapi/gssd_handle.c32
-rw-r--r--usr/src/uts/common/io/lvm/md/md_med.c19
-rw-r--r--usr/src/uts/common/rpc/rpc_subr.c10
-rw-r--r--usr/src/uts/common/rpc/sec/key_call.c26
-rw-r--r--usr/src/uts/sparc/bge/Makefile2
-rw-r--r--usr/src/uts/sun4v/bge/Makefile2
9 files changed, 71 insertions, 132 deletions
diff --git a/usr/src/cmd/rpcbind/bind.xml b/usr/src/cmd/rpcbind/bind.xml
index 61c5acfcd2..b81c7b49ec 100644
--- a/usr/src/cmd/rpcbind/bind.xml
+++ b/usr/src/cmd/rpcbind/bind.xml
@@ -21,11 +21,11 @@
CDDL HEADER END
+ Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+
Copyright 2009 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
- Copyright 2014 Nexenta Systems, Inc. All rights reserved.
-
Service manifest for rpcbind
NOTE: This service manifest is not editable; its contents will
@@ -53,18 +53,6 @@
<service_fmri value='svc:/system/filesystem/minimal' />
</dependency>
- <!--
- rpcbind(1M) has a strong dependency on the hostname.
- -->
- <dependency
- name='identity'
- grouping='require_all'
- restart_on='refresh'
- type='service'>
- <service_fmri
- value='svc:/system/identity:node' />
- </dependency>
-
<dependency
name='sysidtool'
grouping='require_all'
diff --git a/usr/src/lib/libnsl/rpc/rpcb_clnt.c b/usr/src/lib/libnsl/rpc/rpcb_clnt.c
index c8812e50b1..0fb7a8f32e 100644
--- a/usr/src/lib/libnsl/rpc/rpcb_clnt.c
+++ b/usr/src/lib/libnsl/rpc/rpcb_clnt.c
@@ -21,6 +21,10 @@
*/
/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
+/*
* Copyright 2014 Gary Mills
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -52,7 +56,6 @@
#include <netinet/in.h> /* FOR IPPROTO_TCP/UDP definitions */
#include <rpc/pmap_prot.h>
#endif
-#include <sys/utsname.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -404,7 +407,6 @@ static CLIENT *
local_rpcb(void)
{
static struct netconfig *loopnconf;
- static char hostname[MAXHOSTNAMELEN + 1];
extern mutex_t loopnconf_lock;
/* VARIABLES PROTECTED BY loopnconf_lock: loopnconf */
@@ -413,13 +415,6 @@ local_rpcb(void)
struct netconfig *nconf, *tmpnconf = NULL;
void *nc_handle;
- if ((hostname[0] == '\0') && (gethostname(hostname,
- sizeof (hostname)) < 0)) {
- syslog(LOG_ERR, "local_rpcb: gethostname failed.");
- rpc_createerr.cf_stat = RPC_UNKNOWNHOST;
- (void) mutex_unlock(&loopnconf_lock);
- return (NULL);
- }
nc_handle = setnetconfig();
if (nc_handle == NULL) {
/* fails to open netconfig file */
@@ -444,7 +439,7 @@ local_rpcb(void)
(void) endnetconfig(nc_handle);
}
(void) mutex_unlock(&loopnconf_lock);
- return (getclnthandle(hostname, loopnconf, NULL));
+ return (getclnthandle(HOST_SELF_CONNECT, loopnconf, NULL));
}
/*
@@ -564,17 +559,12 @@ got_entry(rpcb_entry_list_ptr relp, struct netconfig *nconf)
bool_t
__rpcbind_is_up(void)
{
- char hostname[MAXHOSTNAMELEN + 1];
- char uaddr[SYS_NMLN];
struct netbuf *addr;
int fd;
struct t_call *sndcall;
struct netconfig *netconf;
bool_t res;
- if (gethostname(hostname, sizeof (hostname)) < 0)
- return (TRUE);
-
if ((fd = t_open("/dev/ticotsord", O_RDWR, NULL)) == -1)
return (TRUE);
@@ -589,15 +579,12 @@ __rpcbind_is_up(void)
return (TRUE);
}
- uaddr[0] = '\0';
- (void) strlcpy(uaddr, hostname, sizeof (uaddr) - 5);
- (void) strcat(uaddr, ".rpc");
if ((netconf = getnetconfigent("ticotsord")) == NULL) {
(void) t_free((char *)sndcall, T_CALL);
(void) t_close(fd);
return (FALSE);
}
- addr = uaddr2taddr(netconf, uaddr);
+ addr = uaddr2taddr(netconf, "localhost.rpc");
freenetconfigent(netconf);
if (addr == NULL || addr->buf == NULL) {
if (addr)
diff --git a/usr/src/lib/nametoaddr/straddr/common/straddr.c b/usr/src/lib/nametoaddr/straddr/common/straddr.c
index 69995ba6c9..cdc3f876af 100644
--- a/usr/src/lib/nametoaddr/straddr/common/straddr.c
+++ b/usr/src/lib/nametoaddr/straddr/common/straddr.c
@@ -18,6 +18,11 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -26,9 +31,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <ctype.h>
#include <stdio.h>
#include <tiuser.h>
@@ -38,7 +40,6 @@
#include <sys/param.h>
#include <string.h>
#include <stdlib.h>
-#include <synch.h>
/*
* The generic name to address mappings for any transport that
@@ -70,10 +71,10 @@
#define SERVICEFILE "/etc/net/%s/services"
#define FIELD1 1
#define FIELD2 2
+#define LOCALHOST "localhost"
static int searchhost(struct netconfig *, char *, int, char *);
static int searchserv(struct netconfig *, char *, int, char *);
-static const char *nodename(void);
/*
* _netdir_getbyname() returns all of the addresses for
@@ -344,8 +345,8 @@ _uaddr2taddr(struct netconfig *netconfigp, char *uaddr)
from += 2;
} else {
*to = ((*(from+1) - '0') << 6) +
- ((*(from+2) - '0') << 3) +
- (*(from+3) - '0');
+ ((*(from+2) - '0') << 3) +
+ (*(from+3) - '0');
from += 4;
}
} else {
@@ -386,7 +387,11 @@ _netdir_options(struct netconfig *netconfigp, int option, int fd, void *par)
*/
argp = (struct nd_mergearg *)par;
argp->m_uaddr = strdup(argp->s_uaddr);
- return (argp->m_uaddr == NULL? -1 : 0);
+ if (argp->m_uaddr == NULL) {
+ _nderror = ND_NOMEM;
+ return (-1);
+ }
+ return (0);
default:
_nderror = ND_NOCTRL;
return (-1);
@@ -411,28 +416,21 @@ searchhost(struct netconfig *netconfigp, char *token, int field, char *hostbuf)
char *nexttok; /* next token to process */
FILE *fp; /* the opened searchfile */
int nelements = 0; /* total number of elements found */
- const char *myname; /* my own nodename */
-
- myname = nodename();
+ struct utsname utsname;
/*
- * Unless /etc/netconfig has been altered, the only transport
- * that will use straddr.so is loopback. In this case, we
- * always return our nodename if that's what we were passed,
- * or we fail (note that we'd like to return a constant like
- * "localhost" so that changes to the machine name won't cause
- * problems, but things like autofs actually assume that we're
- * using our nodename).
+ * Unless /etc/netconfig has been altered, the only transport that
+ * will use straddr.so is loopback. In this case, we always
+ * return "localhost" if either our nodename, or "localhost", or
+ * some of special-case host names were passed, or we fail.
*/
if ((strcmp(token, HOST_SELF_BIND) == 0) ||
(strcmp(token, HOST_SELF_CONNECT) == 0) ||
(strcmp(token, HOST_ANY) == 0) ||
- (myname != NULL && (strcmp(token, myname) == 0))) {
- if (myname == NULL)
- return (0);
-
- (void) strcpy(hostbuf, myname);
+ (strcmp(token, LOCALHOST) == 0) ||
+ (uname(&utsname) >= 0 && strcmp(token, utsname.nodename) == 0)) {
+ (void) strcpy(hostbuf, LOCALHOST);
return (1);
}
@@ -560,30 +558,3 @@ searchserv(struct netconfig *netconfigp, char *token, int field, char *servname)
(void) fclose(fp);
return (0);
}
-
-static const char *
-nodename(void)
-{
- static mutex_t nodename_lock = DEFAULTMUTEX;
- static const char *myname;
- struct utsname utsname;
-
- (void) mutex_lock(&nodename_lock);
- if (myname != NULL) {
- (void) mutex_unlock(&nodename_lock);
- return (myname);
- }
-
- if (uname(&utsname) == -1) {
- (void) mutex_unlock(&nodename_lock);
- _nderror = ND_SYSTEM;
- return (NULL);
- }
-
- myname = strdup(utsname.nodename);
- if (myname == NULL)
- _nderror = ND_NOMEM;
-
- (void) mutex_unlock(&nodename_lock);
- return (myname);
-}
diff --git a/usr/src/uts/common/gssapi/gssd_handle.c b/usr/src/uts/common/gssapi/gssd_handle.c
index 78563b6e81..cd1676e84a 100644
--- a/usr/src/uts/common/gssapi/gssd_handle.c
+++ b/usr/src/uts/common/gssapi/gssd_handle.c
@@ -19,13 +19,16 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Kernel code to obtain client handle to gssd server
*/
@@ -39,7 +42,6 @@
#include <sys/vnode.h>
#include <sys/uio.h>
#include <sys/pathname.h>
-#include <sys/utsname.h>
#define GSSD_RETRY 5
@@ -94,7 +96,6 @@ getgssd_handle(void)
struct vnode *vp;
int error;
CLIENT *clnt;
- char *gssname;
enum clnt_stat stat;
struct netbuf tmpaddr;
struct gss_globals *gssg;
@@ -107,7 +108,7 @@ getgssd_handle(void)
*/
if (gssg->gss_config.knc_rdev == 0) {
if ((error = lookupname("/dev/ticotsord", UIO_SYSSPACE,
- FOLLOW, NULLVPP, &vp)) != 0) {
+ FOLLOW, NULLVPP, &vp)) != 0) {
GSSLOG(1, "getgssd_handle: lookupname: %d\n", error);
return (NULL);
}
@@ -125,27 +126,20 @@ getgssd_handle(void)
netaddrp = &gssg->gss_netaddr;
if (netaddrp->len == 0 || gssg->gss_last_stat != RPC_SUCCESS) {
- char *nodename = uts_nodename();
-
- /* Set up netaddr to be <nodename>. */
- netaddrp->len = strlen(nodename) + 1;
- if (netaddrp->buf != (char *)NULL)
+ if (netaddrp->buf != NULL)
kmem_free(netaddrp->buf, netaddrp->maxlen);
- gssname = kmem_zalloc(netaddrp->len, KM_SLEEP);
-
- (void) strncpy(gssname, nodename, netaddrp->len - 1);
- /* Append "." to end of gssname */
- (void) strncpy(gssname+(netaddrp->len-1), ".", 1);
- netaddrp->buf = gssname;
- netaddrp->maxlen = netaddrp->len;
+ /* Set up netaddr to be "localhost." (strlen is 10) */
+ netaddrp->len = netaddrp->maxlen = 10;
+ netaddrp->buf = kmem_alloc(netaddrp->len, KM_SLEEP);
+ (void) strncpy(netaddrp->buf, "localhost.", netaddrp->len);
/* Get address of gssd from rpcbind */
stat = rpcbind_getaddr(&gssg->gss_config, GSSPROG, GSSVERS,
netaddrp);
if (stat != RPC_SUCCESS) {
kmem_free(netaddrp->buf, netaddrp->maxlen);
- netaddrp->buf = (char *)NULL;
+ netaddrp->buf = NULL;
netaddrp->len = netaddrp->maxlen = 0;
mutex_exit(&gssrpcb_lock);
return (NULL);
@@ -166,7 +160,7 @@ getgssd_handle(void)
mutex_exit(&gssrpcb_lock);
error = clnt_tli_kcreate(&gssg->gss_config, &tmpaddr, GSSPROG,
- GSSVERS, 0, GSSD_RETRY, kcred, &clnt);
+ GSSVERS, 0, GSSD_RETRY, kcred, &clnt);
kmem_free(tmpaddr.buf, tmpaddr.maxlen);
diff --git a/usr/src/uts/common/io/lvm/md/md_med.c b/usr/src/uts/common/io/lvm/md/md_med.c
index 37c002e860..4f3f576563 100644
--- a/usr/src/uts/common/io/lvm/md/md_med.c
+++ b/usr/src/uts/common/io/lvm/md/md_med.c
@@ -18,6 +18,11 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -1070,14 +1075,12 @@ med_net_callrpc(
}
if (strcmp(uap->ua_kn.knc_protofmly, NC_LOOPBACK) == 0) {
- size_t alen = strlen(utsname.nodename) + 1 + 1;
-
- dst.buf = kmem_zalloc(alen, KM_SLEEP);
- dst.maxlen = (uint_t)alen;
-
- (void) strcpy(dst.buf, utsname.nodename);
- (void) strcat(dst.buf, ".");
-
+ /*
+ * strlen("localhost.") is 10
+ */
+ dst.len = dst.maxlen = 10;
+ dst.buf = kmem_alloc(dst.len, KM_SLEEP);
+ (void) strncpy(dst.buf, "localhost.", dst.len);
} else if (strcmp(uap->ua_kn.knc_protofmly, NC_INET) == 0) {
struct sockaddr_in *s;
diff --git a/usr/src/uts/common/rpc/rpc_subr.c b/usr/src/uts/common/rpc/rpc_subr.c
index d53a4eeb4a..ceb153cf84 100644
--- a/usr/src/uts/common/rpc/rpc_subr.c
+++ b/usr/src/uts/common/rpc/rpc_subr.c
@@ -19,6 +19,11 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
@@ -27,9 +32,6 @@
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-/*
- * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
- */
/* SVr4.0 1.1 */
@@ -496,7 +498,7 @@ out:
/*
* Try to get the address for the desired service by using the rpcbind
* protocol. Ignores signals. If addr is a loopback address, it is
- * expected to be initialized to "<hostname>.".
+ * expected to be initialized to "localhost.".
* rpcbind_getaddr() is able to work with RPCBIND protocol version 3 and 4
* and PORTMAP protocol version 2.
* It tries version 4 at first, then version 3 and finally (if both failed)
diff --git a/usr/src/uts/common/rpc/sec/key_call.c b/usr/src/uts/common/rpc/sec/key_call.c
index 382924bffe..1903a42fb3 100644
--- a/usr/src/uts/common/rpc/sec/key_call.c
+++ b/usr/src/uts/common/rpc/sec/key_call.c
@@ -18,6 +18,11 @@
*
* CDDL HEADER END
*/
+
+/*
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -31,8 +36,6 @@
* under license from the Regents of the University of California.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* key_call.c, Interface to keyserver
* key_encryptsession(agent, deskey, cr)-encrypt a session key to talk to agent
@@ -53,7 +56,6 @@
#include <sys/vnode.h>
#include <sys/uio.h>
#include <sys/debug.h>
-#include <sys/utsname.h>
#include <sys/cmn_err.h>
#include <rpc/rpc.h>
@@ -64,7 +66,6 @@
struct auth_globals {
struct knetconfig auth_config;
- char auth_keyname[SYS_NMLN+16];
};
static struct timeval keytrytimeout = { KEY_TIMEOUT, 0 };
@@ -236,26 +237,15 @@ key_call(rpcproc_t procn, xdrproc_t xdr_args, caddr_t args,
vnode_t *vp;
int error;
struct auth_globals *authg;
- char *keyname;
struct knetconfig *configp;
k_sigset_t smask;
authg = zone_getspecific(auth_zone_key, curproc->p_zone);
- keyname = authg->auth_keyname;
configp = &authg->auth_config;
- /*
- * Using a global here is obviously busted and fraught with danger.
- */
- (void) strcpy(keyname, uts_nodename());
- netaddr.len = strlen(keyname);
- (void) strcpy(&keyname[netaddr.len], ".keyserv");
-
- netaddr.buf = keyname;
- /*
- * 8 = strlen(".keyserv");
- */
- netaddr.len = netaddr.maxlen = netaddr.len + 8;
+ /* strlen("localhost.keyserv") is 17 */
+ netaddr.len = netaddr.maxlen = 17;
+ netaddr.buf = "localhost.keyserv";
/*
* filch a knetconfig structure.
diff --git a/usr/src/uts/sparc/bge/Makefile b/usr/src/uts/sparc/bge/Makefile
index 765db1019d..9fb4f205b9 100644
--- a/usr/src/uts/sparc/bge/Makefile
+++ b/usr/src/uts/sparc/bge/Makefile
@@ -80,6 +80,8 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
+CERRWARN += -_gcc=-Wno-unused-variable
+CERRWARN += -_gcc=-Wno-unused-function
#
# Default build targets.
diff --git a/usr/src/uts/sun4v/bge/Makefile b/usr/src/uts/sun4v/bge/Makefile
index 956f668e69..c36ac0dcab 100644
--- a/usr/src/uts/sun4v/bge/Makefile
+++ b/usr/src/uts/sun4v/bge/Makefile
@@ -79,6 +79,8 @@ LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN
CERRWARN += -_gcc=-Wno-uninitialized
CERRWARN += -_gcc=-Wno-switch
CERRWARN += -_gcc=-Wno-parentheses
+CERRWARN += -_gcc=-Wno-unused-variable
+CERRWARN += -_gcc=-Wno-unused-function
#
# Default build targets.