summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Whitten <Thomas.Whitten@Sun.COM>2009-08-24 12:26:07 -0700
committerTom Whitten <Thomas.Whitten@Sun.COM>2009-08-24 12:26:07 -0700
commit2f349fb3f7f2c951525d92f15ef050d897ec3244 (patch)
treeb94d97da3837220aeb265fca25c8fbb55cb29068
parentcd2adecea48f46c10733a2334dde10730b251d26 (diff)
downloadillumos-joyent-2f349fb3f7f2c951525d92f15ef050d897ec3244.tar.gz
PSARC 2006/470 EOF of rpld
PSARC 2006/471 rmtmpfiles property to control boot time behavior 5079338 Remove rpld from ON distribution 6230873 rmtmpfiles should use SMF properties to control its behaviour
-rw-r--r--usr/src/cmd/Makefile1
-rw-r--r--usr/src/cmd/initpkg/Makefile11
-rw-r--r--usr/src/cmd/initpkg/init.d/Makefile1
-rw-r--r--usr/src/cmd/initpkg/init.d/boot.server52
-rw-r--r--usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh42
-rw-r--r--usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh42
-rw-r--r--usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh9
-rw-r--r--usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh42
-rw-r--r--usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh42
-rw-r--r--usr/src/cmd/rpld/Makefile73
-rw-r--r--usr/src/cmd/rpld/clientop.c386
-rw-r--r--usr/src/cmd/rpld/debug.c213
-rw-r--r--usr/src/cmd/rpld/dl_addr.c157
-rw-r--r--usr/src/cmd/rpld/dl_attach.c94
-rw-r--r--usr/src/cmd/rpld/dl_bind.c112
-rw-r--r--usr/src/cmd/rpld/dl_close.c54
-rw-r--r--usr/src/cmd/rpld/dl_error.c52
-rw-r--r--usr/src/cmd/rpld/dl_info.c58
-rw-r--r--usr/src/cmd/rpld/dl_open.c160
-rw-r--r--usr/src/cmd/rpld/dl_rcv.c107
-rw-r--r--usr/src/cmd/rpld/dl_snd.c83
-rw-r--r--usr/src/cmd/rpld/dl_unbind.c79
-rw-r--r--usr/src/cmd/rpld/dlhdr.h39
-rw-r--r--usr/src/cmd/rpld/dluser.h100
-rw-r--r--usr/src/cmd/rpld/getaddr.c70
-rw-r--r--usr/src/cmd/rpld/llcsetup.c463
-rw-r--r--usr/src/cmd/rpld/params.c808
-rw-r--r--usr/src/cmd/rpld/rcv.c76
-rw-r--r--usr/src/cmd/rpld/rpld.c234
-rw-r--r--usr/src/cmd/rpld/rpld.conf61
-rw-r--r--usr/src/cmd/rpld/rpld.h137
-rw-r--r--usr/src/cmd/rpld/rplin.c234
-rw-r--r--usr/src/cmd/rpld/rplout.c333
-rw-r--r--usr/src/cmd/rpld/sighandler.c155
-rw-r--r--usr/src/cmd/rpld/snd.c86
-rw-r--r--usr/src/cmd/rpld/tst.c72
-rw-r--r--usr/src/cmd/svc/milestone/rmtmpfiles40
-rw-r--r--usr/src/cmd/svc/milestone/rmtmpfiles.xml51
-rw-r--r--usr/src/pkgdefs/SUNWbsr/prototype_com23
-rw-r--r--usr/src/pkgdefs/SUNWbsu/prototype_com12
-rw-r--r--usr/src/tools/scripts/bfu.sh6
41 files changed, 88 insertions, 4782 deletions
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile
index 9574249bfe..f7684de607 100644
--- a/usr/src/cmd/Makefile
+++ b/usr/src/cmd/Makefile
@@ -350,7 +350,6 @@ COMMON_SUBDIRS= \
rpcgen \
rpcinfo \
rpcsvc \
- rpld \
runat \
sa \
saf \
diff --git a/usr/src/cmd/initpkg/Makefile b/usr/src/cmd/initpkg/Makefile
index 4cdb5673fa..b2fc6097d7 100644
--- a/usr/src/cmd/initpkg/Makefile
+++ b/usr/src/cmd/initpkg/Makefile
@@ -26,16 +26,13 @@
SHFILES= dfstab vfstab
CPFILES= rcS rc0 rc1 rc2 rc3 mountall shutdown swapadd umountall
ALL= $(SHFILES) $(CPFILES)
-TXTS= rcS.d/mk.rcS.d.sh rc0.d/mk.rc0.d.sh \
- rc1.d/mk.rc1.d.sh rc2.d/mk.rc2.d.sh rc3.d/mk.rc3.d.sh
+TXTS= rc2.d/mk.rc2.d.sh
CLOBBERFILES= $(ALL)
-SUBDIRS= rcS.d rc0.d rc1.d rc2.d rc3.d
+RCDIRS= rc2.d
include ../Makefile.cmd
-ETCINITD= $(ROOTETC)/init.d
ETCDFSD= $(ROOTETC)/dfs
-DIRS= $(ETCINITD) $(ETCDFSD) $(ROOTETC)/security
SBINF= rcS mountall rc0 rc1 rc2 rc3 swapadd umountall
SBINL= rc5 rc6
@@ -96,7 +93,7 @@ ins_init.d: FRC
$(SHFILES):
sh $@.sh $(ROOT)
-install: $(ALL) ins_all ins_init.d $(SUBDIRS)
+install: $(ALL) ins_all ins_init.d $(RCDIRS)
ins_all : $(ROOTSBINF) $(ROOTSBINL) $(ROOTUSRSBINF) $(ROOTETCTABS) \
$(ROOTDFSTAB) $(SYMSBINF) $(SYMUSRSBINF)
@@ -105,7 +102,7 @@ ins_all : $(ROOTSBINF) $(ROOTSBINL) $(ROOTUSRSBINF) $(ROOTETCTABS) \
#$(DIRS):
# $(INS.dir)
-$(SUBDIRS): FRC
+$(RCDIRS): FRC
@cd $@; pwd; ROOT=$(ROOT) sh mk.$@.sh
FRC:
diff --git a/usr/src/cmd/initpkg/init.d/Makefile b/usr/src/cmd/initpkg/init.d/Makefile
index a7bde6f836..286e85c8e4 100644
--- a/usr/src/cmd/initpkg/init.d/Makefile
+++ b/usr/src/cmd/initpkg/init.d/Makefile
@@ -31,7 +31,6 @@ i386_PROG=
PROG= \
README \
- boot.server \
cachefs.daemon \
deallocate \
devlinks \
diff --git a/usr/src/cmd/initpkg/init.d/boot.server b/usr/src/cmd/initpkg/init.d/boot.server
deleted file mode 100644
index 2ceaf3d17c..0000000000
--- a/usr/src/cmd/initpkg/init.d/boot.server
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/sbin/sh
-#
-# 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"
-
-[ ! -d /usr/bin ] && exit
-
-# Start/stop processes required for boot server
-
-case "$1" in
-'start')
-
- # If /rplboot exists become a boot server for x86 clients
-
- if [ -d /rplboot ]; then
- /usr/sbin/rpld -a
- fi
- ;;
-
-'stop')
- /usr/bin/pkill -x -u 0 rpld
-
- ;;
-*)
- echo "Usage: $0 { start | stop }"
- exit 1
- ;;
-esac
-exit 0
diff --git a/usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh b/usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh
deleted file mode 100644
index 48bd1bd5a7..0000000000
--- a/usr/src/cmd/initpkg/rc0.d/mk.rc0.d.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/sbin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (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) 1984, 1986, 1987, 1988, 1989 AT&T
-# All Rights Reserved
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-COMMON_STOPLST="27boot.server"
-
-INSDIR=${ROOT}/etc/rc0.d
-
-if [ ! -d ${INSDIR} ]
-then
- mkdir ${INSDIR}
-fi
-for f in ${COMMON_STOPLST}
-do
- name=`echo $f | sed -e 's/^..//'`
- rm -f ${INSDIR}/K$f
- ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
-done
diff --git a/usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh b/usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh
deleted file mode 100644
index e89ddaed93..0000000000
--- a/usr/src/cmd/initpkg/rc1.d/mk.rc1.d.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/sbin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (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) 1984, 1986, 1987, 1988, 1989 AT&T
-# All rights reserved
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-COMMON_STOPLST="27boot.server"
-
-INSDIR=${ROOT}/etc/rc1.d
-
-if [ ! -d ${INSDIR} ]
-then
- mkdir ${INSDIR}
-fi
-for f in ${COMMON_STOPLST}
-do
- name=`echo $f | sed -e 's/^..//'`
- rm -f ${INSDIR}/K$f
- ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
-done
diff --git a/usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh b/usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh
index 72d0f138c1..0094c068cf 100644
--- a/usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh
+++ b/usr/src/cmd/initpkg/rc2.d/mk.rc2.d.sh
@@ -33,20 +33,13 @@ COMMON_STARTLST="\
82mkdtab \
98deallocate"
-STOPLST="27boot.server"
-
INSDIR=${ROOT}/etc/rc2.d
if [ ! -d ${INSDIR} ]
then
mkdir ${INSDIR}
fi
-for f in ${STOPLST}
-do
- name=`echo $f | sed -e 's/^..//'`
- rm -f ${INSDIR}/K$f
- ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
-done
+
for f in ${COMMON_STARTLST}
do
name=`echo $f | sed -e 's/^..//'`
diff --git a/usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh b/usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh
deleted file mode 100644
index 9566069421..0000000000
--- a/usr/src/cmd/initpkg/rc3.d/mk.rc3.d.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/sbin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (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) 1984, 1986, 1987, 1988, 1989 AT&T
-# All Rights Reserved
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-STARTLST="16boot.server"
-
-INSDIR=${ROOT}/etc/rc3.d
-
-if [ ! -d ${INSDIR} ]
-then
- mkdir ${INSDIR}
-fi
-for f in ${STARTLST}
-do
- name=`echo $f | sed -e 's/^..//'`
- rm -f ${INSDIR}/S$f
- ln ${ROOT}/etc/init.d/${name} ${INSDIR}/S$f
-done
diff --git a/usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh b/usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh
deleted file mode 100644
index 72256e8f5b..0000000000
--- a/usr/src/cmd/initpkg/rcS.d/mk.rcS.d.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/sbin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
-# All rights reserved.
-
-COMMON_STOPLST="\
-27boot.server"
-
-INSDIR=${ROOT}/etc/rcS.d
-
-if [ ! -d ${INSDIR} ]
-then
- mkdir ${INSDIR}
-fi
-for f in ${COMMON_STOPLST}
-do
- name=`echo $f | sed -e 's/^..//' | sed -e 's/\.sh$//'`
- rm -f ${INSDIR}/K$f
- ln ${ROOT}/etc/init.d/${name} ${INSDIR}/K$f
-done
diff --git a/usr/src/cmd/rpld/Makefile b/usr/src/cmd/rpld/Makefile
deleted file mode 100644
index 29e9620681..0000000000
--- a/usr/src/cmd/rpld/Makefile
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# cmd/rpld/Makefile
-#
-
-PROG= rpld
-
-CONFILE= rpld.conf
-
-OBJS= rpld.o llcsetup.o debug.o sighandler.o params.o \
- clientop.o rplin.o rplout.o
-
-LIBOBJS= dl_open.o dl_bind.o dl_snd.o dl_rcv.o dl_addr.o dl_close.o \
- dl_unbind.o dl_attach.o dl_info.o dl_error.o
-
-rplin.o := CFLAGS += -_gcc=-Wno-return-type
-
-LIBDLA= libdla.a
-
-LIBS= $(LIBDLA) -lsocket
-
-ARFLAGS= r
-
-CLOBBERFILES= $(LIBDLA)
-
-include ../Makefile.cmd
-
-$(ROOTETC)/$(CONFILE):= FILEMODE = 644
-
-CPPFLAGS += -I.
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-$(PROG): $(OBJS) $(LIBDLA)
- $(LINK.c) -o $@ $(OBJS) $(LDLIBS) $(LIBS)
- $(POST_PROCESS)
-
-$(LIBDLA): $(LIBOBJS)
- $(AR) $(ARFLAGS) $(LIBDLA) $?
- $(POST_PROCESS_A)
-
-install: all $(ROOTUSRSBINPROG) $(ROOTETC)/$(CONFILE)
-
-clean:
- $(RM) $(OBJS) $(LIBOBJS)
-
-lint: lint_PROG
-
-include ../Makefile.targ
diff --git a/usr/src/cmd/rpld/clientop.c b/usr/src/cmd/rpld/clientop.c
deleted file mode 100644
index f51b50b1dc..0000000000
--- a/usr/src/cmd/rpld/clientop.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include "rpld.h"
-
-extern client_t *clntp;
-extern int totclnt;
-extern char databuf[];
-extern unsigned long delayGran;
-extern unsigned long startDelay;
-extern int frameSize;
-extern int debugLevel;
-extern int maxClients;
-extern char debugmsg[];
-
-/*
- * Add the new client between the current clntp and its next in the
- * circular linked list.
- */
-void
-clientadd(client_t *addp)
-{
- client_t *cp;
-
- totclnt++;
- if (totclnt == 1 && clntp == NULL) {
- clntp = addp;
- clntp->next = clntp;
- clntp->prev = clntp;
- return;
- }
-
- cp = clntp->next;
- addp->next = cp;
- addp->prev = clntp;
- cp->prev = addp;
- clntp->next = addp;
-}
-
-/*
- * Remove the indicated client from the circular linked list.
- */
-void
-clientremove(client_t *rmp)
-{
- client_t *cp;
-
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "removing client %0X %0X %0X %0X %0X %0X\n",
- rmp->addr[0], rmp->addr[1], rmp->addr[2],
- rmp->addr[3], rmp->addr[4], rmp->addr[5]);
- senddebug(MSG_INFO_1);
- }
-
- totclnt--;
- if (totclnt == 0) {
- clntp = (client_t *)NULL;
- return;
- }
-
- cp = rmp->next;
- cp->prev = rmp->prev;
- cp = rmp->prev;
- cp->next = rmp->next;
-}
-
-client_t *
-clientlookup(unsigned char addr[])
-{
- int i;
- int found = 0;
- client_t *cp = clntp;
-
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg,
- "Entered clientlookup(), number of clients = %d\n",
- totclnt);
- senddebug(MSG_INFO_2);
- }
-
- if (totclnt == 0) {
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "No clients yet, returning\n");
- senddebug(MSG_INFO_2);
- }
- return (NULL);
- }
-
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg,
- "Looking for client %0X %0X %0X %0X %0X %0X\n",
- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
- senddebug(MSG_INFO_1);
- }
-
- for (i = 0; i < totclnt; i++) {
- if (cp->addr[0] == addr[0] && cp->addr[1] == addr[1] &&
- cp->addr[2] == addr[2] && cp->addr[3] == addr[3] &&
- cp->addr[4] == addr[4] && cp->addr[5] == addr[5]) {
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "Client found\n");
- senddebug(MSG_INFO_1);
- }
- found = 1;
- break;
- }
- cp = cp->next;
- }
- if (found)
- return (cp);
- else
- return (NULL);
-}
-
-
-int
-clientvalidate(void)
-{
- struct ether_addr *addrp;
- client_t *cp;
- bootfile_t *bp, *bp1;
- int done = 0;
- int i, j;
- int bootparamslen;
- int numfiles = -1;
- char hostname[100];
- char bootparams[1000];
-
- if (maxClients >= 0 && totclnt >= maxClients) {
- if (debugLevel >= MSG_WARN_2) {
- sprintf(debugmsg, "Already serving maximum number of "
- "clients (= %d), request ignored\n", maxClients);
- senddebug(MSG_WARN_2);
- }
- return (-1);
- }
-
- /*
- * Get the network address from the global data buffer and look
- * it up in the ethers database.
- */
- addrp = (struct ether_addr *)&databuf[32];
- if (ether_ntohost(hostname, addrp) != 0) {
- if (debugLevel >= MSG_WARN_1) {
- sprintf(debugmsg,
- "ether_ntohost() failed, errno = %d\n", errno);
- senddebug(MSG_WARN_1);
- }
- return (-1);
- } else {
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "host is %s\n", hostname);
- senddebug(MSG_INFO_1);
- }
- }
-
- /* See if we are already serving this client */
- if ((cp = clientlookup((unsigned char *)&databuf[32])) != NULL) {
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg,
- "Requesting client is already being serviced.\n");
- senddebug(MSG_INFO_2);
- sprintf(debugmsg, "Updating its record to "
- "ST_FIND_RCVD and start over\n");
- senddebug(MSG_INFO_2);
- }
-
- /* start from the beginning */
- cp->status = ST_FIND_RCVD;
- fclose(cp->fstr);
- cp->currfp = cp->bootfp;
- cp->seekp = 0;
- cp->seqnum = 0;
- cp->maxdelay = startDelay;
- cp->timeo = 10*startDelay;
- return (0);
- }
-
- /*
- * Now lookup the bootparams database and retrieve the whole
- * client record in ASCII.
- */
- if (bootparams_getbyname(hostname, bootparams,
- sizeof (bootparams)) != 0) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg,
- "Failed to retrieve bootparams for this client\n");
- senddebug(MSG_ERROR_1);
- }
- return (-1);
- }
- bootparamslen = strlen(bootparams);
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "Raw bootparams input\n");
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "%s\n", bootparams);
- senddebug(MSG_ALWAYS);
- }
-
- /* The TAB char will be a problem, so replace them with '\0' */
- for (i = 0; i < bootparamslen; i++) {
- if (bootparams[i] == TAB || bootparams[i] == ' ')
- bootparams[i] = '\0';
- }
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "After translation\n");
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "%s\n", bootparams);
- senddebug(MSG_ALWAYS);
- }
-
- /*
- * Try to allocate a client_t structure to serve this client.
- */
- if ((cp = (client_t *)malloc(sizeof (client_t))) == NULL) {
- if (debugLevel >= MSG_WARN_1) {
- sprintf(debugmsg, "malloc() failed in adding a new "
- "client_t structure\n");
- senddebug(MSG_WARN_1);
- }
- return (-1);
- }
-
- /* Fill this structure with config info */
- memcpy(cp->addr, addrp, 6);
- cp->status = ST_FIND_RCVD;
- cp->bootfp = (bootfile_t *)NULL;
- cp->fstr = NULL;
- cp->seekp = -1;
- cp->seqnum = 0;
- cp->framesz = frameSize;
- cp->maxdelay = startDelay;
- cp->timeo = 10*startDelay;
- cp->delay = cp->resetdflt = startDelay;
-
- /* Get the number of boot files for this client */
- for (i = 0; i < bootparamslen - 13; i++) {
- if (bootparams[i] == 'n' &&
- bootparams[i+1] == 'u' && bootparams[i+2] == 'm' &&
- bootparams[i+3] == 'b' && bootparams[i+4] == 'o' &&
- bootparams[i+5] == 'o' && bootparams[i+6] == 't' &&
- bootparams[i+7] == 'f' && bootparams[i+8] == 'i' &&
- bootparams[i+9] == 'l' && bootparams[i+10] == 'e' &&
- bootparams[i+11] == 's' && bootparams[i+12] == '=') {
- sscanf(&bootparams[i+13], "%d", &numfiles);
- }
- }
- if (numfiles < 0) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg,
- "Must have at least 1 bootfile for this client\n");
- senddebug(MSG_ERROR_1);
- }
- free(cp);
- return (-1);
- }
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg,
- "There are %d bootfiles for this client\n", numfiles);
- senddebug(MSG_INFO_2);
- }
-
- /* Create the bootfile list and fill in the info from bootparams */
- for (j = 0; j < numfiles; j++) {
- if ((bp1 = (bootfile_t *)malloc(sizeof (bootfile_t))) == NULL) {
- if (debugLevel >= MSG_WARN_1) {
- sprintf(debugmsg, "Cound not malloc() "
- "bootfile_t for bootfile %d\n", j);
- senddebug(MSG_WARN_1);
- }
- goto cleanup;
- }
- bp1->next = (bootfile_t *)NULL;
- bp1->seqnum = (long)-1;
- if (cp->bootfp == (bootfile_t *)NULL) {
- cp->bootfp = bp1;
- } else {
- bp->next = bp1;
- }
- bp = bp1;
- }
- bp = cp->bootfp;
- for (i = 0; i < bootparamslen - 9; i++) {
- if (bootparams[i] == 'b' &&
- bootparams[i+1] == 'o' && bootparams[i+2] == 'o' &&
- bootparams[i+3] == 't' && bootparams[i+4] == 'f' &&
- bootparams[i+5] == 'i' && bootparams[i+6] == 'l' &&
- bootparams[i+7] == 'e' && bootparams[i+8] == '=') {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "found boot file");
- senddebug(MSG_ALWAYS);
- }
- (void) strlcpy(bp->filename,
- &bootparams[i+9], sizeof (bp->filename));
- for (j = strlen(bp->filename); j >= 0; j--)
- if (bp->filename[j] == ':')
- break;
- bp->filename[j] = '\0';
-
- if (access(bp->filename, R_OK) < 0) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg,
- "No access to bootfile (%s)\n",
- bp->filename);
- senddebug(MSG_ERROR_1);
- }
- goto cleanup;
- }
-
- sscanf(&(bp->filename[j+1]), "%lx",
- &(bp->loadaddr));
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, " %s loading to %lx\n",
- bp->filename, bp->loadaddr);
- senddebug(MSG_ALWAYS);
- }
-
- bp = bp->next;
- }
- }
-
- /* Finally the transfer address */
- for (i = 0; i < bootparamslen - 9; i++) {
- if (bootparams[i] == 'b' &&
- bootparams[i+1] == 'o' && bootparams[i+2] == 'o' &&
- bootparams[i+3] == 't' && bootparams[i+4] == 'a' &&
- bootparams[i+5] == 'd' && bootparams[i+6] == 'd' &&
- bootparams[i+7] == 'r' && bootparams[i+8] == '=') {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "found xfer addr");
- senddebug(MSG_ALWAYS);
- }
- sscanf(&bootparams[i+9], "%lx", &(cp->xferaddr));
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, " at %lx\n", cp->xferaddr);
- senddebug(MSG_ALWAYS);
- }
- }
- }
- clientadd(cp);
- return (0);
-
-cleanup:
- /* clean up any allocated structures and return */
- bp = cp->bootfp;
- while (bp) {
- bp1 = bp->next;
- free(bp);
- bp = bp1;
- }
- free(cp);
- return (-1);
-}
diff --git a/usr/src/cmd/rpld/debug.c b/usr/src/cmd/rpld/debug.c
deleted file mode 100644
index 4bf2231a0c..0000000000
--- a/usr/src/cmd/rpld/debug.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stropts.h>
-#include <syslog.h>
-#include "rpld.h"
-
-extern char configFile[];
-extern int debugLevel;
-extern int debugDest;
-extern int maxClients;
-extern int backGround;
-extern char logFile[];
-extern unsigned long delayGran;
-extern unsigned long startDelay;
-extern int frameSize;
-extern char ifName[];
-extern int ifUnit;
-extern char debugmsg[];
-extern FILE *log_str;
-
-
-/*
- * This is the routine to send the debug messages to the specified
- * location.
- */
-void
-senddebug(int pri)
-{
- int logpri;
-
- switch (debugDest) {
- case DEST_CONSOLE:
- printf("%s", debugmsg);
- break;
- case DEST_SYSLOGD:
- switch (pri) {
- case MSG_FATAL:
- logpri = LOG_ERR;
- break;
- case MSG_ERROR_1:
- case MSG_ERROR_2:
- logpri = LOG_WARNING;
- break;
- case MSG_WARN_1:
- case MSG_WARN_2:
- case MSG_WARN_3:
- logpri = LOG_NOTICE;
- break;
- case MSG_INFO_1:
- case MSG_INFO_2:
- logpri = LOG_INFO;
- break;
- case MSG_ALWAYS:
- logpri = LOG_DEBUG;
- break;
- }
- logpri |= (LOG_DAEMON | LOG_PID | LOG_CONS);
- syslog(logpri, "%s", debugmsg);
- break;
- case DEST_LOGFILE:
- if (log_str == NULL) {
- log_str = fopen(logFile, "a+");
- if (log_str == NULL) {
- printf("Cannot open log file %s\n", logFile);
- printf("Server aborted\n");
- exit(0);
- }
- setbuf(log_str, (char *)NULL);
- }
- fprintf(log_str, "%s", debugmsg);
- break;
- }
-}
-
-void
-dumpctl(struct strbuf *ctl)
-{
- int i, j, k, n;
-
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "\nControl part of RPL packet = %d bytes:\n",
- ctl->len);
- senddebug(MSG_ALWAYS);
- }
- k = ctl->len / 10;
- for (i = 0; i <= k; i++) {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "%4d\t", i*10);
- senddebug(MSG_ALWAYS);
- }
- n = (i+1)*10;
- if (n > ctl->len)
- n = ctl->len;
- for (j = i*10; j < n; j++) {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "%02X ",
- (char)(ctl->buf[j] & 0x000000FF));
- senddebug(MSG_ALWAYS);
- }
- }
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "\n");
- senddebug(MSG_ALWAYS);
- }
- }
-}
-
-void
-dumpdata(struct strbuf *data)
-{
- int i, j, k, n;
-
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "\nData part of RPL packet = %d bytes:\n",
- data->len);
- senddebug(MSG_ALWAYS);
- }
- k = data->len / 10;
- for (i = 0; i <= k; i++) {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "%4d\t", i*10);
- senddebug(MSG_ALWAYS);
- }
- n = (i+1)*10;
- if (n > data->len)
- n = data->len;
- for (j = i*10; j < n; j++) {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "%02X ",
- (char)(data->buf[j] & 0x000000FF));
- senddebug(MSG_ALWAYS);
- }
- }
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "\n");
- senddebug(MSG_ALWAYS);
- }
- }
-}
-
-void
-dumpparams(void)
-{
- char dbDest[20];
-
- sprintf(debugmsg, "ConfigFile = %s\n", configFile);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "DebugLevel = %d\n", debugLevel);
- senddebug(MSG_ALWAYS);
- switch (debugDest) {
- case DEST_CONSOLE:
- (void) strlcpy(dbDest, "console", sizeof (dbDest));
- break;
- case DEST_SYSLOGD:
- (void) strlcpy(dbDest, "syslogd", sizeof (dbDest));
- break;
- case DEST_LOGFILE:
- (void) strlcpy(dbDest, "logfile", sizeof (dbDest));
- break;
- }
- sprintf(debugmsg, "DebugDest = %s\n", dbDest);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "MaxClients = %d", maxClients);
- if (maxClients == -1)
- strcat(debugmsg, " (unlimited)\n");
- else
- strcat(debugmsg, "\n");
- senddebug(MSG_ALWAYS);
-
- if (backGround) {
- (void) strlcpy(dbDest, "TRUE", sizeof (dbDest));
- } else {
- (void) strlcpy(dbDest, "FALSE", sizeof (dbDest));
- }
- sprintf(debugmsg, "BackGround = %s\n", dbDest);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "LogFile = %s\n", logFile);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "StartDelay = %ld\n", startDelay);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "DelayGran = %ld\n", delayGran);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "FrameSize = %d\n", frameSize);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Interface = %s%d\n", ifName, ifUnit);
- senddebug(MSG_ALWAYS);
-}
diff --git a/usr/src/cmd/rpld/dl_addr.c b/usr/src/cmd/rpld/dl_addr.c
deleted file mode 100644
index 2aa3c532a5..0000000000
--- a/usr/src/cmd/rpld/dl_addr.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Make Address
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <errno.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-struct dl_address *
-dl_allocaddr(int fd, int which)
-{
- struct dl_address *addr;
- struct dl_descriptor *dl;
- int alen;
-
- dl = _getdesc(fd);
- if (dl == NULL) {
- errno = EBADF;
- return (NULL);
- }
-
- addr = (struct dl_address *)malloc(sizeof (struct dl_address));
- if (addr == NULL) {
- dl->error = DLSYSERR;
- return (NULL);
- }
-
- if (which & DL_DST) {
- addr->dla_dmax = 16;
- addr->dla_daddr = (unsigned char *)malloc(addr->dla_dmax);
- if (addr->dla_daddr == NULL) {
- int err;
-
- err = errno;
- free(addr);
- errno = err;
- dl->error = DLSYSERR;
- return (NULL);
- }
- }
- if (which & DL_SRC) {
- addr->dla_smax = 16;
- addr->dla_saddr = (unsigned char *)malloc(addr->dla_smax);
- if (addr->dla_saddr == NULL) {
- int err;
-
- err = errno;
- if (addr->dla_slen > 0) {
- free(addr->dla_saddr);
- }
- free(addr);
- errno = err;
- dl->error = DLSYSERR;
- return (NULL);
- }
- }
- return (addr);
-}
-
-/* destination address only */
-
-struct dl_address *
-dl_mkaddress(int fd, unsigned char *addr, int sap, unsigned char *oi,
- int oitype)
-{
- struct dl_address *da;
- struct dl_descriptor *dl;
-
- dl = _getdesc(fd);
- if (dl == NULL)
- return (NULL);
-
- da = dl_allocaddr(fd, DL_DST);
- if (da == NULL)
- return (NULL);
-
- memcpy(da->dla_daddr, addr, 6);
- if (sap > 1500) {
- da->dla_dlen = 8;
- *(unsigned short *)(da->dla_daddr + 6) = sap;
- return (da);
- } else if (sap < 512) {
- da->dla_dlen = 7;
- *(da->dla_daddr+6) = sap;
- return (da);
- }
- dl->error = DLBADSAP;
- return (NULL);
-}
-
-int
-dl_parseaddr(unsigned char *addr, int len, unsigned char *paddr, long *sap,
- unsigned char *oi, long *oitype)
-{
- if (addr == NULL)
- return (-1);
- if (paddr) {
- memcpy(paddr, addr, 6);
- }
- if (sap) {
- switch (len) {
- case 8:
- *sap = *(unsigned short *)(addr + 6);
- break;
- case 7:
- case 12:
- *sap = *(unsigned char *)(addr + 6);
- if (*sap == 0xAA) {
- if (len != 12)
- return (-1);
- if (oi)
- memcpy(oi, addr + 7, 3);
- if (oitype)
- *oitype =
- *(unsigned short *)(addr + 10);
- }
- break;
- default:
- return (-1);
- }
- }
- return (0);
-}
diff --git a/usr/src/cmd/rpld/dl_attach.c b/usr/src/cmd/rpld/dl_attach.c
deleted file mode 100644
index 08349bd1c9..0000000000
--- a/usr/src/cmd/rpld/dl_attach.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Attach physical unit
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <errno.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-dl_attach(int fd, int unit)
-{
- struct dl_descriptor *dl;
- struct strbuf ctl;
- int flags;
-
- dl = _getdesc(fd);
- if (dl != NULL) {
- union DL_primitives prim;
-
- if (dl->info.state != DL_UNATTACHED) {
- if (dl->info.style != DL_STYLE_2)
- dl->error = DLNOTSUPP;
- else if (dl->info.state == DL_BOUND)
- dl->error = DLBOUND;
- else
- dl->error = DLSYSERR;
- return (-1);
- }
-
- prim.dl_primitive = DL_ATTACH_REQ;
- /* this is opaque data of 32-bits */
- prim.attach_req.dl_ppa = unit;
- ctl.maxlen = ctl.len = sizeof (prim);
- ctl.len = ctl.len = sizeof (prim.attach_req);
- ctl.buf = (char *)&prim;
- if (putmsg(fd, &ctl, NULL, 0) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- ctl.maxlen = sizeof (prim);
- flags = 0;
- if (getmsg(fd, &ctl, NULL, &flags) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- switch (prim.dl_primitive) {
- case DL_ERROR_ACK:
- dl->error = prim.error_ack.dl_errno;
- errno = prim.error_ack.dl_unix_errno;
- return (-1);
- case DL_OK_ACK:
- dl->info.state = DLSTATE_UNBOUND;
- return (0);
- default:
- dl->error = DLBADPRIM;
- return (-1);
- }
- }
- return (-1);
-}
diff --git a/usr/src/cmd/rpld/dl_bind.c b/usr/src/cmd/rpld/dl_bind.c
deleted file mode 100644
index f5cd923bc1..0000000000
--- a/usr/src/cmd/rpld/dl_bind.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Bind
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <errno.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-dl_bind(int fd, int sap, int xidtest, int oitype)
-{
- struct dl_descriptor *dl;
- struct strbuf ctl;
- int flags;
-
- dl = _getdesc(fd);
- if (dl != NULL) {
- union DL_primitives prim;
-
- if (dl->info.state != DL_UNBOUND) {
- dl->error = DLBOUND;
- return (-1);
- }
-
- ctl.maxlen = ctl.len = sizeof (dl_bind_req_t);
- ctl.buf = (char *)&prim;
- memset(&prim, '\0', sizeof (prim));
- prim.dl_primitive = DL_BIND_REQ;
- prim.bind_req.dl_sap = sap;
-#if defined(SNAP) && defined(DLPI_1)
- if (sap == 0xAA) {
- memcpy(&prim.bind_req.GROWTH_field[0], oi, 3);
- prim.bind_req.GROWTH_field[1] = oitype;
- }
-#endif
-#if !defined(DLPI_1)
- prim.bind_req.dl_max_conind = 0;
- prim.bind_req.dl_conn_mgmt = 0;
- prim.bind_req.dl_xidtest_flg = xidtest;
- prim.bind_req.dl_service_mode = DL_CLDLS;
-#endif
- if (putmsg(fd, &ctl, NULL, 0) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- ctl.maxlen = sizeof (prim);
- flags = 0;
- if (getmsg(fd, &ctl, NULL, &flags) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- switch (prim.dl_primitive) {
- case DL_ERROR_ACK:
- dl->error = prim.error_ack.dl_errno;
- errno = prim.error_ack.dl_unix_errno;
- printf("error=%d\n", dl->error);
- return (-1);
- case DL_BIND_ACK:
- dl->info.state = DLSTATE_IDLE;
- if (sap > 1500)
- /* patch things for later use */
- dl->info.addr_len = 8;
- else if (sap < 512) {
- if (sap == 0xAA)
- dl->info.addr_len = 12;
- else
- dl->info.addr_len = 7;
- }
- return (0);
- default:
- printf("bad prim\n");
- dl->error = DLBADPRIM;
- return (-1);
- }
- }
- printf("fell through\n");
- return (-1);
-}
diff --git a/usr/src/cmd/rpld/dl_close.c b/usr/src/cmd/rpld/dl_close.c
deleted file mode 100644
index 30e98a07a2..0000000000
--- a/usr/src/cmd/rpld/dl_close.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Close Descriptor
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <errno.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-dl_close(int fd)
-{
- struct dl_descriptor *dl;
-
- if ((dl = _getdesc(fd)) == NULL) {
- errno = EBADF;
- return (-1);
- }
- dl->openflag = 0;
- return (close(fd));
-}
diff --git a/usr/src/cmd/rpld/dl_error.c b/usr/src/cmd/rpld/dl_error.c
deleted file mode 100644
index b24fbeee91..0000000000
--- a/usr/src/cmd/rpld/dl_error.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - error routines
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-dl_errno(int fd)
-{
- struct dl_descriptor *dl;
-
- dl = _getdesc(fd);
- if (dl != NULL) {
- return (dl->error);
- }
- return (-1);
-}
diff --git a/usr/src/cmd/rpld/dl_info.c b/usr/src/cmd/rpld/dl_info.c
deleted file mode 100644
index 3c4f871523..0000000000
--- a/usr/src/cmd/rpld/dl_info.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Get info for user
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-dl_info(int fd, dl_info_t *info)
-{
- struct dl_descriptor *dl;
- struct strbuf ctl;
- int flags;
-
- dl = _getdesc(fd);
- if (dl != NULL) {
- if (dl_sync(fd) < 0)
- return (-1);
- if (info != NULL)
- *info = dl->info;
- return (0);
- }
- return (-1);
-}
diff --git a/usr/src/cmd/rpld/dl_open.c b/usr/src/cmd/rpld/dl_open.c
deleted file mode 100644
index f3c2816ddb..0000000000
--- a/usr/src/cmd/rpld/dl_open.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Open/Setup
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <errno.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-static struct dl_descriptor *_dlfds;
-static int _nfds;
-
-extern struct dl_address *dl_mkaddress();
-
-int
-dl_open(char *dev, int mode, dl_info_t *info)
-{
- int fd;
-
- if ((fd = open(dev, mode)) < 0) {
- return (-1);
- }
-
- ioctl(fd, I_SRDOPT, RMSGD);
-
- /* now have open device - do inforequest */
- if (info == NULL)
- return (dl_sync(fd));
- else if (dl_info(fd, info) < 0)
- return (-1);
- else
- return (fd);
-}
-
-/* this actually does the work that dl_open needs done also */
-int
-dl_sync(int fd)
-{
- struct strbuf ctl;
- dl_info_req_t ireq;
- dl_info_ack_t *iack;
- char buff[sizeof (dl_info_ack_t)+64];
- struct dl_descriptor *dl;
- int flags;
-
- /* first time? */
- if (_nfds == 0) {
- _nfds = ulimit(4, 0); /* number of possible file desc. */
- _dlfds = (struct dl_descriptor *)malloc(_nfds *
- sizeof (struct dl_descriptor));
- if (_dlfds == NULL)
- return (-1);
- }
-
- dl = &_dlfds[fd];
- dl->openflag = 1;
-
- /* get the info_ack data */
- ctl.maxlen = ctl.len = sizeof (ireq);
- ctl.buf = (char *)&ireq;
- ireq.dl_primitive = DL_INFO_REQ;
- if (putmsg(fd, &ctl, NULL, 0) < 0) {
- close(fd);
- return (-1);
- }
-
- iack = (dl_info_ack_t *)buff;
- ctl.maxlen = sizeof (buff);
- ctl.len = 0;
- ctl.buf = (char *)iack;
- flags = 0;
- if (getmsg(fd, &ctl, NULL, &flags) < 0) {
- close(fd);
- return (-1);
- }
- /* now have all in place */
- if (iack->dl_primitive != DL_INFO_ACK) {
- close(fd);
- return (-1);
- }
- /* now pick out the relevant information and fake the rest */
- dl->info.state = iack->dl_current_state;
- dl->info.max_lsdu = iack->dl_max_sdu;
- dl->info.min_lsdu = iack->dl_min_sdu;
- dl->info.addr_len = iack->dl_addr_length;
- dl->info.mac_type = iack->dl_mac_type;
- dl->info.class = iack->dl_service_mode;
- dl->info.style = iack->dl_provider_style;
-#if defined(DLPI_1)
- dl->info.address = (struct dl_address *)NULL;
- dl->info.broadcast = (struct dl_address *)NULL;
-#else
- dl->info.version = iack->dl_version;
- dl->info.sap_len = iack->dl_sap_length;
- dl->info.address = dl_mkaddress(fd, buff+iack->dl_addr_offset,
- 0, NULL, NULL);
- dl->info.broadcast = dl_mkaddress(fd,
- buff+iack->dl_brdcst_addr_offset, 0, NULL, NULL);
-#endif
- return (fd);
-}
-
-struct dl_descriptor *
-_getdesc(int fd)
-{
- struct dl_descriptor *dl;
-
- if (_nfds > 0 && fd < _nfds) {
- dl = &_dlfds[fd];
- if (dl->openflag)
- return (dl);
- }
- return (NULL);
-}
-
-int
-dl_error(int fd)
-{
- struct dl_descriptor *dl;
-
- if (_nfds > 0 && fd < _nfds) {
- dl = &_dlfds[fd];
- if (dl->openflag) {
- return (dl->error);
- }
- }
- errno = EBADF;
- return (DLSYSERR);
-}
diff --git a/usr/src/cmd/rpld/dl_rcv.c b/usr/src/cmd/rpld/dl_rcv.c
deleted file mode 100644
index 9d105acc50..0000000000
--- a/usr/src/cmd/rpld/dl_rcv.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Receive Data
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-dl_rcv(int fd, char *buff, int *bufflen, struct dl_address *addr)
-{
- struct dl_descriptor *dl;
- struct strbuf ctl, data;
- int flags = 0;
-
- if ((dl = _getdesc(fd)) != NULL) {
- unsigned char pbuff[sizeof (union DL_primitives)+24];
- union DL_primitives *prim = (union DL_primitives *)pbuff;
- int len;
- unsigned char *ap, *addrp;
-
- if (dl->info.state != DLSTATE_IDLE) {
- dl->error = DLUNBOUND;
- return (-1);
- }
- memset(prim, '\0', sizeof (prim));
- ctl.maxlen = ctl.len = sizeof (pbuff);
- ctl.buf = (char *)prim;
- data.maxlen = data.len = *bufflen;
- data.buf = buff;
- flags = 0;
- if (getmsg(fd, &ctl, &data, &flags) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- if (ctl.len == 0) {
- /* not really supported but ok */
- *bufflen = 0;
- return (0);
- }
- switch (prim->dl_primitive) {
- case DL_UNITDATA_IND:
- if (addr->dla_dmax > 0) {
- for (addr->dla_dlen = len =
- prim->unitdata_ind.dl_dest_addr_length,
- addrp = addr->dla_daddr,
- ap = ((unsigned char *)prim) +
- prim->unitdata_ind.dl_dest_addr_offset;
- len > 0; len--)
- *addrp++ = *ap++;
-#if !defined(DLPI_1)
- addr->dla_dflag =
- prim->unitdata_ind.dl_group_address;
-#endif
- }
- if (addr->dla_smax > 0) {
- for (addr->dla_slen = len =
- prim->unitdata_ind.dl_src_addr_length,
- addrp = addr->dla_saddr,
- ap = ((unsigned char *)prim) +
- prim->unitdata_ind.dl_src_addr_offset;
- len > 0; len--)
- *addrp++ = *ap++;
- }
- *bufflen = data.len;
- break;
- default:
- dl->error = DLOUTSTATE;
- return (-1);
- }
- return (0);
- }
- return (-1);
-}
diff --git a/usr/src/cmd/rpld/dl_snd.c b/usr/src/cmd/rpld/dl_snd.c
deleted file mode 100644
index ea5cfed913..0000000000
--- a/usr/src/cmd/rpld/dl_snd.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Send Data
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-#if defined(DLPI_1)
-dl_snd(int fd, char *buff, int bufflen, struct dl_address *addr)
-#else
-dl_snd(int fd, char *buff, int bufflen, struct dl_address *addr,
- dl_priority_t *priority)
-#endif
-{
- struct dl_descriptor *dl;
- struct strbuf ctl, data;
-
- if ((dl = _getdesc(fd)) != NULL) {
- union DL_primitives prim;
-
- if (dl->info.state != DLSTATE_IDLE) {
- dl->error = DLUNBOUND;
- return (-1);
- }
- memset(&prim, '\0', sizeof (prim));
- prim.unitdata_req.dl_primitive = DL_UNITDATA_REQ;
-#if !defined(DLPI_1)
- if (priority != NULL)
- prim.unitdata_req.dl_priority = *priority;
-#endif
- prim.unitdata_req.dl_dest_addr_length = addr->dla_dlen;
- prim.unitdata_req.dl_dest_addr_offset =
- sizeof (dl_unitdata_req_t);
- memcpy(((unsigned char *)&prim)+sizeof (dl_unitdata_req_t),
- addr->dla_daddr, addr->dla_dlen);
- ctl.maxlen = ctl.len =
- sizeof (dl_unitdata_req_t) + addr->dla_dlen;
- ctl.buf = (char *)&prim;
- data.maxlen = data.len = bufflen;
- data.buf = buff;
- if (putmsg(fd, &ctl, &data, 0) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- return (0);
- }
- return (-1);
-}
diff --git a/usr/src/cmd/rpld/dl_unbind.c b/usr/src/cmd/rpld/dl_unbind.c
deleted file mode 100644
index 6eb1e4fcbb..0000000000
--- a/usr/src/cmd/rpld/dl_unbind.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * Data Link API - Unbind Descriptor
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/dlpi.h>
-#include <errno.h>
-#include <dluser.h>
-#include <dlhdr.h>
-
-extern struct dl_descriptor *_getdesc();
-
-int
-dl_unbind(int fd)
-{
- struct dl_descriptor *dl;
- struct strbuf ctl;
- int flags;
- union DL_primitives prim;
-
- if ((dl = _getdesc(fd)) == NULL) {
- errno = EBADF;
- return (-1);
- }
- if (dl->info.state == DLSTATE_IDLE) {
- ctl.maxlen = ctl.len = sizeof (dl_unbind_req_t);
- ctl.buf = (char *)&prim;
- memset(&prim, '\0', sizeof (prim));
- prim.dl_primitive = DL_UNBIND_REQ;
- } else {
- dl->error = DLOUTSTATE;
- return (-1);
- }
- if (putmsg(fd, &ctl, NULL, 0) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- ctl.maxlen = sizeof (prim);
- flags = 0;
- if (getmsg(fd, &ctl, NULL, &flags) < 0) {
- dl->error = DLSYSERR;
- return (-1);
- }
- if (prim.dl_primitive != DL_OK_ACK) {
- dl->error = DLOUTSTATE;
- return (-1);
- }
- return (0);
-}
diff --git a/usr/src/cmd/rpld/dlhdr.h b/usr/src/cmd/rpld/dlhdr.h
deleted file mode 100644
index 7106143f05..0000000000
--- a/usr/src/cmd/rpld/dlhdr.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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 1992 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * types used internally to DL library
- */
-
-struct dl_descriptor {
- int openflag;
- int error;
- dl_info_t info;
-};
-
-#if !defined(NULL)
-#define NULL (0)
-#endif
diff --git a/usr/src/cmd/rpld/dluser.h b/usr/src/cmd/rpld/dluser.h
deleted file mode 100644
index eec94aa9dc..0000000000
--- a/usr/src/cmd/rpld/dluser.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * definitions for use with DL library
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#define DLSTATE_UNBOUND 0
-#define DLSTATE_UNATTACHED 1
-#define DLSTATE_IDLE 3
-
-#define DLTYPE_IEEE8023 0
-#define DLTYPE_IEEE8024 1
-#define DLTYPE_IEEE8025 2
-#define DLTYPE_IEEE8026 3
-#define DLTYPE_ETHER 4
-#define DLTYPE_HDLC 5
-#define DLTYPE_CHARSYNC 6
-#define DLTYPE_IBMCHAN 7
-#define DLTYPE_ETHEROR 0xF0
-
-#define DLCLASS_CODLS 1
-#define DLCLASS_CLDLS 2
-
-#define DLBADSAP 0
-#define DLACCESS 2
-#define DLOUTSTATE 3
-#define DLSYSERR 4
-/* defined by API */
-#define DLBOUND 8 /* already bound */
-#define DLBADPRIM 9
-#define DLUNBOUND 10
-#define DLNOTSUPP 11
-
-#define MAXPRIMSZ 100
-
-/* address structure constructed with dl_mkaddr */
-struct dl_address {
- int dla_dlen;
- int dla_dmax;
- unsigned char *dla_daddr;
- int dla_dflag; /* multicast/broadcast flag */
- int dla_slen;
- int dla_smax;
- unsigned char *dla_saddr;
- int dla_sflag; /* multicast/broadcast flag */
-};
-
-/* dl_alloc field definitions */
-#define DL_ALL 0xf /* both addresses */
-#define DL_SRC 0x1 /* source address field */
-#define DL_DST 0x2 /* destination address field */
-
-/* Driver styles */
-#define DL_STYLE_1 1
-#define DL_STYLE_2 2
-
-/* used both internally and externally */
-typedef struct dl_information {
- unsigned long version;
- unsigned long state;
- unsigned long style;
- unsigned long max_lsdu;
- unsigned long min_lsdu;
- unsigned long addr_len;
- unsigned long sap_len;
- unsigned long mac_type;
- unsigned long class;
- struct dl_address *address;
- struct dl_address *broadcast;
-} dl_info_t;
-
-/*
- * flags returned by dl_rcv
- */
-#define DL_FLAG_MULTICAST 0x01 /* includes broadcast */
diff --git a/usr/src/cmd/rpld/getaddr.c b/usr/src/cmd/rpld/getaddr.c
deleted file mode 100644
index 6b24f25d5b..0000000000
--- a/usr/src/cmd/rpld/getaddr.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/wd.h>
-
-main(argc, argv)
- char *argv[];
-{
- struct strioctl ioc;
- unsigned char oldaddr[6];
-#if defined(DLPI_1)
- int fd = open(argc>1 ? argv[1] : "/dev/wd0", 2);
- if (fd < 0){
- perror("open");
- exit(1);
- }
- ioc.ic_cmd = DLGADDR;
- ioc.ic_dp = oldaddr;
- ioc.ic_len = 6;
- if (ioctl(fd, I_STR, &ioc)<0){
- perror("DLGADDR");
- }
- printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
- oldaddr[0],
- oldaddr[1],
- oldaddr[2],
- oldaddr[3],
- oldaddr[4],
- oldaddr[5]);
-#else
- dl_info_t info;
- unsigned char *oaddr;
- fd = dl_open(argc>1 ? argv[1] : "/dev/wd0", 2, &info);
- oaddr = info->
-#endif
- printf("%02x:%02x:%02x:%02x:%02x:%02x\n",
- oldaddr[0],
- oldaddr[1],
- oldaddr[2],
- oldaddr[3],
- oldaddr[4],
- oldaddr[5]);
-}
diff --git a/usr/src/cmd/rpld/llcsetup.c b/usr/src/cmd/rpld/llcsetup.c
deleted file mode 100644
index 667d23334d..0000000000
--- a/usr/src/cmd/rpld/llcsetup.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * 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 2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stropts.h>
-#include <poll.h>
-#include <sys/dlpi.h>
-#include <sys/ethernet.h>
-
-#include <sys/stream.h>
-#include <sys/kstat.h>
-#include <sys/llc1.h>
-
-#include <dirent.h>
-
-#include "rpld.h"
-#include "dluser.h"
-
-#define BUFSIZE 10000
-
-unsigned char multAddr[6] = {0x03, 0x00, 0x02, 0x00, 0x00, 0x00};
-unsigned char multAddr2[6] = {0xc0, 0x00, 0x40, 0x00, 0x00, 0x00};
-
-static char *llcdev;
-
-extern int if_fd;
-extern struct pollfd llc_fd;
-extern char ifName[];
-extern int debugLevel;
-extern char debugmsg[];
-extern int ifUnit;
-extern int ppanum;
-extern int need_llc;
-
-struct ether_addr myNodeAddr;
-/*
- * Next lines makes enabmulti, and thus its fields, 32 bit aligned. This is
- * necessary on sparc. Space allocated must be rounded up to the next highest
- * number of words.
- */
-uint32_t enabmulti_aligned[(
- DL_ENABMULTI_REQ_SIZE /* Basic size */
- + 10 /* Address */
- + sizeof (uint32_t) - 1)/ /* Round up */
- sizeof (uint32_t)]; /* Convert to 32 bit */
-char *enabmulti = (char *)enabmulti_aligned;
-union DL_primitives *enabp = (union DL_primitives *)enabmulti_aligned;
-
-int
-llcsetup(void)
-{
-struct strbuf ctl;
-char resultbuf[MAXPRIMSZ]; /* Bigger than largest DLPI */
- /* struct size */
-union DL_primitives *dlp = (union DL_primitives *)resultbuf;
-struct ll_snioc snioc;
-struct strioctl strio;
-int flags = 0;
-int muxid;
-char myname[64];
-struct ether_addr eas;
-DIR *dp;
-struct dirent *de;
-int use_llc1;
-unsigned char *multAddrp;
-dl_info_t if_info;
-
-
- /*
- * Open a stream to the Ethernet driver.
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "Opening %s\n", ifName);
- senddebug(MSG_INFO_2);
- }
- if ((if_fd = dl_open(ifName, O_RDWR, NULL)) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Cannot open device %s\n", ifName);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- if (dl_info(if_fd, &if_info) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Cannot get info from device %s\n",
- ifName);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * Attach the Ethernet stream to PPA specified by ifUnit.
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "Sending DL_ATTACH_REQ to %s for PPA %d\n",
- ifName, ifUnit);
- senddebug(MSG_INFO_2);
- }
- if (dl_attach(if_fd, ifUnit) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Failed in dl_attach of %s to %d\n",
- ifName, ifUnit);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * Get the node address
- */
- if (dlpi_get_phys(if_fd, &myNodeAddr) == 0) {
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "My node address: %s ",
- ether_ntoa(&myNodeAddr));
- senddebug(MSG_INFO_1);
- sprintf(debugmsg, "\n");
- senddebug(MSG_INFO_1);
- }
- } else {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Cannot get my own node address\n");
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * Bind the Ethernet stream to SAP 0xfc.
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "Sending DL_BIND_REQ to ethernet driver\n");
- senddebug(MSG_INFO_2);
- }
- if (dl_bind(if_fd, 0xFC, 0, 0) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Failed in dl_bind to %s\n", ifName);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- if (debugLevel >= MSG_INFO_1) {
- if (need_llc)
- sprintf(debugmsg, "Need to link LLC under %s\n",
- ifName);
- else
- sprintf(debugmsg, "No need to link LLC under %s\n",
- ifName);
- senddebug(MSG_INFO_1);
- }
-
- /*
- * Token ring (IEEE 802.5) has the multicast address bytes
- * bit-reversed (but not byte-reserved)
- */
- if (if_info.mac_type == DLTYPE_IEEE8025)
- multAddrp = multAddr2;
- else
- multAddrp = multAddr;
-
- if (need_llc) {
- /*
- * Open a stream to the LLC driver.
- * At this point it is certain that an llc device is needed
- * So we try only llc1.
- */
-
- llcdev = "/dev/llc1";
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "Opening %s for SAP FC\n",
- llcdev);
- senddebug(MSG_INFO_2);
- }
-
- if ((llc_fd.fd = dl_open(llcdev, O_RDWR, NULL)) < 0) {
- /*
- * llc1 doesnt work barf and quit.
- */
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed to open device %s\n",
- llcdev);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * I_LINK ifName underneath /dev/llc
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "Linking %s underneath %s FC case\n",
- ifName, llcdev);
- senddebug(MSG_INFO_2);
- }
- if ((muxid = ioctl(llc_fd.fd, I_LINK, if_fd)) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed to I_LINK %s under %s\n",
- ifName, llcdev);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * Set the PPA of the Ethernet driver to ppanum.
- * (This is the PPA that LLC clients need to specify when they
- * attach to LLC.)
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "setting PPA to %d\n", ppanum);
- senddebug(MSG_INFO_2);
- }
- snioc.lli_type = LI_SPPA;
- snioc.lli_ppa = ppanum;
- snioc.lli_index = muxid;
- strio.ic_cmd = L_SETPPA;
- strio.ic_timout = -1; /* Infinite timeout */
- strio.ic_len = sizeof (snioc);
- strio.ic_dp = (char *)&snioc;
- if (ioctl(llc_fd.fd, I_STR, (char *)&strio) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed to set PPA %d to device %s\n",
- ppanum, llcdev);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * Attach the LLC stream to PPA ppanum.
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg,
- "Sending DL_ATTACH_REQ to %s FC\n", llcdev);
- senddebug(MSG_INFO_2);
- }
- if (dl_attach(llc_fd.fd, ppanum) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed to attach to device %s\n",
- llcdev);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * Bind the LLC stream to SAP 0xfc.
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg,
- "Sending DL_BIND_REQ to %s FC\n", llcdev);
- senddebug(MSG_INFO_2);
- }
- if (dl_bind(llc_fd.fd, 0xFC, DL_AUTO_TEST | DL_AUTO_XID, 0)
- < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed to bind to device %s\n",
- llcdev);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
- } else {
- /* All subsequent I/O done using llc_fd.fd */
- llc_fd.fd = if_fd;
- }
-
- /*
- * Set the RPL multicast address
- */
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "setting RPL multicast address\n");
- senddebug(MSG_INFO_2);
- }
- enabp->enabmulti_req.dl_primitive = DL_ENABMULTI_REQ;
- enabp->enabmulti_req.dl_addr_length = 6;
- enabp->enabmulti_req.dl_addr_offset = DL_ENABMULTI_REQ_SIZE;
- memcpy(&enabmulti[DL_ENABMULTI_REQ_SIZE], multAddrp, 6);
- ctl.len = DL_ENABMULTI_REQ_SIZE + 6;
-
- ctl.buf = enabmulti;
- if (putmsg(llc_fd.fd, &ctl, NULL, 0) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed to enable RPL required multicast address\n");
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /*
- * Read the acknowledgement message (will be DL_OK_ACK if
- * it was successful).
- */
- ctl.maxlen = MAXPRIMSZ;
- ctl.buf = resultbuf;
- if (getmsg(llc_fd.fd, &ctl, NULL, &flags) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed in getmsg() to receive ack for multicast enable operation\n");
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- if (dlp->dl_primitive != DL_OK_ACK) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "dl_errno %d unix_errno %d\n",
- dlp->error_ack.dl_errno,
- dlp->error_ack.dl_unix_errno);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- return (0);
-}
-
-int
-dlpi_get_phys(int fd, uchar_t *eaddr)
-{
- union DL_primitives *dlp;
- char *buf;
- struct strbuf ctl;
- int flags;
- int tmp;
-
- /* Allocate required buffers */
- if ((buf = (char *)memalign(BUFSIZE, sizeof (uint32_t))) == NULL) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "malloc() failed\n");
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /* Issue DL_PHYS_ADDR_REQ */
- dlp = (union DL_primitives *)buf;
-
- dlp->physaddr_req.dl_primitive = DL_PHYS_ADDR_REQ;
- dlp->physaddr_req.dl_addr_type = DL_CURR_PHYS_ADDR;
- ctl.buf = (char *)dlp;
- ctl.len = DL_PHYS_ADDR_REQ_SIZE;
- if (putmsg(fd, &ctl, NULL, 0) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed in putmsg() for DL_PHYS_ADDR_REQ\n");
- senddebug(MSG_FATAL);
- }
- (void) free(buf);
- return (-1);
- }
- /* read reply */
- ctl.buf = (char *)dlp;
- ctl.len = 0;
- ctl.maxlen = BUFSIZE;
- flags = 0;
- if ((tmp = getmsg(fd, &ctl, NULL, &flags)) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed in getmsg() for DL_PHYS_ADDR_REQ\n");
- senddebug(MSG_FATAL);
- }
- (void) free(buf);
- return (-1);
- }
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg,
- "phys_addr_ack: ret[%d] ctl.len[%d] flags[%d]\n",
- tmp, ctl.len, flags);
- senddebug(MSG_ALWAYS);
- }
- /* Validate DL_PHYS_ADDR_ACK reply */
- if (ctl.len < sizeof (ulong_t)) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "phys_addr failed: short reply to phys_addr request\n");
- senddebug(MSG_FATAL);
- }
- (void) free(buf);
- return (-1);
- }
-
- if (dlp->dl_primitive == DL_ERROR_ACK) {
- /*
- * Do not print errors for DL_UNSUPPORTED and DL_NOTSUPPORTED
- */
- if (dlp->error_ack.dl_errno != DL_UNSUPPORTED &&
- dlp->error_ack.dl_errno != DL_NOTSUPPORTED) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "phys_addr failed: dl_errno %d unix_errno %d\n",
- dlp->error_ack.dl_errno,
- dlp->error_ack.dl_unix_errno);
- senddebug(MSG_FATAL);
- }
- }
- (void) free(buf);
- return (-1);
- }
- if (dlp->dl_primitive != DL_PHYS_ADDR_ACK) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "phys_addr failed: unrecognizable dl_primitive %d received\n",
- dlp->dl_primitive);
- senddebug(MSG_FATAL);
- }
- (void) free(buf);
- return (-1);
- }
- if (ctl.len < DL_PHYS_ADDR_ACK_SIZE) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "phys_addr failed: short phys_addr acknowledgement received\n");
- senddebug(MSG_FATAL);
- }
- (void) free(buf);
- return (-1);
- }
- /* Check length of address. */
- if (dlp->physaddr_ack.dl_addr_length != ETHERADDRL)
- return (-1);
- /*
- * copy ethernet address
- */
- memcpy((char *)eaddr, (char *)(buf + dlp->physaddr_ack.dl_addr_offset),
- ETHERADDRL);
- (void) free(buf);
- return (0);
-}
diff --git a/usr/src/cmd/rpld/params.c b/usr/src/cmd/rpld/params.c
deleted file mode 100644
index 5c59e60327..0000000000
--- a/usr/src/cmd/rpld/params.c
+++ /dev/null
@@ -1,808 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/fcntl.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <poll.h>
-#include <errno.h>
-#include <sys/dlpi.h>
-#include <sys/stropts.h>
-#include <syslog.h>
-#include <net/if.h>
-#include "rpld.h"
-#include "dluser.h"
-
-#define MAXIFS 256
-
-extern char configFile[];
-extern int debugLevel;
-extern int debugDest;
-extern int maxClients;
-extern int backGround;
-extern char logFile[];
-extern unsigned long delayGran;
-extern unsigned long startDelay;
-extern int frameSize;
-extern char ifName[];
-extern char debugmsg[];
-extern FILE *log_str;
-extern int ifUnit;
-extern int ppanum;
-extern int need_llc;
-
-void usage(void);
-void getdevice(uchar_t *, uchar_t *);
-
-int
-parseargs(int argc, char *argv[], char *envp[])
-{
- int c;
- int err = 0;
- int ip_fd;
- int numifs;
- struct ifreq *reqbuf;
- struct ifreq *ifr;
- char *device;
- int unit;
- struct ifconf ifconf;
- unsigned bufsize;
- char devbuf[MAXPATHLEN];
- int aflag = 0;
- int curr_ppa = 0;
- extern char *optarg;
- extern int optind;
- extern int opterr;
- int n;
- int more = 0;
- char _ifName[MAXPATHLEN] = "";
- int _ifUnit = 0;
- int _need_llc;
-
- opterr = 0;
-
- /*
- * Expects at least 2 arguments: program name and the network
- * interface name, or the program name with -a option.
- */
- if (argc < 2) {
- usage();
- return (-1);
- }
-
- debugLevel = MSG_ERROR_1; /* at least when it fails, we know */
- debugDest = DEST_CONSOLE; /* why at the console */
-
- /*
- * Check if either the -a option or a /dev/deviceN path is specified.
- * At the same time look for an alternate config file.
- * After this checking, optind is positioned to the next thing on
- * the command line after all the options.
- */
- optind = 1;
- while ((c = getopt(argc, argv, "af:d:D:M:b:l:s:g:z:")) != -1) {
- switch (c) {
- case 'a':
- aflag = 1;
- break;
- case 'f': /* alternate config file */
- if (strlcpy(configFile, optarg,
- MAXPATHLEN) >= MAXPATHLEN) {
- printf("Alternate config file too long\n");
- return (-1);
- }
- break;
- case '?':
- usage();
- return (-1);
- }
- }
-
- if (!aflag) {
- if ((argv[optind] == NULL) || (argv[optind][0] == '\0')) {
- /* neither -a nor device name is specified */
- usage();
- return (-1);
- } else {
- /* potentially a correct device name is specified */
- int i;
-
- if (strlcpy(ifName, argv[optind],
- MAXPATHLEN) >= MAXPATHLEN) {
- printf("Network interface name too long\n");
- return (-1);
- }
-
- /* must have a PPA number */
- i = strlen(ifName) - 1;
- if ((ifName[i] < '0') || (ifName[i] > '9')) {
- usage();
- return (-1);
- }
-
- /* extract the PPA number and device path */
- while (i) {
- if ((ifName[i] < '0') || (ifName[i] > '9'))
- break;
- else
- i--;
- }
-
- if (i) {
- ifUnit = atoi(&ifName[i+1]);
- ifName[i+1] = '\0';
- } else {
- usage();
- return (-1);
- }
- }
- } else {
- /* cannot have both -a and device */
- if (argv[optind] && argv[optind][0]) {
- usage();
- return (-1);
- }
- }
-
-
- /* Read the configuration file now */
-#define NOTRUNNING 0
- readconfig(NOTRUNNING);
-
- /* Now override any parameters with command line options */
- optind = 1;
- while ((c = getopt(argc, argv, "af:d:D:M:b:l:s:g:z:")) != -1) {
- switch (c) {
- case 'd': /* debug level */
- debugLevel = atoi(optarg);
- break;
- case 'D': /* debug output destination */
- debugDest = atoi(optarg);
- break;
- case 'M': /* max clients */
- maxClients = atoi(optarg);
- break;
- case 'b': /* background mode */
- backGround = atoi(optarg);
- break;
- case 'l': /* alt. log file name */
- if (strlcpy(logFile, optarg,
- MAXPATHLEN) >= MAXPATHLEN) {
- printf("Alternate log file too long\n");
- return (-1);
- }
- break;
- case 's': /* start delay count */
- startDelay = atol(optarg);
- break;
- case 'g': /* granularity */
- delayGran = atol(optarg);
- break;
- case 'z': /* frame size */
- frameSize = atoi(optarg);
- break;
- case '?':
- err++;
- }
- }
-
- if (debugLevel && (open_debug_dest() < 0)) {
- printf("Cannot open specified debug destination\n");
- return (-1);
- }
-
- /* debugLevel and debugDest finally has meaning now */
-
- if (debugLevel < MSG_NONE || debugLevel > MSG_ALWAYS) {
- sprintf(debugmsg,
- "Debug level out of range. Legal range is 0-9.\n");
- senddebug(MSG_FATAL);
- err++;
- }
-
- if (backGround && debugDest == DEST_CONSOLE) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Cannot run in background while "
- "sending debug information to console.\n");
- senddebug(MSG_FATAL);
- }
- err++;
- }
-
- if ((long)delayGran < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Cannot have negative delay granularity.\n");
- senddebug(MSG_FATAL);
- }
- err++;
- }
-
- if (err) {
- usage();
- return (-1);
- }
-
- if (aflag) {
- /*
- * Find all the network interfaces and start a server on
- * each of them.
- */
- if ((ip_fd = open("/dev/ip", 0)) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed to open IP, -a option failed.\n");
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
-
- /* ask IP for the list of configured interfaces */
-#ifdef SIOCGIFNUM
- if (ioctl(ip_fd, SIOCGIFNUM, (char *)&numifs) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "Failed ioctl(SIOCGIFNUM)\n");
- senddebug(MSG_FATAL);
- }
- close(ip_fd);
- return (-1);
- }
-#else
- numifs = MAXIFS;
-#endif
- bufsize = numifs*sizeof (struct ifreq);
- reqbuf = (struct ifreq *)malloc(bufsize);
- if (reqbuf == NULL) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Failed to allocate memory "
- "to look up configured interfaces in IP.\n");
- senddebug(MSG_FATAL);
- sprintf(debugmsg, "-a option failed.\n");
- senddebug(MSG_FATAL);
- }
- close(ip_fd);
- return (-1);
- }
- ifconf.ifc_len = bufsize;
- ifconf.ifc_buf = (caddr_t)reqbuf;
- if (ioctl(ip_fd, SIOCGIFCONF, (char *)&ifconf) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "SIOCGIFCONF failed, -a option failed.\n");
- senddebug(MSG_FATAL);
- }
- close(ip_fd);
- free(reqbuf);
- return (-1);
- }
-
- /*
- * Fork and pass discovered interface name through the
- * global variables ifName and ifUnit
- */
- for (ifr = ifconf.ifc_req; ifconf.ifc_len > 0;
- ifr++, ifconf.ifc_len -= sizeof (struct ifreq)) {
- if (ioctl(ip_fd, SIOCGIFFLAGS, (char *)ifr) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "ioctl SIOCGIFFLAGS failed.\n");
- senddebug(MSG_FATAL);
- }
- free(reqbuf);
- close(ip_fd);
- return (-1);
- }
- if ((ifr->ifr_flags & IFF_LOOPBACK) ||
- !(ifr->ifr_flags & IFF_BROADCAST) ||
- !(ifr->ifr_flags & IFF_UP) ||
- (ifr->ifr_flags & IFF_NOARP) ||
- (ifr->ifr_flags & IFF_POINTOPOINT))
- continue;
-
- if (strchr(ifr->ifr_name, ':') != NULL)
- /*
- * rpld only cares about DLPI devices and only
- * the physical IP interfaces correspond to
- * a DLPI device.
- */
- continue;
-
- /*
- * check if this interface needs LLC and if so,
- * remember which PPA in LLC to use. Assume that
- * only llc1 is used.
- */
- (void) strlcpy(devbuf, "/dev/", MAXPATHLEN);
- getdevice((uchar_t *)ifr->ifr_name,
- (uchar_t *)&devbuf[5]);
- (void) strlcpy(ifName, devbuf, MAXPATHLEN);
- ifUnit = unit = getunit(ifr->ifr_name);
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "found interface = %s%d\n",
- ifName, ifUnit);
- senddebug(MSG_INFO_1);
- }
-
- if (llc_is_needed(ifName, ifUnit)) {
- need_llc = 1;
- } else
- need_llc = 0;
-
- if (more) {
- switch (fork()) {
- case -1: /* failure */
- free(reqbuf);
- close(ip_fd);
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Fork() "
- "failed to run rpld on "
- "interface %s%d\n", ifName,
- ifUnit);
- senddebug(MSG_FATAL);
- }
- return (-1);
- break;
- case 0: /* child */
- free(reqbuf);
- close(ip_fd);
- if (debugLevel >= MSG_INFO_2)
- dumpparams();
- return (0);
- default: /* parent */
- break;
- }
-
- /* prepare for next ppanum for LLC */
- ppanum++;
- }
-
- /*
- * retain the first found interface for the
- * parent process
- */
- if (!more) {
- more = 1;
- (void) strlcpy(_ifName, ifName, MAXPATHLEN);
- _ifUnit = ifUnit;
- _need_llc = need_llc;
- }
- } /* for */
-
- free(reqbuf);
- close(ip_fd);
-
- } /* aflag */
-
- /* parent always use ppanum of 0 */
- ppanum = 0;
- (void) strlcpy(ifName, _ifName, MAXPATHLEN);
- ifUnit = _ifUnit;
- need_llc = _need_llc;
-
- if (debugLevel >= MSG_INFO_2)
- dumpparams();
-
- return (0);
-}
-
-/* returns 1 if need LLC, 0 if not, -1 if error occurs */
-int
-llc_is_needed(char *devname, int ifUnit)
-{
- int if_fd;
- dl_info_t if_info;
- struct strbuf ctl;
- char resultbuf[MAXPRIMSZ];
- union DL_primitives *dlp = (union DL_primitives *)resultbuf;
- unsigned char node_address[6];
- int flags = 0;
-
- /* open this device */
- if ((if_fd = dl_open(ifName, O_RDWR, NULL)) < 0) {
- return (-1);
- }
-
- /* query information about this device */
- if (dl_info(if_fd, &if_info) < 0) {
- dl_close(if_fd);
- return (-1);
- }
-
- /*
- * Check if we need to use the LLC module. This is needed if:
- * 1. a DL_INFO_REQ determines that the device is of type DL_ETHER
- * 2. an attempt to do a DL_TEST_REQ to yourself does not return
- * an error ack for non-DL_ETHER devices.
- */
- if (if_info.mac_type == DLTYPE_ETHER) {
- dl_close(if_fd);
- return (1);
- } else {
- struct pollfd pfd;
- int rc;
-
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg,
- "Need to determine if LLC driver is needed\n");
- senddebug(MSG_INFO_1);
- }
-
- /* attach to ifUnit */
- if (dl_attach(if_fd, ifUnit) < 0) {
- dl_close(if_fd);
- return (-1);
- }
-
- /* find out own node address for use in test */
- if (dlpi_get_phys(if_fd, node_address) != 0) {
- dl_close(if_fd);
- return (-1);
- }
-
- dlp->test_req.dl_primitive = DL_TEST_REQ;
- dlp->test_req.dl_flag = 0;
- dlp->test_req.dl_dest_addr_length = 7;
- dlp->test_req.dl_dest_addr_offset = DL_TEST_REQ_SIZE;
- memcpy(&resultbuf[DL_TEST_REQ_SIZE], node_address, 6);
- resultbuf[DL_TEST_REQ_SIZE+6] = (unsigned char)0xfc;
-
- ctl.len = DL_TEST_REQ + 7;
- ctl.buf = resultbuf;
- if (putmsg(if_fd, &ctl, NULL, 0) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "putmsg() failed in DL_TEST_REQ, errno = %d\n", errno);
- senddebug(MSG_FATAL);
- }
- dl_close(if_fd);
- return (-1);
- }
-
- pfd.fd = if_fd;
- pfd.events = POLLIN | POLLPRI | POLLERR;
- rc = poll(&pfd, 1, 10); /* 10 millisec timeout */
- if (rc == 0) {
- /* no reply message, assume LLC is available */
- } else if (rc > 0) {
- ctl.maxlen = MAXPRIMSZ;
- ctl.buf = resultbuf;
- if (getmsg(if_fd, &ctl, NULL, &flags) < 0) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg,
- "getmsg() failed in DL_TEST_REQ, errno = %d\n", errno);
- senddebug(MSG_FATAL);
- }
- dl_close(if_fd);
- return (-1);
- }
- if (dlp->dl_primitive == DL_ERROR_ACK) {
- dl_close(if_fd);
- return (1);
- }
- } else {
- /* error occurs */
- dl_close(if_fd);
- return (-1);
- }
- }
- dl_close(if_fd);
- return (0);
-}
-
-/*
- * Read the configuration parameters in the config file.
- * Different actions are required if the server is already running or not
- */
-int
-readconfig(int running)
-{
- FILE *fstr;
- int i, n;
- char line[80];
- int lineno = 0;
- int done = 0;
- int debugDestChange;
- unsigned int newDebugDest;
- int logFileChange;
- char newLogFile[MAXPATHLEN];
-
- if ((fstr = fopen(configFile, "r")) == NULL) {
- if (running) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg,
- "Cannot open config file %s\n", configFile);
- senddebug(MSG_ERROR_1);
- }
- } else {
- printf("Cannot open config file %s.\n", configFile);
- }
-
- /*
- * If already running, do not fall back to use the default
- * config file.
- */
- if (running)
- return (0);
-
- /* Try to use default config file if not already done so */
- if (strcmp(configFile, DFT_CONFIGFILE) != 0) {
- printf("Using the default config file %s\n",
- DFT_CONFIGFILE);
- (void) strlcpy(configFile, DFT_CONFIGFILE, MAXPATHLEN);
- if ((fstr = fopen(configFile, "r")) == NULL) {
- if (running && debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg, "Cannot open "
- "default config file. Using "
- "default values.\n");
- senddebug(MSG_ERROR_1);
- } else {
- printf("Cannot open default config "
- "file. Using default values.\n");
- }
- return (0);
- }
- } else {
- return (0);
- }
- }
-
- if (running && (debugLevel >= MSG_INFO_1)) {
- sprintf(debugmsg, "Reading config file %s\n", configFile);
- senddebug(MSG_INFO_1);
- }
-
- do {
- lineno++;
- n = readline(fstr, line, 80);
-
- if (line[0] == '\0' || line[0] == COMMENT_CHAR)
- continue;
- /*
- * We now scan the input line and put a NULL at the
- * end of the keyword token. This way, we can compare
- * the keyword token by strcmp(line, "...")
- *
- * At the same time, we find the start of the value
- * token so that we can retrieve the value by something
- * like atoi(&line[i])
- */
- i = 0;
- while (line[i] != ' ' && line[i] != TAB)
- i++;
- line[i++] = '\0'; /* put NULL after keyword token */
-
- while (line[i] < '0' || line[i] > 'z' ||
- (line[i] > '9' && line[i] < 'A') ||
- (line[i] > 'Z' && line[i] < 'a'))
- i++;
-
- if (strcmp(line, "DebugLevel") == 0)
- debugLevel = atoi(&line[i]);
- else if (strcmp(line, "DebugDest") == 0) {
- if (!running) {
- debugDest = atoi(&line[i]);
- } else {
- debugDestChange = 0;
- newDebugDest = atoi(&line[i]);
-
- if (debugDest == atoi(&line[i]))
- continue;
- /*
- * Don't allow running in background to
- * re-acquire the controlling terminal
- */
- if (backGround &&
- atoi(&line[i]) == DEST_CONSOLE)
- continue;
- /*
- * We have determined that there is a
- * legal change of the debug destination.
- * However, we cannot do the actual change
- * now because the log file may also change.
- * So we set a flag and do it later.
- */
- debugDestChange = 1;
- }
- } else if (strcmp(line, "MaxClients") == 0) {
- /* can be -1 which means unlimited */
- if (line[i-1] == '-')
- i--;
- maxClients = atoi(&line[i]);
- } else if (strcmp(line, "BackGround") == 0) {
- if (!running)
- backGround = atoi(&line[i]);
- } else if (strcmp(line, "LogFile") == 0) {
- if (line[i-1] == '/')
- i--;
- if (!running) {
- (void) strlcpy(logFile, &line[i], MAXPATHLEN);
- } else {
- logFileChange = 0;
- (void) strlcpy(newLogFile, &line[i],
- MAXPATHLEN);
- if (strcmp(newLogFile, logFile) == 0)
- continue;
- else
- logFileChange = 1;
- }
- } else if (strcmp(line, "DelayGran") == 0)
- delayGran = atol(&line[i]);
- else if (strcmp(line, "StartDelay") == 0)
- startDelay = atol(&line[i]);
- else if (strcmp(line, "FrameSize") == 0)
- frameSize = atoi(&line[i]);
- else if (strcmp(line, "end") == 0)
- done = 1;
- } while (!done);
-
- fclose(fstr);
-
- if (running) {
- if (debugDestChange || logFileChange) {
- switch (debugDest) {
- case DEST_SYSLOGD:
- closelog();
- break;
- case DEST_LOGFILE:
- if (log_str != NULL)
- fclose(log_str);
- log_str = NULL;
- break;
- }
- debugDest = newDebugDest;
- switch (debugDest) {
- case DEST_SYSLOGD:
- openlog("rpld", LOG_PID, LOG_DAEMON);
- break;
- case DEST_LOGFILE:
- log_str = fopen(newLogFile, "a+");
- if (log_str == NULL) {
- /* cannot open the new log file */
- /* reopen the old one and use that */
- log_str = fopen(logFile, "a+");
- if (log_str == NULL) {
- /* we are doomed */
- ;
- }
- setbuf(log_str, (char *)NULL);
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Cannot "
- "open new log file %s\n",
- newLogFile);
- senddebug(MSG_FATAL);
- sprintf(debugmsg, "Re-using "
- "old log file %s\n",
- logFile);
- senddebug(MSG_FATAL);
- }
- } else {
- (void) strlcpy(logFile, newLogFile,
- MAXPATHLEN);
- setbuf(log_str, (char *)NULL);
- }
- break;
- }
- }
- }
- return (0);
-}
-
-int
-readline(FILE *str, char *buf, int count)
-{
- int i = 0;
- int done = 0;
- int ch;
-
- while (!done && i < count) {
- ch = getc(str);
- if (ch == LF || ch == CR || ch == EOF) {
- done = 1;
- } else {
- buf[i++] = ch;
- }
- }
- buf[i] = '\0';
- return (i);
-}
-
-int
-open_debug_dest(void)
-{
- if (debugDest == DEST_LOGFILE) {
- if (log_str != NULL)
- fclose(log_str);
- log_str = fopen(logFile, "a+");
- if (log_str == NULL) {
- if (debugLevel >= MSG_FATAL) {
- sprintf(debugmsg, "Cannot open log file %s\n",
- logFile);
- senddebug(MSG_FATAL);
- }
- return (-1);
- }
- setbuf(log_str, (char *)NULL);
- }
-
- if (debugDest == DEST_SYSLOGD) {
- openlog("rpld", LOG_PID, LOG_DAEMON);
- }
-
- return (0);
-}
-
-void
-usage(void)
-{
- printf("\n");
- printf("Usage: rpld [options] <network_interface_name>\n");
- printf(" rpld -a [options]\n");
- printf("Options:\n");
- printf(" -f file # set alternate config file\n");
- printf(" -d num # set debug level (0-9), 0=nil, 9=most\n");
- printf(" -D num # set debug destination, 0=console, "
- "1=syslogd, 2=logfile\n");
- printf(" -M num # set max simultaneous clients, "
- "-1=unlimited\n");
- printf(" -b num # set background mode, 1=background, "
- "0=not\n");
- printf(" -l file # set alternate log file\n");
- printf(" -s num # set start delay count\n");
- printf(" -g num # set delay granularity\n");
- printf("\n");
-}
-
-/*
- * Pick out leading alphabetic part of string 's'.
- */
-void
-getdevice(uchar_t *s, uchar_t *dev)
-{
- while (isalpha(*s))
- *dev++ = *s++;
- *dev = '\0';
-}
-
-/*
- * Pick out trailing numeric part of string 's' and return int.
- */
-int
-getunit(char *s)
-{
- char intbuf[128];
- char *p = intbuf;
-
- while (isalpha(*s))
- s++;
- while (isdigit(*s))
- *p++ = *s++;
- *p = '\0';
- return (atoi(intbuf));
-}
diff --git a/usr/src/cmd/rpld/rcv.c b/usr/src/cmd/rpld/rcv.c
deleted file mode 100644
index 5198a907cc..0000000000
--- a/usr/src/cmd/rpld/rcv.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "dluser.h"
-
-
-struct dl_address *addr;
-main( argc, argv )
- char *argv[];
-{
- int i, fd;
-
- fd = dl_open(argc>1 ? argv[1] : "/dev/wd0", 2, 0);
- if (fd<0){
- perror("wd0");
- exit(1);
- }
- if (dl_bind(fd, 0x1111, 0, 0)<0){
- printf("error on bind\n");
- exit(2);
- }
- addr = (struct dl_address *)dl_allocaddr(fd, DL_ALL);
- for(i=0;;i++){
- char buff[2048];
- int len;
- len = 2048;
- if (dl_rcv(fd, buff, &len, addr)<0){
- printf("an error on recv (%d)\n", dl_error(fd));
- exit(1);
- }
- printf("[%2d] data len=%d\n", i, len);
- printaddress(addr->dla_daddr, addr->dla_dlen);
- printaddress(addr->dla_saddr, addr->dla_slen);
- }
-}
-
-printaddress(addr, len)
- unsigned char *addr;
-{
- unsigned char paddr[6];
- int sap;
- unsigned char oi[4];
- int oitype;
- int i;
-
- printf("alen=%d",len);
- for (i=0; i<len; i++)printf(" %02X", addr[i]);printf("\n");
- dl_parseaddr(addr, len, paddr, &sap, oi, &oitype);
- for (i=0; i<6; i++)
- printf("%02X ", paddr[i]);
- printf("%04X\n", sap);
-}
diff --git a/usr/src/cmd/rpld/rpld.c b/usr/src/cmd/rpld/rpld.c
deleted file mode 100644
index faaf245d1f..0000000000
--- a/usr/src/cmd/rpld/rpld.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/stropts.h>
-#include <sys/stream.h>
-#include <poll.h>
-#include <sys/dlpi.h>
-#include "rpld.h"
-
-/* Global run-time parameters */
-char configFile[MAXPATHLEN] = {DFT_CONFIGFILE};
-int debugLevel = DFT_DEBUGLEVEL;
-int debugDest = DFT_DEBUGDEST;
-int maxClients = DFT_MAXCLIENTS;
-int backGround = DFT_BACKGROUND;
-char logFile[MAXPATHLEN] = {DFT_LOGFILE};
-unsigned long startDelay = DFT_STARTDELAY;
-unsigned long delayGran = DFT_DELAYGRAN;
-int frameSize = DFT_FRAMESIZE;
-char ifName[MAXPATHLEN] = "";
-int ifUnit = 0;
-int ppanum = 1;
-int need_llc = 0;
-
-extern void dumpctl();
-extern void dumpdata();
-extern void sighuphdr();
-extern void sigusr1hdr();
-
-int goaround(void);
-
-int if_fd; /* file descriptor for network interface name */
-struct pollfd llc_fd; /* file descriptor for llc device */
-FILE *log_str = NULL; /* file stream for log file */
-char ctlbuf[100]; /* control buffer for incoming frame */
-char databuf[2000]; /* data buffer for incoming frame */
-char debugmsg[MAXPATHLEN+200]; /* debug output message buffer */
-struct strbuf ctl, data; /* for use with getmsg() for incoming frame */
-client_t *clntp = NULL; /* pointer to the current client being served */
-int totclnt = 0; /* total clients being served right now */
-int outblocked = 0;
-
-int
-main(int argc, char *argv[], char *envp[])
-{
- time_t t;
-
- /* program initialize */
- if (initialize(argc, argv, envp) < 0)
- exit(-1);
-
- /* start processing requests */
- if (debugLevel >= MSG_INFO_1) {
- t = time((time_t *)NULL);
- sprintf(debugmsg, "%s", ctime(&t));
- senddebug(MSG_INFO_1);
- sprintf(debugmsg, "Start listening to RPL requests ...\n");
- senddebug(MSG_INFO_1);
- }
-
- while (1) {
- if (service() < 0)
- exit(-1);
- }
-}
-
-int
-service(void)
-{
- int flags;
- int rc;
- int n;
-
- if (outblocked)
- llc_fd.events = POLLIN | POLLOUT;
- else
- llc_fd.events = POLLIN;
-
- if (totclnt > 0)
- n = poll(&llc_fd, 1, 1); /* 1 ms timeout */
- else
- n = poll(&llc_fd, 1, -1); /* blocking poll */
-
- if (llc_fd.revents & POLLIN) {
- rc = incoming(llc_fd.fd);
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "incoming() returned\n");
- senddebug(MSG_ALWAYS);
- }
- }
- if (llc_fd.revents & POLLOUT)
- outblocked = 0;
- goaround();
- return (rc);
-}
-
-
-/*
- * This is the scheduler for all the outgoing traffic. Go around the
- * circular linked list and only process and advance 1 in the list
- * and then return no matter whether anything is being sent out in
- * this step or not.
- */
-int
-goaround(void)
-{
- if (totclnt == 0 || clntp == NULL)
- return (0);
-
- switch (clntp->status) {
- case ST_FIND_RCVD:
- sendFOUND(llc_fd.fd, clntp);
- break;
- case ST_DATA_XFER:
- sendFILE(llc_fd.fd, clntp);
- break;
- case ST_SEND_FINAL:
- sendFINAL(llc_fd.fd, clntp);
- break;
- case ST_FINISH:
- if ((--(clntp->delay)) == 0) {
- if ((time((time_t)0) - clntp->timeo) > REMOVETIMEOUT)
- clientremove(clntp);
- else
- clntp->delay = clntp->maxdelay;
- }
- break;
- }
- if (totclnt > 0 && clntp->next)
- clntp = clntp->next;
-
- return (0);
-}
-
-int
-initialize(int argc, char *argv[], char *envp[])
-{
- char *cp;
- union DL_primitives dl;
- struct sigaction sa;
-
- /*
- * Parse command line, read appropriate config file and set up
- * defaults
- */
- if (parseargs(argc, argv, envp) < 0)
- return (-1);
-
- /*
- * Here, if the -a option is specified, we are actually running in
- * a child process with all the parameters stored in the set of
- * global variables.
- */
-
- /* daemonize it if running in background */
- if (backGround) {
- switch (fork()) {
- case -1:
- return (-1);
- break;
- case 0: /* child: close FD's and detach terminal */
- close(0);
- close(1);
- close(2);
- (void) open("/", O_RDONLY, 0);
- (void) dup2(0, 1);
- (void) dup2(0, 2);
- /*
- * Detach terminal
- */
- setsid();
- break;
- default: /* parent */
- exit(0);
- break;
- }
- if (setpgrp() < 0)
- return (-1);
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = SA_RESTART;
- (void) sigemptyset(&sa.sa_mask);
- (void) sigaction(SIGHUP, &sa, NULL);
- if (fork() > 0)
- return (-1);
- }
-
- if (llcsetup() < 0)
- return (-1);
-
- clntp = (client_t *)NULL;
- totclnt = 0;
-
- sa.sa_handler = sighuphdr;
- sa.sa_flags = SA_RESTART;
- (void) sigemptyset(&sa.sa_mask);
- (void) sigaction(SIGHUP, &sa, NULL);
-
- sa.sa_handler = sigusr1hdr;
- sa.sa_flags = SA_RESTART;
- (void) sigemptyset(&sa.sa_mask);
- (void) sigaction(SIGUSR1, &sa, NULL);
-
- return (0);
-}
diff --git a/usr/src/cmd/rpld/rpld.conf b/usr/src/cmd/rpld/rpld.conf
deleted file mode 100644
index f4f2c58702..0000000000
--- a/usr/src/cmd/rpld/rpld.conf
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# 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 1992 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-
-#
-# Default configuration file for RPL server rpld
-#
-# Debug Level (0-9)
-# 0 = nil
-# 9 = most
-DebugLevel = 0
-
-# Debug Destination
-# 0 = console
-# 1 = syslogd
-# 2 = log file
-DebugDest = 2
-
-# Maximum simultaneous boot request clients
-MaxClients = -1
-
-# Background mode
-# 0 = not run in background
-# 1 = run in background
-BackGround = 1
-
-# Frame size to use
-FrameSize = 1500
-
-# Log file name
-LogFile = /var/spool/rpld.log
-
-# Start Delay Count
-StartDelay = 20
-
-# Delay Granularity
-DelayGran = 2
-
-end
diff --git a/usr/src/cmd/rpld/rpld.h b/usr/src/cmd/rpld/rpld.h
deleted file mode 100644
index 2719ab6318..0000000000
--- a/usr/src/cmd/rpld/rpld.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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 2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/param.h>
-
-#define VERYLONGTIME (long)9999999
-
-#define COMMENT_CHAR '#'
-#define CR 0x0d
-#define LF 0x0a
-#define TAB 0x09
-
-#define DEST_CONSOLE 0
-#define DEST_SYSLOGD 1
-#define DEST_LOGFILE 2
-
-#define RPLD_PATH "/opt/home/alanka/netboot/rpld/rpld"
-#define REMOVETIMEOUT 2
-
-/* Default values to start with */
-#define DFT_CONFIGFILE "/etc/rpld.conf"
-#define DFT_DEBUGLEVEL 0
-#define DFT_DEBUGDEST DEST_CONSOLE
-#define DFT_MAXCLIENTS -1
-#define DFT_LOGFILE "/var/spool/rpld.log"
-#define DFT_STARTDELAY 20
-#define DFT_DELAYGRAN (long)2
-#define DFT_BACKGROUND 0
-#define DFT_FRAMESIZE 1400
-#define DFT_IFNAME (char *)NULL
-
-/* RPL command codes */
-#define RPL_FIND_FR 0x0001
-#define RPL_FOUND_FR 0x0002
-#define RPL_SEND_FILE_REQ_FR 0x0010
-#define RPL_FILE_DATA_RES_FR 0x0020
-#define RPL_LOAD_ERR_RES_FR 0x0040
-#define RPL_PROGRAM_ALERT_FR 0x0030
-
-#ifdef sparc
-#define RPL_LISTEN_SAP 0x3F
-#else
-#define RPL_LISTEN_SAP 0xFC
-#endif
-
-/* Commands in the RPL protocol */
-#define CMD_FIND 0x01
-#define CMD_FOUND 0x02
-#define CMD_SEND_FILE 0x10
-#define CMD_FILE_DATA 0x20
-#define CMD_PROGRAM_ALERT 0x30
-#define CMD_LOAD_ERROR 0x40
-
-/* Various bit flags for FILE.DATA.RESPONSE frames */
-#define END_OF_FILE 0x80
-#define XFER_ENABLE 0x40
-#define LOCATE_ENABLE 0x20
-#define ACK_REQUEST 0x10
-
-/* Possible states */
-#define ST_FIND_RCVD -2
-#define ST_FOUND_SENT -1
-#define ST_DATA_XFER 0
-#define ST_SEND_FINAL 1
-#define ST_FINISH 2
-
-/* Different levels of debug messages */
-#define MSG_NONE 0
-#define MSG_FATAL 1
-#define MSG_ERROR_1 2
-#define MSG_ERROR_2 3
-#define MSG_WARN_1 4
-#define MSG_WARN_2 5
-#define MSG_WARN_3 6
-#define MSG_INFO_1 7
-#define MSG_INFO_2 8
-#define MSG_ALWAYS 9
-
-/* data structures to keep track of clients being served */
-struct bootfile_s {
- struct bootfile_s *next; /* link to next file */
- char filename[256]; /* the file to be downloaded */
- long size; /* file size, for eof comparison */
- long loadaddr; /* address to start loading */
- long seqnum; /* start seq num for this file */
-};
-typedef struct bootfile_s bootfile_t;
-
-struct client_s {
- struct client_s *next; /* forward link */
- struct client_s *prev; /* backward link */
- unsigned char addr[6]; /* physical network hardware addr */
- int status; /* status of service */
- bootfile_t *bootfp; /* head of boot file list to download */
- bootfile_t *currfp; /* current boot file downloading */
- FILE *fstr; /* file Stream for current file to */
- /* download */
- long seekp; /* fseek for current file */
- long seqnum; /* sequence number for next frame */
- long xferaddr; /* final transfer addr to execute */
- int framesz; /* max frame size to use */
- time_t timeo; /* timeout for successful download */
- long maxdelay; /* max delay ever encountered */
- long delay; /* delay needed between out frames */
- long resetdflt; /* reset value when delay expires */
-};
-typedef struct client_s client_t;
-
diff --git a/usr/src/cmd/rpld/rplin.c b/usr/src/cmd/rpld/rplin.c
deleted file mode 100644
index 02278e95b5..0000000000
--- a/usr/src/cmd/rpld/rplin.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stropts.h>
-#include <poll.h>
-#include <sys/stat.h>
-#include "rpld.h"
-
-extern struct strbuf ctl, data;
-extern char ctlbuf[];
-extern char databuf[];
-extern struct pollfd llc_fd;
-extern int debugLevel;
-extern long delayGran;
-extern long startDelay;
-extern char debugmsg[];
-extern client_t *clientlookup();
-
-int
-incoming(fd)
-int fd;
-{
-int flags;
-long in_seqnum;
-client_t *cp;
-bootfile_t *tmpfp, *tmpfp1;
-struct stat statbuf;
-char b[20];
-
- ctl.maxlen = 100;
- ctl.len = 0;
- ctl.buf = ctlbuf;
- data.maxlen = 2000;
- data.len = 0;
- data.buf = databuf;
- flags = 0;
- if (getmsg(fd, &ctl, &data, &flags) < 0) {
- perror("getmsg in incoming\n");
- return (-1);
- }
- /*
- dumpctl(&ctl);
- dumpdata(&data);
- */
-
- switch (databuf[3]) {
- case CMD_FIND:
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "FIND frame received\n");
- senddebug(MSG_INFO_1);
- }
- if (clientvalidate() < 0) {
- if (debugLevel >= MSG_WARN_2) {
- sprintf(debugmsg, "Client failed validation\n");
- senddebug(MSG_WARN_2);
- }
- return (0);
- }
- break;
- case CMD_SEND_FILE:
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "SEND FILE REQUEST received\n");
- senddebug(MSG_INFO_1);
- }
- if ((cp = clientlookup(&databuf[32])) == NULL) {
- if (debugLevel >= MSG_WARN_2) {
- sprintf(debugmsg, "Unknown client request to SEND FILE\n");
- senddebug(MSG_WARN_2);
- }
- return (0);
- }
-
- switch (cp->status) {
- case ST_FOUND_SENT:
- cp->status = ST_DATA_XFER;
- break;
- case ST_DATA_XFER:
- case ST_FINISH:
- /*
- * Need to adjust the delay timing by looking at
- * the sequence number requested. If the sequence
- * number is smaller than the current sequence
- * number, it is a retransmit request. The delay
- * would be adjusted upwards. However, if the
- * sequence number is the same or 1 larger than
- * the current sequence number, the delay is too
- * long and we adjust it downwards.
- */
- if (cp->status == ST_FINISH) {
- cp->status = ST_DATA_XFER;
- cp->timeo = 10*cp->maxdelay;
- }
-
- in_seqnum = (((long)databuf[8] & 0xff) << 24) |
- (((long)databuf[9] & 0xff) << 16) |
- (((long)databuf[10] & 0xff) << 8) |
- (((long)databuf[11] & 0xff));
- if (in_seqnum < cp->seqnum) {
- if (debugLevel >= MSG_WARN_2) {
- sprintf(debugmsg, "retransmit %ld requested, current is %ld\n", in_seqnum, cp->seqnum);
- senddebug(MSG_WARN_2);
- }
-
- /*
- * Adjust the currfp and seekfp to point
- * to this requested sequence number's
- * frame so that when we next send a frame
- * out, it would pick up from there.
- */
- tmpfp = cp->bootfp;
- tmpfp1 = tmpfp->next;
- while (tmpfp) {
- if ((tmpfp1 == NULL) ||
- (tmpfp1->seqnum == -1) ||
- ((in_seqnum >= tmpfp->seqnum) &&
- (in_seqnum < tmpfp1->seqnum)))
- break;
- else {
- tmpfp = tmpfp1;
- tmpfp1 = tmpfp->next;
- }
- }
- if (tmpfp) {
- if (tmpfp != cp->currfp) {
- fclose(cp->fstr);
- if ((cp->fstr = fopen(tmpfp->filename, "r")) == NULL) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg, "Cannot open %s in retransmit processing\n", tmpfp->filename);
- senddebug(MSG_ERROR_1);
- }
- return (0);
- }
- cp->currfp = tmpfp;
- stat(tmpfp->filename, &statbuf);
- tmpfp->size = (long)statbuf.st_size;
- }
- /*
- * If it was the last file in the list
- * of boot files, when we have sent out
- * the last frame and waiting for time
- * out, the file has been closed, and
- * cp->fstr will be reset to NULL.
- * Here we must check for this and
- * reopen this file.
- */
- if (cp->fstr == NULL) {
- if ((cp->fstr = fopen(tmpfp->filename, "r")) == NULL) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg, "Cannot open %s in retransmit, last file closed.\n");
- senddebug(MSG_ERROR_1);
- }
- return (0);
- }
- cp->currfp = tmpfp;
- stat(tmpfp->filename, &statbuf);
- tmpfp->size = (long)statbuf.st_size;
- }
- cp->seekp = (in_seqnum - tmpfp->seqnum)*
- (cp->framesz - 29);
- cp->seqnum = in_seqnum;
- }
-
- /* Adjust delay factors */
- cp->delay += delayGran;
- cp->resetdflt += delayGran;
- if (cp->delay > cp->maxdelay)
- cp->maxdelay = cp->delay;
-
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "New delay value = %ld\n",
- cp->resetdflt);
- senddebug(MSG_INFO_1);
- }
-
- } else if (in_seqnum == (cp->seqnum + 1)) {
-
- if ((cp->delay - delayGran) > 0)
- cp->delay -= delayGran;
- else
- cp->delay = (long)1;
-
- if ((cp->resetdflt - delayGran) > 0)
- cp->resetdflt -= delayGran;
- else
- cp->resetdflt = (long)1;
-
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "New delay value = %ld\n",
- cp->resetdflt);
- senddebug(MSG_INFO_1);
- }
- }
- break;
- default:
- if (debugLevel >= MSG_WARN_2) {
- sprintf(debugmsg, "Invalid status %d when SEND FILE comes in\n", cp->status);
- senddebug(MSG_WARN_2);
- }
- }
- break;
- case CMD_PROGRAM_ALERT:
- if (debugLevel >= MSG_WARN_2) {
- sprintf(debugmsg, "PROGRAM ALERT received\n");
- senddebug(MSG_WARN_2);
- }
- break;
- }
- return (0);
-}
diff --git a/usr/src/cmd/rpld/rplout.c b/usr/src/cmd/rpld/rplout.c
deleted file mode 100644
index 1508d217f5..0000000000
--- a/usr/src/cmd/rpld/rplout.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/dlpi.h>
-#include <poll.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "rpld.h"
-
-#define LLC_OVERHEAD 3
-#define RPL_OVERHEAD 29
-#define PROTOCOL_OVERHEAD (LLC_OVERHEAD + RPL_OVERHEAD)
-
-extern int totclnt;
-extern client_t *clntp;
-extern struct pollfd llc_fd;
-extern long delayGran;
-extern int debugLevel;
-extern int outblocked;
-extern unsigned char myNodeAddr[];
-extern char debugmsg[];
-
-/* This is the framework for the FOUND frame to the client */
-char FOUNDFRAME[] = {
- 0x00, 0x3a, /* program length */
- 0x00, 0x02, /* command for FOUND frame */
- 0x00, 0x08, 0x40, 0x03, /* correlator header */
- 0x00, 0x00, 0x00, 0x00, /* correlator */
- 0x00, 0x05, 0x40, 0x0B, /* resp header */
- 0x00, /* resp code */
- 0x00, 0x0A, 0x40, 0x0C, /* dest header */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* dest address */
- 0x00, 0x0A, 0x40, 0x06, /* source header */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* source server address */
- 0x00, 0x10, 0x00, 0x08, /* info header */
- 0x00, 0x06, 0x40, 0x09, /* frame header */
- 0x03, 0x00, /* max frame */
- 0x00, 0x06, 0x40, 0x0A, /* class header */
- 0x00, 0x00, /* conn class */
- 0x00, 0x05, 0x40, 0x07, /* Lsap header */
- (char)0xFC /* Rsap */
-};
-
-/* This is the framework for the FILEDATA response frames */
-char outFILE[1600] = {
- 0x00, 0x19, /* program length */
- 0x00, 0x20, /* FILE.DATA.RESPONSE */
- 0x00, 0x08, 0x40, 0x11, /* sequence header */
- 0x00, 0x00, 0x00, 0x00, /* sequence number of 00 */
- 0x00, 0x0D, (char)0xC0, 0x14, /* loader header */
- 0x00, 0x00, 0x7C, 0x00, /* load address */
- 0x00, 0x00, 0x7C, 0x00, /* transfer address */
- LOCATE_ENABLE, /* flags */
- 0x00, 0x44, 0x40, 0x18 /* data header */
-};
-
-int
-sendFOUND(int fd, client_t *cp)
-{
- struct dl_address *addr;
- dl_priority_t priority;
-
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "Sending out FOUND Frame\n");
- senddebug(MSG_INFO_1);
- }
-
- addr = (struct dl_address *)dl_mkaddress(fd, cp->addr, 0xFC,
- (unsigned char *)NULL, 0);
- memcpy(&FOUNDFRAME[21], cp->addr, 6);
- memcpy(&FOUNDFRAME[31], myNodeAddr, 6);
- priority.dl_min = 10;
- priority.dl_max = 2;
- if (dl_snd(fd, FOUNDFRAME, 58, addr, &priority) == 0)
- cp->status = ST_FOUND_SENT;
- else
- outblocked = 1;
- return (0);
-}
-
-void
-sendFILE(int fd, client_t *cp)
-{
- char ch;
- long loadaddr;
- int ncount;
- struct dl_address *addr;
- dl_priority_t priority;
- struct stat statbuf;
- char b[20];
-
- if (cp->delay > 0) {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg,
- "Delay = %d, not allowed to send yet\n",
- cp->delay);
- senddebug(MSG_ALWAYS);
- }
- cp->delay--;
- return;
- }
-
- addr = (struct dl_address *)dl_mkaddress(fd, cp->addr,
- 0xFC, (unsigned char *)NULL, 0);
- priority.dl_min = 10;
- priority.dl_max = 2;
-
- if (cp->fstr == NULL && cp->status != ST_FINISH) {
- if ((cp->fstr = fopen(cp->bootfp->filename, "r")) == NULL) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg, "Can't open bootfile %s\n",
- cp->bootfp->filename);
- senddebug(MSG_ERROR_1);
- sprintf(debugmsg,
- "Terminating servicing this client\n");
- senddebug(MSG_ERROR_1);
- }
- cp->status = ST_FINISH;
- cp->timeo = time((time_t)0);
- cp->delay = cp->maxdelay;
- return;
- }
- cp->seekp = (long)0;
- cp->bootfp->seqnum = cp->seqnum;
- cp->currfp = cp->bootfp;
- stat(cp->bootfp->filename, &statbuf);
- cp->bootfp->size = (long)statbuf.st_size;
- }
-
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "reading file %s, seeking to %ld\n",
- cp->currfp->filename, cp->seekp);
- senddebug(MSG_INFO_2);
- }
-
- fseek(cp->fstr, cp->seekp, SEEK_SET);
- ncount = fread(&outFILE[29], sizeof (char),
- (cp->framesz)-PROTOCOL_OVERHEAD, cp->fstr);
- if (ncount > 0) {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "%d bytes read from file\n", ncount);
- senddebug(MSG_ALWAYS);
- }
-
- /* sequence number */
- outFILE[8] = (cp->seqnum & (long)0xff000000) >> 24;
- outFILE[9] = (cp->seqnum & (long)0x00ff0000) >> 16;
- outFILE[10] = (cp->seqnum & (long)0x0000ff00) >> 8;
- outFILE[11] = (cp->seqnum & (long)0x000000ff);
-
- /* load address and flags */
- loadaddr = cp->currfp->loadaddr + cp->seekp;
- outFILE[16] = (loadaddr & (long)0xff000000) >> 24;
- outFILE[17] = (loadaddr & (long)0x00ff0000) >> 16;
- outFILE[18] = (loadaddr & (long)0x0000ff00) >> 8;
- outFILE[19] = (loadaddr & (long)0x000000ff);
- outFILE[24] = LOCATE_ENABLE;
-
- /* data header */
- outFILE[25] = ((ncount+4) & 0xff00) >> 8;
- outFILE[26] = ((ncount+4) & 0x00ff);
-
- /* program header */
- outFILE[0] = ((ncount + 0x19) & 0xff00) >> 8;
- outFILE[1] = ((ncount + 0x19) & 0x00ff);
-
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "%02X %02X: %d bytes, loading to "
- "%02X %02X %02X %02X\n",
- outFILE[10], outFILE[11],
- ncount,
- outFILE[16], outFILE[17],
- outFILE[18], outFILE[19]);
- senddebug(MSG_ALWAYS);
- }
-
- /* send it out */
- if (dl_snd(fd, outFILE, ncount+29, addr, &priority) < 0)
- outblocked = 1;
-
- /* increment sequence number */
- cp->seqnum++;
-
- /* prepare for next seek */
- cp->seekp += (long)ncount;
-
- /* reset delay counter */
- cp->delay = cp->resetdflt;
- } /* ncount > 0 */
-
- /* see if we hit the end-of-file of the current file */
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg, "Checking for eof = %d\n", feof(cp->fstr));
- senddebug(MSG_ALWAYS);
- }
-
- if (cp->seekp >= cp->currfp->size) {
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg,
- "Current file reaches eof, closing\n");
- senddebug(MSG_INFO_2);
- }
-
- fclose(cp->fstr);
- if (cp->currfp->next) {
- cp->currfp = cp->currfp->next;
- if ((cp->fstr = fopen(cp->currfp->filename, "r"))
- == NULL) {
- if (debugLevel >= MSG_ERROR_1) {
- sprintf(debugmsg,
- "Can't open bootfile %s\n",
- cp->currfp->filename);
- senddebug(MSG_ERROR_1);
- sprintf(debugmsg, "Terminating "
- "servicing this client\n");
- senddebug(MSG_ERROR_1);
- }
- cp->status = ST_FINISH;
- cp->timeo = time((time_t)0);
- cp->delay = cp->maxdelay;
- return;
- }
- cp->currfp->seqnum = cp->seqnum;
- cp->seekp = (long)0;
- stat(cp->currfp->filename, &statbuf);
- cp->currfp->size = (long)statbuf.st_size;
-
- } else {
- if (debugLevel >= MSG_INFO_2) {
- sprintf(debugmsg, "All files downloaded, "
- "update state to ST_SEND_FINAL\n");
- senddebug(MSG_INFO_2);
- }
- cp->status = ST_SEND_FINAL;
- }
- }
-}
-
-void
-sendFINAL(int fd, client_t *cp)
-{
- struct dl_address *addr;
- dl_priority_t priority;
-
- if (cp->delay > 0) {
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg,
- "Delay = %d, not allowed to send yet\n",
- cp->delay);
- senddebug(MSG_ALWAYS);
- }
- cp->delay--;
- return;
- }
-
- addr = (struct dl_address *)dl_mkaddress(fd, cp->addr,
- 0xFC, (unsigned char *)NULL, 0);
- priority.dl_min = 10;
- priority.dl_max = 2;
-
- if (debugLevel >= MSG_INFO_1) {
- sprintf(debugmsg, "sending down the last frame\n");
- senddebug(MSG_INFO_1);
- }
-
- /* sequence number */
- outFILE[8] = (cp->seqnum & (long)0xff000000) >> 24;
- outFILE[9] = (cp->seqnum & (long)0x00ff0000) >> 16;
- outFILE[10] = (cp->seqnum & (long)0x0000ff00) >> 8;
- outFILE[11] = (cp->seqnum & (long)0x000000ff);
-
- /* transfer address */
- outFILE[20] = (cp->xferaddr & (long)0xff000000) >> 24;
- outFILE[21] = (cp->xferaddr & (long)0x00ff0000) >> 16;
- outFILE[22] = (cp->xferaddr & (long)0x0000ff00) >> 8;
- outFILE[23] = (cp->xferaddr & (long)0x000000ff);
-
- /* flags */
- outFILE[24] = END_OF_FILE | XFER_ENABLE;
-
- /* data header */
- outFILE[25] = 0;
- outFILE[26] = 4;
-
- /* program header */
- outFILE[0] = 0;
- outFILE[1] = 0x19;
-
- if (debugLevel >= MSG_ALWAYS) {
- sprintf(debugmsg,
- "%02X %02X: transfer to %02X %02X %02X %02X\n",
- outFILE[10], outFILE[11],
- outFILE[20], outFILE[21],
- outFILE[22], outFILE[23]);
- senddebug(MSG_ALWAYS);
- }
-
- if (dl_snd(fd, outFILE, 29, addr, &priority) < 0)
- outblocked = 1;
-
- cp->fstr = NULL;
- cp->status = ST_FINISH;
- cp->timeo = time((time_t)0);
- cp->delay = cp->maxdelay;
- cp->currfp = cp->bootfp;
-}
diff --git a/usr/src/cmd/rpld/sighandler.c b/usr/src/cmd/rpld/sighandler.c
deleted file mode 100644
index 8cd8345dc7..0000000000
--- a/usr/src/cmd/rpld/sighandler.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/signal.h>
-#include "rpld.h"
-
-extern int totclnt;
-extern client_t *clntp;
-extern char debugmsg[];
-
-void dumpclients(void);
-
-/* Re-read config file */
-void
-sighuphdr(void)
-{
-#define RUNNING 1
- readconfig(RUNNING);
-}
-
-/* Dump internal variables to aid debugging or check status */
-void
-sigusr1hdr(void)
-{
- dumpparams();
- dumpclients();
-}
-
-void
-dumpclients(void)
-{
- int i;
- client_t *cp;
- bootfile_t *bp;
- char line[80];
-
- sprintf(debugmsg, "Number of active clients is %d\n", totclnt);
- senddebug(MSG_ALWAYS);
- if (totclnt == 0)
- return;
-
- cp = clntp;
- for (i = 0; i < totclnt; i++) {
- sprintf(debugmsg,
- "\n----------- Client %d Information ----------\n", i+1);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Client structure pointer: 0x%lX\n", cp);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Next pointer: 0x%lX\n", cp->next);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Prev pointer: 0x%lX\n", cp->prev);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Client physical address: 0x%0X 0x%0X 0x%0X "
- "0x%0X 0x%0X 0x%0X\n",
- cp->addr[0], cp->addr[1], cp->addr[2],
- cp->addr[3], cp->addr[4], cp->addr[5]);
- senddebug(MSG_ALWAYS);
- switch (cp->status) {
- case ST_FIND_RCVD:
- (void) strlcpy(line,
- "FIND frame received", sizeof (line));
- break;
- case ST_FOUND_SENT:
- (void) strlcpy(line, "FOUND frame sent out",
- sizeof (line));
- break;
- case ST_DATA_XFER:
- (void) strlcpy(line, "Data transfer in progress",
- sizeof (line));
- break;
- case ST_FINISH:
- (void) strlcpy(line,
- "Data transfer finished, timing out",
- sizeof (line));
- break;
- }
- sprintf(debugmsg, "Client status: %s\n", line);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg,
- "The list of boot files for this client is:\n");
- bp = cp->bootfp;
- senddebug(MSG_ALWAYS);
- while (bp) {
- sprintf(debugmsg,
- "\tPointer to current boot file record: 0x%lX\n",
- bp);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg,
- "\tPointer to next boot file record: 0x%lX\n",
- bp->next);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "\tBoot file name: %s\n",
- bp->filename);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "\tBoot file load address: 0x%lX\n",
- bp->loadaddr);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg,
- "\tStart sequence number for this file: 0x%lX\n",
- bp->seqnum);
- senddebug(MSG_ALWAYS);
- bp = bp->next;
- }
- sprintf(debugmsg,
- "Currently active boot file structure pointer: 0x%lX\n",
- cp->currfp);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg,
- "File stream pointer for this active boot file: 0x%lX\n",
- cp->fstr);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg,
- "Lseek pointer to this active boot file: 0x%lX\n",
- cp->seekp);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg,
- "Next sequence number to use: 0x%lX\n", cp->seqnum);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Final xfer address: 0x%lX\n", cp->xferaddr);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Frame size to use: %d\n", cp->framesz);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Final timeout to use: %d\n", cp->timeo);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Delay currently pending: %d\n", cp->delay);
- senddebug(MSG_ALWAYS);
- sprintf(debugmsg, "Reset value in use: %d\n", cp->resetdflt);
- senddebug(MSG_ALWAYS);
- }
-}
diff --git a/usr/src/cmd/rpld/snd.c b/usr/src/cmd/rpld/snd.c
deleted file mode 100644
index 773d60a604..0000000000
--- a/usr/src/cmd/rpld/snd.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "dluser.h"
-
-unsigned char dest[6] = {0,0,0xc0, 0x21, 0x8f, 8};
-struct dl_address *addr;
-main( argc, argv )
- char *argv[];
-{
- int i, fd;
-
- printf("opening %s\n", argc > 1 ? argv[1] : "/dev/le", 2, 0);
- fd = dl_open(argc>1 ? argv[1] : "/dev/le", 2, 0);
- if (fd<0){
- perror("wd0");
- exit(1);
- }
- if (dl_attach(fd, 3)<0){
- perror("error on dl_attach\n");
- exit(10);
- }
- if (dl_bind(fd, 0x40, 0, 0)<0){
- perror("error on bind\n");
- printf("dl error = %d\n", dl_error(fd));
- exit(2);
- }
- addr = dl_mkaddress(fd, dest, 0x40, NULL, NULL);
-
-
- for(i=0;;i++){
- char buff[2048];
- int len;
- for (len=0; len<1024; len++)
- buff[len] = i;
- len = 1024;
- if (dl_snd(fd, buff, len, addr, 0)<0){
- printf("an error on send (%d)\n", dl_error(fd));
- exit(1);
- }
- printf("sent packet %d\n", i);
- sleep(1);
- }
-}
-
-printaddress(addr, len)
- unsigned char *addr;
-{
- unsigned char paddr[6];
- int sap;
- unsigned char oi[4];
- int oitype;
- int i;
-
- printf("alen=%d",len);
- for (i=0; i<len; i++)printf(" %02X", addr[i]);printf("\n");
- dl_parseaddr(addr, len, paddr, &sap, oi, &oitype);
- for (i=0; i<6; i++)
- printf("%02X ", paddr[i]);
- printf("%04X\n", sap);
-}
diff --git a/usr/src/cmd/rpld/tst.c b/usr/src/cmd/rpld/tst.c
deleted file mode 100644
index c4faaf52bb..0000000000
--- a/usr/src/cmd/rpld/tst.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include "dluser.h"
-
-unsigned char dstaddr[6] = {
-00, 00, 0xc0, 0xf0, 0x78, 0x13
-/*0x02, 0x07, 0x01, 0x08, 0x33, 0x97*/
-
-};
-
-struct dl_address *addr;
-main( argc, argv )
- char *argv[];
-{
- int i, fd;
-
- fd = dl_open(argc>1 ? argv[1] : "/dev/wd0", 2, 0);
- if (fd<0){
- perror("wd0");
- exit(1);
- }
- if (dl_bind(fd, 0x1111, 0, 0)<0){
- printf("error on bind\n");
- exit(2);
- }
- addr = dl_mkaddress(fd, dstaddr, 0x1111, 0, 0);
- printaddress(addr->dla_daddr, addr->dla_dlen);
- for (i = 0; i<10; i++)
- if (dl_snd(fd, "this is a test, only a test\n", 28, addr)<0){
- printf("an error on send\n");
- }
-}
-
-printaddress(addr, len)
- unsigned char *addr;
-{
- unsigned char paddr[6];
- int sap;
- unsigned char oi[4];
- int oitype;
- int i;
-
- dl_parseaddr(addr, len, paddr, &sap, oi, &oitype);
- for (i=0; i<6; i++)
- printf("%02X ", paddr[i]);
- printf("%04X\n", sap);
-}
diff --git a/usr/src/cmd/svc/milestone/rmtmpfiles b/usr/src/cmd/svc/milestone/rmtmpfiles
index 2f2dca4c70..f08782a9a8 100644
--- a/usr/src/cmd/svc/milestone/rmtmpfiles
+++ b/usr/src/cmd/svc/milestone/rmtmpfiles
@@ -3,9 +3,8 @@
# 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.
+# Common Development and Distribution License (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.
@@ -21,10 +20,21 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
+
+# For modifying the behavior of rmtmpfiles, do not edit this script.
+# Instead use svccfg(1m) to modify the SMF repository. To achieve
+# traditional System V treatment of /var/tmp, invoke the following
+# commands.:
+#
+# # svccfg
+# svc:> select system/rmtmpfiles
+# svc:/system/rmtmpfiles> setprop options/clean_vartmp="true"
+# svc:/system/rmtmpfiles> select default
+# svc:/system/rmtmpfiles:default> refresh
+# svc:/system/rmtmpfiles:default> exit
#
-#ident "%Z%%M% %I% %E% SMI"
# Traditional SunOS 4.x behavior has been to not remove directories in
# the /tmp directory; only simple files were removed. This lead to an
@@ -52,26 +62,26 @@ done
# Traditional SunOS 4.x behavior has been to not alter the contents of
# /var/tmp (/usr/tmp) at boot time. This behavior is maintained as the
-# current default behavior. It the traditional System V behavior of
-# removing everything in /var/tmp is desired, remove the following 'exit'.
-
-exit 0
-
-# Clean up /var/tmp, unless /var/tmp or any of its subdirectories are
-# mount points for another filesystem.
+# current default behavior. If the traditional System V behavior of
+# removing everything in /var/tmp is desired then clean up /var/tmp,
+# unless /var/tmp or any of its subdirectories are mount points for
+# another filesystem.
-/sbin/mount | /usr/bin/egrep '^/var/tmp(/| )' >/dev/null 2>&1 || {
+CLEAN_VARTMP=`svcprop -c -p options/clean_vartmp $SMF_FMRI`
+if [ "$CLEAN_VARTMP" = "true" ]; then
+ /sbin/mount | /usr/bin/egrep '^/var/tmp(/| )' >/dev/null 2>&1 || {
cd /var/tmp || exit 0
# We carefully remove all files except the Ex* files (editor
# temporary files), which expreserve will process later (in
- # S80PRESERVE). Of course, it would be simpler to just run
+ # S89PRESERVE). Of course, it would be simpler to just run
# expreserve before this script, but that doesn't work --
# expreserve requires the name service, which is not available
# until much later.
/usr/bin/ls -a | /usr/bin/egrep -v '^(Ex.*|\.|\.\.)$' |
/usr/bin/xargs /usr/bin/rm -rf -- 2>/dev/null
-}
+ }
+fi
exit 0
diff --git a/usr/src/cmd/svc/milestone/rmtmpfiles.xml b/usr/src/cmd/svc/milestone/rmtmpfiles.xml
index 7909021711..30afaa9f05 100644
--- a/usr/src/cmd/svc/milestone/rmtmpfiles.xml
+++ b/usr/src/cmd/svc/milestone/rmtmpfiles.xml
@@ -1,15 +1,12 @@
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
- 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.
+ Common Development and Distribution License (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.
@@ -24,7 +21,8 @@
CDDL HEADER END
- ident "%Z%%M% %I% %E% SMI"
+ Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ Use is subject to license terms.
NOTE: This service manifest is not editable; its contents will
be overwritten by package or patch operations, including
@@ -76,6 +74,16 @@
<propval name='duration' type='astring' value='transient' />
</property_group>
+ <!--
+ This is used in the method script to determine whether files
+ in /var/tmp should be deleted when the service is started.
+ -->
+ <property_group name='options' type='application'>
+ <propval name='clean_vartmp' type='boolean' value='false'/>
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.rmtmpfiles' />
+ </property_group>
+
<stability value='Evolving' />
<template>
@@ -84,6 +92,37 @@
remove temporary files
</loctext>
</common_name>
+ <pg_pattern name="options" type="application">
+ <description>
+ <loctext xml:lang='C'>
+Properties that control the runtime behavior of the service.
+ </loctext>
+ </description>
+ <prop_pattern name="clean_vartmp" type='boolean'>
+ <common_name>
+ <loctext xml:lang='C'>
+Clean /var/tmp
+ </loctext>
+ </common_name>
+ <description>
+ <loctext xml:lang='C'>
+Remove all files and directories from /var/tmp if set to true.
+ </loctext>
+ </description>
+ </prop_pattern>
+ <prop_pattern name="value_authorization" type="astring">
+ <common_name>
+ <loctext xml:lang='C'>
+Value change authorization
+ </loctext>
+ </common_name>
+ <description>
+ <loctext xml:lang='C'>
+Declares authorization needed to change values in the options properety group.
+ </loctext>
+ </description>
+ </prop_pattern>
+ </pg_pattern>
</template>
</service>
diff --git a/usr/src/pkgdefs/SUNWbsr/prototype_com b/usr/src/pkgdefs/SUNWbsr/prototype_com
index 9dea49537f..16b6a05a1f 100644
--- a/usr/src/pkgdefs/SUNWbsr/prototype_com
+++ b/usr/src/pkgdefs/SUNWbsr/prototype_com
@@ -2,9 +2,8 @@
# 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.
+# Common Development and Distribution License (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.
@@ -20,11 +19,9 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
# This required package information file contains a list of package contents.
# The 'pkgmk' command uses this file to identify the contents of a package
# and their location on the development machine when building the package.
@@ -50,20 +47,6 @@ i r.manifest
#
# SUNWbsr
#
-d none etc 755 root sys
-f none etc/rpld.conf 644 root sys
-d none etc/init.d 755 root sys
-e initd etc/init.d/boot.server 744 root sys
-d none etc/rc0.d 755 root sys
-l initd etc/rc0.d/K27boot.server=../../etc/init.d/boot.server
-d none etc/rc1.d 755 root sys
-l initd etc/rc1.d/K27boot.server=../../etc/init.d/boot.server
-d none etc/rc2.d 755 root sys
-l initd etc/rc2.d/K27boot.server=../../etc/init.d/boot.server
-d none etc/rc3.d 755 root sys
-l initd etc/rc3.d/S16boot.server=../../etc/init.d/boot.server
-d none etc/rcS.d 755 root sys
-l initd etc/rcS.d/K27boot.server=../../etc/init.d/boot.server
d none var 0755 root sys
d none var/svc 0755 root sys
d none var/svc/manifest 0755 root sys
diff --git a/usr/src/pkgdefs/SUNWbsu/prototype_com b/usr/src/pkgdefs/SUNWbsu/prototype_com
index 44b4b4d4b6..86e0bc2070 100644
--- a/usr/src/pkgdefs/SUNWbsu/prototype_com
+++ b/usr/src/pkgdefs/SUNWbsu/prototype_com
@@ -2,9 +2,8 @@
# 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.
+# Common Development and Distribution License (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.
@@ -20,10 +19,8 @@
# CDDL HEADER END
#
#
-# Copyright (c) 2000 by Sun Microsystems, Inc.
-# All rights reserved.
-#
-# ident "%Z%%M% %I% %E% SMI"
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
#
# This required package information file contains a list of package contents.
# The 'pkgmk' command uses this file to identify the contents of a package
@@ -49,4 +46,3 @@ d none usr 755 root sys
d none usr/sbin 755 root bin
f none usr/sbin/in.rarpd 555 root bin
f none usr/sbin/rpc.bootparamd 555 root bin
-f none usr/sbin/rpld 555 root bin
diff --git a/usr/src/tools/scripts/bfu.sh b/usr/src/tools/scripts/bfu.sh
index 39fe39c165..7d1d0447fc 100644
--- a/usr/src/tools/scripts/bfu.sh
+++ b/usr/src/tools/scripts/bfu.sh
@@ -1290,6 +1290,7 @@ smf_obsolete_rc_files="
etc/init.d/acctadm
etc/init.d/audit
etc/init.d/autofs
+ etc/init.d/boot.server
etc/init.d/coreadm
etc/init.d/cron
etc/init.d/cryptosvc
@@ -1341,6 +1342,7 @@ smf_obsolete_rc_files="
etc/rc0.d/K07snmpdx
etc/rc0.d/K10rcapd
etc/rc0.d/K21dhcp
+ etc/rc0.d/K27boot.server
etc/rc0.d/K28kdc
etc/rc0.d/K28kdc.master
etc/rc0.d/K28nfs.server
@@ -1374,6 +1376,7 @@ smf_obsolete_rc_files="
etc/rc1.d/K07snmpdx
etc/rc1.d/K10rcapd
etc/rc1.d/K21dhcp
+ etc/rc1.d/K27boot.server
etc/rc1.d/K28kdc
etc/rc1.d/K28kdc.master
etc/rc1.d/K28nfs.server
@@ -1402,6 +1405,7 @@ smf_obsolete_rc_files="
etc/rc2.d/K05volmgt
etc/rc2.d/K07snmpdx
etc/rc2.d/K21dhcp
+ etc/rc2.d/K27boot.server
etc/rc2.d/K28kdc
etc/rc2.d/K28kdc.master
etc/rc2.d/K28nfs.server
@@ -1438,6 +1442,7 @@ smf_obsolete_rc_files="
etc/rc3.d/S13kdc.master
etc/rc3.d/S14kdc
etc/rc3.d/S15nfs.server
+ etc/rc3.d/S16boot.server
etc/rc3.d/S34dhcp
etc/rc3.d/S76snmpdx
etc/rc3.d/S81volmgt
@@ -1449,6 +1454,7 @@ smf_obsolete_rc_files="
etc/rcS.d/K07snmpdx
etc/rcS.d/K10rcapd
etc/rcS.d/K21dhcp
+ etc/rcS.d/K27boot.server
etc/rcS.d/K28kdc
etc/rcS.d/K28kdc.master
etc/rcS.d/K28nfs.server