summaryrefslogtreecommitdiff
path: root/usr/src/lib/ncad_addr
diff options
context:
space:
mode:
authorstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
committerstevel@tonic-gate <none@none>2005-06-14 00:00:00 -0700
commit7c478bd95313f5f23a4c958a745db2134aa03244 (patch)
treec871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/lib/ncad_addr
downloadillumos-gate-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz
OpenSolaris Launch
Diffstat (limited to 'usr/src/lib/ncad_addr')
-rw-r--r--usr/src/lib/ncad_addr/Makefile49
-rw-r--r--usr/src/lib/ncad_addr/Makefile.com49
-rw-r--r--usr/src/lib/ncad_addr/amd64/Makefile32
-rw-r--r--usr/src/lib/ncad_addr/common/ncad_addr.c253
-rw-r--r--usr/src/lib/ncad_addr/i386/Makefile31
-rw-r--r--usr/src/lib/ncad_addr/sparc/Makefile31
-rw-r--r--usr/src/lib/ncad_addr/sparcv9/Makefile32
-rw-r--r--usr/src/lib/ncad_addr/spec/Makefile29
-rw-r--r--usr/src/lib/ncad_addr/spec/Makefile.targ34
-rw-r--r--usr/src/lib/ncad_addr/spec/amd64/Makefile42
-rw-r--r--usr/src/lib/ncad_addr/spec/i386/Makefile42
-rw-r--r--usr/src/lib/ncad_addr/spec/ncad_addr.spec37
-rw-r--r--usr/src/lib/ncad_addr/spec/sparc/Makefile44
-rw-r--r--usr/src/lib/ncad_addr/spec/sparcv9/Makefile43
-rw-r--r--usr/src/lib/ncad_addr/spec/versions79
15 files changed, 827 insertions, 0 deletions
diff --git a/usr/src/lib/ncad_addr/Makefile b/usr/src/lib/ncad_addr/Makefile
new file mode 100644
index 0000000000..47d1dda5f8
--- /dev/null
+++ b/usr/src/lib/ncad_addr/Makefile
@@ -0,0 +1,49 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 1999-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.lib
+
+SUBDIRS= $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET= all
+install := TARGET= install
+clean := TARGET= clean
+clobber := TARGET= clobber
+lint := TARGET= lint
+
+.KEEP_STATE:
+
+all install clean clobber: spec .WAIT $(SUBDIRS)
+
+lint: $(SUBDIRS)
+
+spec $(SUBDIRS): FRC
+ @cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
diff --git a/usr/src/lib/ncad_addr/Makefile.com b/usr/src/lib/ncad_addr/Makefile.com
new file mode 100644
index 0000000000..7caf98fd43
--- /dev/null
+++ b/usr/src/lib/ncad_addr/Makefile.com
@@ -0,0 +1,49 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+LIBRARY = ncad_addr.a
+VERS = .1
+OBJECTS = ncad_addr.o
+
+include ../../Makefile.lib
+
+SRCDIR = ../common
+MAPDIR = ../spec/$(TRANSMACH)
+SPECMAPFILE = $(MAPDIR)/mapfile
+
+LIBS = $(DYNLIB)
+LDLIBS += -lc -lnsl
+CFLAGS += $(CCVERBOSE)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+include ../../Makefile.targ
diff --git a/usr/src/lib/ncad_addr/amd64/Makefile b/usr/src/lib/ncad_addr/amd64/Makefile
new file mode 100644
index 0000000000..cb39a2beff
--- /dev/null
+++ b/usr/src/lib/ncad_addr/amd64/Makefile
@@ -0,0 +1,32 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/ncad_addr/common/ncad_addr.c b/usr/src/lib/ncad_addr/common/ncad_addr.c
new file mode 100644
index 0000000000..5fa5e907c1
--- /dev/null
+++ b/usr/src/lib/ncad_addr/common/ncad_addr.c
@@ -0,0 +1,253 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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 1999-2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * Shim library which should be LD_PRELOADed before running applications
+ * that interact with NCA but do not explicitly use the AF_NCA family.
+ * This library overloads AF_INET's version of bind(3SOCKET) with AF_NCA's
+ * version. The new version of bind checks to see if that the port is one
+ * NCA is listening on, closes the socket(3SOCKET), and opens a new one
+ * the family AF_NCA. Afterwards, the real bind(3SOCKET) is called
+ * descriptors, etc. *
+ *
+ * Compile: cc -Kpic -G -o ncad_addr.so ncad_addr.c -lsocket -lnsl
+ * Use: LD_PRELOAD=/path/to/ncad_addr.so my_program
+ */
+
+#include <stdio.h>
+#include <assert.h>
+#include <dlfcn.h>
+#include <door.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inet/nd.h>
+#include <unistd.h>
+#include <stropts.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <netdb.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#pragma weak bind = nca_bind
+#pragma init(ncad_init)
+#pragma fini(ncad_fini)
+
+#define SEPARATOR '/'
+
+typedef int sfunc1_t(int, int, int);
+typedef int sfunc2_t(int, const struct sockaddr *, socklen_t);
+
+static sfunc1_t *real_socket;
+static sfunc2_t *real_bind;
+
+/*
+ * It is used to represent an address NCA is willing to handle.
+ */
+typedef struct nca_address_s {
+ uint16_t port; /* port, in network byte order */
+ ipaddr_t ipaddr; /* IP address, in network byte order */
+} nca_address_t;
+
+static uint32_t addrcount; /* current address count */
+static uint32_t addrcapacity; /* capacity of ncaaddrs */
+static nca_address_t *ncaaddrs; /* array for all addresses */
+
+/*
+ * It loads all NCA addresses from a configuration file. A NCA address
+ * entry is: ncaport=IPaddress:port. The line above can be repeatly for other
+ * addresses. If IPaddress is '*', then it is translated into INADDR_ANY.
+ */
+static void
+ncad_init(void)
+{
+ uint16_t port;
+ ipaddr_t addr;
+ FILE *fp;
+ char *s, *p, *q;
+ char buffer[1024];
+ const char *filename = "/etc/nca/ncaport.conf";
+
+ real_socket = (sfunc1_t *)dlsym(RTLD_NEXT, "socket");
+ real_bind = (sfunc2_t *)dlsym(RTLD_NEXT, "bind");
+
+ if ((fp = fopen(filename, "r")) == NULL) {
+ (void) fprintf(stderr, "Failed to open file %s for reading in "
+ " ncad_addr.so. Error = %s\n",
+ filename,
+ (p = strerror(errno)) ? p : "unknown error");
+ return;
+ }
+
+ while (fgets(buffer, sizeof (buffer), fp) != NULL) {
+ s = buffer;
+
+ /* remove '\n' at the end from fgets() */
+ p = strchr(s, '\n');
+ if (p != NULL)
+ *p = '\0';
+
+ /* remove spaces from the front */
+ while (*s != '\0' && isspace(*s))
+ s++;
+
+ if (*s == '\0' || *s == '#')
+ continue;
+
+ /* it should start with ncaport= */
+ p = strchr(s, '=');
+ if (p == NULL || strncasecmp(s, "ncaport", 7) != 0)
+ continue;
+
+ p++;
+ while (*p != '\0' && isspace(*p))
+ p++;
+
+ q = strchr(p, SEPARATOR);
+ if (q == NULL)
+ continue;
+ *q++ = '\0';
+ if (strcmp(p, "*") == 0) {
+ addr = INADDR_ANY;
+ } else {
+ if (inet_pton(AF_INET, p, &addr) != 1) {
+ struct in6_addr addr6;
+
+ if (inet_pton(AF_INET6, p, &addr6) == 1) {
+ (void) fprintf(stderr,
+ "NCA does not support IPv6\n");
+ } else {
+ (void) fprintf(stderr,
+ "Invalid IP address: %s\n", p);
+ }
+ continue;
+ }
+ }
+ port = atoi(q);
+
+ /* array is full, expand it */
+ if (addrcount == addrcapacity) {
+ if (addrcapacity == 0)
+ addrcapacity = 64;
+ else
+ addrcapacity *= 2;
+ ncaaddrs = realloc(ncaaddrs,
+ addrcapacity * sizeof (nca_address_t));
+ if (ncaaddrs == NULL) {
+ (void) fprintf(stderr, "out of memory");
+ break;
+ }
+ }
+
+ ncaaddrs[addrcount].ipaddr = addr;
+ ncaaddrs[addrcount].port = htons(port);
+ addrcount++;
+ }
+
+ (void) fclose(fp);
+}
+
+/*
+ * It destroys memory at the end of program.
+ */
+static void
+ncad_fini(void)
+{
+ if (ncaaddrs != NULL) {
+ free(ncaaddrs);
+ ncaaddrs = NULL;
+ }
+}
+
+/*
+ * If the bind is happening on a port NCA is listening on, close
+ * the socket and open a new one with family AF_NCA.
+ */
+static int
+nca_bind(int sock, const struct sockaddr *name, socklen_t namelen)
+{
+ struct sockaddr_in sin;
+ int new_sock;
+ int i;
+
+ if (sock < 0) {
+ errno = EBADF;
+ return (-1);
+ }
+
+ if (real_socket == NULL) {
+ if ((real_socket = (sfunc1_t *)dlsym(RTLD_NEXT, "socket"))
+ == NULL) {
+ errno = EAGAIN;
+ exit(-1);
+ }
+ }
+
+ if (real_bind == NULL) {
+ if ((real_bind = (sfunc2_t *)dlsym(RTLD_NEXT, "bind"))
+ == NULL) {
+ errno = EAGAIN;
+ exit(-1);
+ }
+ }
+
+ if (name == NULL ||
+ ncaaddrs == NULL ||
+ name->sa_family != AF_INET ||
+ namelen != sizeof (sin)) {
+ return (real_bind(sock, name, namelen));
+ }
+
+ (void) memcpy(&sin, name, sizeof (sin));
+
+ /*
+ * If it is one of the addresses NCA is handling, convert it
+ * to NCA socket.
+ */
+ for (i = 0; i < addrcount; i++) {
+ if (sin.sin_port == ncaaddrs[i].port &&
+ (sin.sin_addr.s_addr == ncaaddrs[i].ipaddr ||
+ ncaaddrs[i].ipaddr == INADDR_ANY)) {
+ /* convert to NCA socket */
+ new_sock = real_socket(AF_NCA, SOCK_STREAM, 0);
+ if (new_sock >= 0) {
+ (void) dup2(new_sock, sock);
+ (void) close(new_sock);
+ sin.sin_family = AF_NCA;
+ }
+ break;
+ }
+ }
+
+ return (real_bind(sock, (struct sockaddr *)&sin, namelen));
+}
diff --git a/usr/src/lib/ncad_addr/i386/Makefile b/usr/src/lib/ncad_addr/i386/Makefile
new file mode 100644
index 0000000000..6134c1e850
--- /dev/null
+++ b/usr/src/lib/ncad_addr/i386/Makefile
@@ -0,0 +1,31 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 1999-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS)
diff --git a/usr/src/lib/ncad_addr/sparc/Makefile b/usr/src/lib/ncad_addr/sparc/Makefile
new file mode 100644
index 0000000000..6134c1e850
--- /dev/null
+++ b/usr/src/lib/ncad_addr/sparc/Makefile
@@ -0,0 +1,31 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 1999-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS)
diff --git a/usr/src/lib/ncad_addr/sparcv9/Makefile b/usr/src/lib/ncad_addr/sparcv9/Makefile
new file mode 100644
index 0000000000..a8dcf1ef21
--- /dev/null
+++ b/usr/src/lib/ncad_addr/sparcv9/Makefile
@@ -0,0 +1,32 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 1999-2001 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/ncad_addr/spec/Makefile b/usr/src/lib/ncad_addr/spec/Makefile
new file mode 100644
index 0000000000..1573519434
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/Makefile
@@ -0,0 +1,29 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# lib/ncad_addr/spec/Makefile
+
+include $(SRC)/lib/Makefile.spec.arch
diff --git a/usr/src/lib/ncad_addr/spec/Makefile.targ b/usr/src/lib/ncad_addr/spec/Makefile.targ
new file mode 100644
index 0000000000..48245294b8
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/Makefile.targ
@@ -0,0 +1,34 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright (c) 1998-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+# lib/ncad_addr/spec/Makefile.targ
+
+LIBRARY = ncad_addr.a
+VERS = .1
+
+OBJECTS = ncad_addr.o
+
+SPECCPP = -I..
diff --git a/usr/src/lib/ncad_addr/spec/amd64/Makefile b/usr/src/lib/ncad_addr/spec/amd64/Makefile
new file mode 100644
index 0000000000..2a38c1cba9
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/amd64/Makefile
@@ -0,0 +1,42 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+include $(SRC)/lib/Makefile.lib.64
+
+# Uncomment the following if the linker complains
+#amd64_C_PICFLAGS = -K PIC
+
+include $(SRC)/lib/Makefile.spec
+
+install: $(ROOTABILIB64)
diff --git a/usr/src/lib/ncad_addr/spec/i386/Makefile b/usr/src/lib/ncad_addr/spec/i386/Makefile
new file mode 100644
index 0000000000..4198b9fd59
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/i386/Makefile
@@ -0,0 +1,42 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# lib/ncad_addr/spec/i386/Makefile
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+
+# Uncomment the following if the linker complains
+#i386_C_PICFLAGS = -K PIC
+
+include $(SRC)/lib/Makefile.spec
+
+install: $(ROOTABILIB)
diff --git a/usr/src/lib/ncad_addr/spec/ncad_addr.spec b/usr/src/lib/ncad_addr/spec/ncad_addr.spec
new file mode 100644
index 0000000000..6f125c5170
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/ncad_addr.spec
@@ -0,0 +1,37 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+function bind
+include <sys/types.h>
+include <sys/socket.h>
+declaration int bind(int sock, const struct sockaddr *name, \
+ socklen_t namelen)
+version i386=SUNW_0.7 sparc=SISCD_2.3 sparcv9=SUNW_0.7 amd64=SUNW_0.7
+errno EACCES EADDRINUSE EADDRNOTAVAIL EBADF EINVAL ENOSR ENOTSOCK \
+ EIO EISDIR ELOOP ENOENT EROFS
+exception $return == -1
+end
diff --git a/usr/src/lib/ncad_addr/spec/sparc/Makefile b/usr/src/lib/ncad_addr/spec/sparc/Makefile
new file mode 100644
index 0000000000..630e63697c
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/sparc/Makefile
@@ -0,0 +1,44 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# lib/ncad_addr/spec/sparc/Makefile
+
+.KEEP_STATE:
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+
+# Uncomment the following if the linker complains
+#sparc_C_PICFLAGS = -K PIC
+
+include $(SRC)/lib/Makefile.spec
+
+install: $(ROOTABILIB)
diff --git a/usr/src/lib/ncad_addr/spec/sparcv9/Makefile b/usr/src/lib/ncad_addr/spec/sparcv9/Makefile
new file mode 100644
index 0000000000..09aa43d1c5
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/sparcv9/Makefile
@@ -0,0 +1,43 @@
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 1997-1999 by Sun Microsystems, Inc.
+# All rights reserved.
+#
+#ident "%Z%%M% %I% %E% SMI"
+#
+# lib/ncad_addr/spec/sparcv9/Makefile
+
+include ../Makefile.targ
+
+# Add arch specific objects here
+OBJECTS +=
+
+include $(SRC)/lib/Makefile.lib
+include $(SRC)/lib/Makefile.lib.64
+
+# Uncomment the following if the linker complains
+#sparcv9_C_PICFLAGS = -K PIC
+
+include $(SRC)/lib/Makefile.spec
+
+install: $(ROOTABILIB64)
diff --git a/usr/src/lib/ncad_addr/spec/versions b/usr/src/lib/ncad_addr/spec/versions
new file mode 100644
index 0000000000..7b17a9f5db
--- /dev/null
+++ b/usr/src/lib/ncad_addr/spec/versions
@@ -0,0 +1,79 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# Note this version file was copied from libsocket since it interposes
+# functions in that library.
+#
+# Note (re: SUNW_1.2 .. SUNW_1.3):
+# Even though the SUNW_1.2 and SUNW_1.3 versions now contain no
+# symbols these versions MUST be present. This is because applications
+# built on 2.6 Beta (when they did contain symbols explicitly) may
+# depend on them.
+#
+# All symbol content for Solaris2.6 is now contained in SUNW_1.1,
+# and (the now empty) versions SUNW_1.2 and SUNW_1.3 must be kept.
+#
+i386 {
+ SUNW_1.4: {SUNW_1.3};
+ SUNW_1.3: {SUNW_1.2};
+ SUNW_1.2: {SUNW_1.1};
+ SUNW_1.1: {SUNW_0.7};
+ SUNW_0.7;
+ SUNWprivate_1.3: {SUNWprivate_1.2};
+ SUNWprivate_1.2: {SUNWprivate_1.1};
+ SUNWprivate_1.1;
+}
+sparc {
+ SUNW_1.4: {SUNW_1.3};
+ SUNW_1.3: {SUNW_1.2};
+ SUNW_1.2: {SUNW_1.1};
+ SUNW_1.1: {SUNW_0.7};
+ SUNW_0.7: {SISCD_2.3};
+ SISCD_2.3;
+ SUNWprivate_1.3: {SUNWprivate_1.2};
+ SUNWprivate_1.2: {SUNWprivate_1.1};
+ SUNWprivate_1.1;
+}
+sparcv9 {
+ SUNW_1.4: {SUNW_1.3};
+ SUNW_1.3: {SUNW_1.2};
+ SUNW_1.2: {SUNW_1.1};
+ SUNW_1.1: {SUNW_0.7};
+ SUNW_0.7;
+ SUNWprivate_1.3: {SUNWprivate_1.2};
+ SUNWprivate_1.2: {SUNWprivate_1.1};
+ SUNWprivate_1.1;
+}
+amd64 {
+ SUNW_1.4: {SUNW_1.3};
+ SUNW_1.3: {SUNW_1.2};
+ SUNW_1.2: {SUNW_1.1};
+ SUNW_1.1: {SUNW_0.7};
+ SUNW_0.7;
+ SUNWprivate_1.3: {SUNWprivate_1.2};
+ SUNWprivate_1.2: {SUNWprivate_1.1};
+ SUNWprivate_1.1;
+}