summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authoramaguire <none@none>2006-11-02 15:30:18 -0800
committeramaguire <none@none>2006-11-02 15:30:18 -0800
commita192e900f6d2b0e1a822e3252c0dfd795ed49d76 (patch)
tree14da911f3b9e55e737b4d0f2597cdc69105c3023 /usr/src
parentac92251dc182f030faf6a5f76981d551b0b16072 (diff)
downloadillumos-joyent-a192e900f6d2b0e1a822e3252c0dfd795ed49d76.tar.gz
PSARC 2006/552 Quagga SMF Modifications
6312914 routeadm needs to support smf-based routing services 6440342 remove redundancies in smf-related makefiles by moving manifest rules to usr/src/cmd/Makefile.targ --HG-- rename : usr/src/cmd/cmd-inet/usr.sbin/in.rdisc.c => usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/in.rdisc.c rename : usr/src/cmd/cmd-inet/usr.sbin/routeadm.c => usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c rename : deleted_files/usr/src/cmd/volmgt/etc/Makefile => usr/src/cmd/volmgt/etc/Makefile
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/Makefile5
-rw-r--r--usr/src/cmd/Makefile.cmd3
-rw-r--r--usr/src/cmd/Makefile.targ26
-rw-r--r--usr/src/cmd/agents/snmp/snmprelayd/Makefile12
-rw-r--r--usr/src/cmd/auditd/Makefile41
-rw-r--r--usr/src/cmd/bnu/Makefile12
-rw-r--r--usr/src/cmd/cmd-crypto/scripts/Makefile11
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/Makefile.inetsvc26
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile9
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ndpd/Makefile8
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.xml124
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ndpd/svc-ndp76
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ripngd/Makefile19
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ripngd/ripng.xml149
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.ripngd/svc-ripng83
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/inetd/Makefile16
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/slpd/Makefile7
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/Makefile32
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/Makefile10
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/Makefile49
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/in.rdisc.c (renamed from usr/src/cmd/cmd-inet/usr.sbin/in.rdisc.c)0
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/rdisc.xml136
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/svc-rdisc71
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.routed/Makefile11
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.routed/route.xml153
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.routed/svc-route112
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/in.talkd/Makefile7
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/kssl/ksslcfg/Makefile8
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm.c1280
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm/Makefile87
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm/forwarding.xml245
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm/legacy-routing.xml161
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c2502
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-forwarding87
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-legacy-routing84
-rw-r--r--usr/src/cmd/consadm/Makefile20
-rw-r--r--usr/src/cmd/coreadm/Makefile11
-rw-r--r--usr/src/cmd/cvcd/Makefile11
-rw-r--r--usr/src/cmd/dcs/sparc/sun4u/Makefile15
-rw-r--r--usr/src/cmd/dispadmin/Makefile9
-rw-r--r--usr/src/cmd/dumpadm/Makefile8
-rw-r--r--usr/src/cmd/eeprom/Makefile9
-rw-r--r--usr/src/cmd/fs.d/nfs/svc/Makefile6
-rw-r--r--usr/src/cmd/gss/gssd/Makefile8
-rw-r--r--usr/src/cmd/intrd/Makefile8
-rw-r--r--usr/src/cmd/ipf/svc/Makefile15
-rw-r--r--usr/src/cmd/kbd/Makefile2
-rw-r--r--usr/src/cmd/keyserv/Makefile2
-rw-r--r--usr/src/cmd/krb5/kadmin/server/Makefile7
-rw-r--r--usr/src/cmd/krb5/krb5kdc/Makefile7
-rw-r--r--usr/src/cmd/krb5/kwarn/Makefile3
-rw-r--r--usr/src/cmd/krb5/slave/Makefile7
-rw-r--r--usr/src/cmd/ldapcachemgr/Makefile1
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/Makefile13
-rw-r--r--usr/src/cmd/lvm/md_monitord/Makefile42
-rw-r--r--usr/src/cmd/lvm/rpc.mdcommd/Makefile9
-rw-r--r--usr/src/cmd/lvm/rpc.metad/Makefile9
-rw-r--r--usr/src/cmd/lvm/rpc.metamedd/Makefile14
-rw-r--r--usr/src/cmd/lvm/rpc.metamhd/Makefile9
-rw-r--r--usr/src/cmd/lvm/util/Makefile1
-rw-r--r--usr/src/cmd/nscd/Makefile4
-rw-r--r--usr/src/cmd/oplhpd/Makefile13
-rw-r--r--usr/src/cmd/picl/picld/Makefile23
-rw-r--r--usr/src/cmd/power/Makefile15
-rw-r--r--usr/src/cmd/print/gateway/Makefile33
-rw-r--r--usr/src/cmd/rexd/Makefile8
-rw-r--r--usr/src/cmd/rpcbind/Makefile13
-rw-r--r--usr/src/cmd/rpcsvc/Makefile13
-rw-r--r--usr/src/cmd/rpcsvc/Makefile.rpc19
-rw-r--r--usr/src/cmd/sa/Makefile24
-rw-r--r--usr/src/cmd/saf/Makefile15
-rw-r--r--usr/src/cmd/sckmd/Makefile4
-rw-r--r--usr/src/cmd/sendmail/lib/Makefile24
-rw-r--r--usr/src/cmd/sf880drd/Makefile18
-rw-r--r--usr/src/cmd/smserverd/Makefile8
-rw-r--r--usr/src/cmd/ssh/etc/Makefile16
-rw-r--r--usr/src/cmd/stmsboot/Makefile16
-rw-r--r--usr/src/cmd/svc/milestone/Makefile9
-rw-r--r--usr/src/cmd/svc/milestone/fs-root2
-rw-r--r--usr/src/cmd/svc/milestone/net-init202
-rw-r--r--usr/src/cmd/svc/milestone/net-loopback10
-rw-r--r--usr/src/cmd/svc/milestone/net-routing-setup237
-rw-r--r--usr/src/cmd/svc/milestone/network-initial.xml27
-rw-r--r--usr/src/cmd/svc/milestone/network-physical.xml16
-rw-r--r--usr/src/cmd/svc/milestone/network-routing-setup.xml136
-rw-r--r--usr/src/cmd/svc/shell/routing_include.sh287
-rw-r--r--usr/src/cmd/syslogd/Makefile10
-rw-r--r--usr/src/cmd/utmpd/Makefile7
-rw-r--r--usr/src/cmd/vntsd/Makefile8
-rw-r--r--usr/src/cmd/volmgt/etc/Makefile66
-rw-r--r--usr/src/cmd/xntpd/xntpd/Makefile14
-rw-r--r--usr/src/cmd/ypcmd/Makefile9
-rw-r--r--usr/src/cmd/ypcmd/yppasswd/Makefile2
-rw-r--r--usr/src/cmd/ypcmd/ypupdated/Makefile9
-rw-r--r--usr/src/cmd/zoneadm/Makefile9
-rw-r--r--usr/src/lib/libdscp/svc/Makefile3
-rw-r--r--usr/src/lib/libsecdb/auth_attr.txt2
-rw-r--r--usr/src/lib/libsecdb/help/auths/Makefile2
-rw-r--r--usr/src/lib/libsecdb/help/auths/SmfRoutingStates.html40
-rw-r--r--usr/src/lib/libsecdb/help/auths/SmfValueRouting.html40
-rw-r--r--usr/src/lib/libsecdb/prof_attr.txt2
-rw-r--r--usr/src/pkgdefs/SUNW0on/prototype_com2
-rw-r--r--usr/src/pkgdefs/SUNWcsr/prototype_com8
-rw-r--r--usr/src/pkgdefs/SUNWcsu/prototype_com2
-rw-r--r--usr/src/pkgdefs/SUNWroute/Makefile7
-rw-r--r--usr/src/pkgdefs/SUNWroute/pkginfo.tmpl2
-rw-r--r--usr/src/pkgdefs/SUNWroute/prototype_com20
107 files changed, 5323 insertions, 2041 deletions
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile
index 78c8e2083b..20fe1d51a7 100644
--- a/usr/src/cmd/Makefile
+++ b/usr/src/cmd/Makefile
@@ -800,12 +800,17 @@ MANIFEST_SUBDIRS= \
cmd-inet/usr.lib/in.dhcpd \
cmd-inet/usr.lib/in.discardd \
cmd-inet/usr.lib/in.echod \
+ cmd-inet/usr.lib/in.ndpd \
+ cmd-inet/usr.lib/in.ripngd \
cmd-inet/usr.lib/in.timed \
cmd-inet/usr.lib/inetd \
cmd-inet/usr.lib/slpd \
cmd-inet/usr.sbin \
cmd-inet/usr.sbin/in.ftpd \
+ cmd-inet/usr.sbin/in.rdisc \
+ cmd-inet/usr.sbin/in.routed \
cmd-inet/usr.sbin/in.talkd \
+ cmd-inet/usr.sbin/routeadm \
dcs/sparc/sun4u \
fs.d/autofs \
fs.d/cachefs \
diff --git a/usr/src/cmd/Makefile.cmd b/usr/src/cmd/Makefile.cmd
index f8e70bedeb..791f10dbbd 100644
--- a/usr/src/cmd/Makefile.cmd
+++ b/usr/src/cmd/Makefile.cmd
@@ -202,6 +202,7 @@ ROOTSVCNETWORK= $(ROOTVARSVCMANIFEST)/network
ROOTSVCNETWORKLDAP= $(ROOTSVCNETWORK)/ldap
ROOTSVCNETWORKNFS= $(ROOTSVCNETWORK)/nfs
ROOTSVCNETWORKNIS= $(ROOTSVCNETWORK)/nis
+ROOTSVCNETWORKROUTING= $(ROOTSVCNETWORK)/routing
ROOTSVCNETWORKRPC= $(ROOTSVCNETWORK)/rpc
ROOTSVCNETWORKSECURITY= $(ROOTSVCNETWORK)/security
ROOTSVCNETWORKSSL= $(ROOTSVCNETWORK)/ssl
@@ -235,12 +236,10 @@ CHKMANIFEST= $(MANIFEST:%.xml=%.xmlchk)
# For installing "starter scripts" of services
#
-ROOTSVCBIN= $(SVCBIN:%=$(ROOTLIBSVCBIN)/%)
ROOTSVCMETHOD= $(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
ROOTSVCBINDIR= $(ROOTLIBSVCBIN)/__nonexistent_directory__
ROOTSVCBIN= $(SVCBIN:%=$(ROOTSVCBINDIR)/%)
-$(ROOTSVCBIN) := FILEMODE= 544
#
diff --git a/usr/src/cmd/Makefile.targ b/usr/src/cmd/Makefile.targ
index 65572918d5..7a5410e7fe 100644
--- a/usr/src/cmd/Makefile.targ
+++ b/usr/src/cmd/Makefile.targ
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -29,6 +28,17 @@
# common target definitions for command builds
#
+#
+# Conditional assignment of default group/owner/permissions for SMF
+# manifests and method scripts.
+#
+$(ROOTMANIFEST) := OWNER= root
+$(ROOTMANIFEST) := GROUP= sys
+$(ROOTMANIFEST) := FILEMODE= 444
+$(ROOTSVCBIN) := OWNER= root
+$(ROOTSVCBIN) := GROUP= bin
+$(ROOTSVCBIN) := FILEMODE= 544
+
clobber: clean
-$(RM) $(PROG) $(CLOBBERFILES)
@@ -47,6 +57,14 @@ $(ROOTCMDDIR) $(ROOTCMDDIR64):
$(ROOTCMDDIR64)/%: $(ROOTCMDDIR64) %
$(INS.file)
+$(ROOTMANIFEST): $(ROOTMANIFESTDIR)
+
+$(ROOTMANIFESTDIR):
+ $(INS.dir)
+
+$(ROOTMANIFESTDIR)/%: %
+ $(INS.file)
+
#
# For message catalogue files
#
diff --git a/usr/src/cmd/agents/snmp/snmprelayd/Makefile b/usr/src/cmd/agents/snmp/snmprelayd/Makefile
index af0e29b0a7..06eb7fdb1d 100644
--- a/usr/src/cmd/agents/snmp/snmprelayd/Makefile
+++ b/usr/src/cmd/agents/snmp/snmprelayd/Makefile
@@ -31,6 +31,9 @@ include ../../Makefile.vars
# OPTIONAL_INCLUDE_FILE:sh = /bin/sh ../../misc.sh ../../../cmd/Makefile.cmd
# include $(OPTIONAL_INCLUDE_FILE)
+MANIFEST = snmpdx.xml
+SVCMETHOD = svc-snmpdx
+
include $(SRC)/cmd/Makefile.cmd
#
@@ -142,16 +145,11 @@ PARSER= $(PARSER_HOME)/$(BIN)/mibcodegen
# all
#
-MANIFEST = snmpdx.xml
ROOTMANIFESTDIR = $(ROOTSVCAPPLICATIONMANAGEMENT)
-SVCMETHOD = svc-snmpdx
-
-$(ROOTMANIFEST) := FILEMODE = 0444
-$(ROOTSVCMETHOD) := FILEMODE = 0555
-FILEMODE = 0644
+$(CONFRULE) := FILEMODE = 0644
$(CONFLOC)/snmpdx.acl := FILEMODE = 0600
-GROUP = sys
+$(CONFRULE) := GROUP = sys
CLOBBERFILES= y.tab.c
diff --git a/usr/src/cmd/auditd/Makefile b/usr/src/cmd/auditd/Makefile
index 509ecb80cf..92bb5dd3f5 100644
--- a/usr/src/cmd/auditd/Makefile
+++ b/usr/src/cmd/auditd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,11 +27,12 @@
PROG = auditd
+MANIFEST = auditd.xml
+SVCMETHOD = svc-auditd
+
include ../Makefile.cmd
-MANIFEST = auditd.xml
ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
-ROOTMETHOD = $(ROOTLIBSVCMETHOD)/svc-auditd
LIBBSM = $(SRC)/lib/libbsm/common
@@ -42,27 +42,17 @@ CPPFLAGS += -I$(LIBBSM)
LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
LINTFLAGS += -m
-TEXT_DOMAIN=SUNW_OST_OSCMD
-
LDLIBS += -lbsm -lnsl -lsecdb -lsocket
OBJS= auditd.o doorway.o queue.o
SRCS= $(OBJS:%.o=%.c)
-$(ROOTSVCSYSTEM)/auditd.xml := OWNER = root
-$(ROOTSVCSYSTEM)/auditd.xml := GROUP = sys
-$(ROOTSVCSYSTEM)/auditd.xml := FILEMODE = 0444
-
-$(ROOTLIBSVCMETHOD)/svc-auditd := OWNER = root
-$(ROOTLIBSVCMETHOD)/svc-auditd := GROUP = bin
-$(ROOTLIBSVCMETHOD)/svc-auditd := FILEMODE = 0555
-
.KEEP_STATE:
-all: $(PROG) $(SUBDIRS)
+all: $(PROG)
-install: all $(ROOTUSRSBINPROG) $(SUBDIRS) \
- $(ROOTMANIFEST) $(ROOTMETHOD)
+install: all $(ROOTUSRSBINPROG) \
+ $(ROOTMANIFEST) $(ROOTSVCMETHOD)
$(PROG): $(OBJS)
$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
@@ -70,18 +60,9 @@ $(PROG): $(OBJS)
lint: lint_SRCS
-clean: $(SUBDIRS)
-
-clobber: $(SUBDIRS) local_clobber
-
-local_clobber:
- rm -f $(OBJS) $(PROG).po
+clean:
+ $(RM) $(OBJS)
check: $(CHKMANIFEST)
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-FRC:
-
include ../Makefile.targ
diff --git a/usr/src/cmd/bnu/Makefile b/usr/src/cmd/bnu/Makefile
index 5625eee5ff..3f87459a60 100644
--- a/usr/src/cmd/bnu/Makefile
+++ b/usr/src/cmd/bnu/Makefile
@@ -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.
@@ -22,12 +21,14 @@
#
# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# cmd/bnu/Makefile
#
+MANIFEST = uucp.xml
+
include ../Makefile.cmd
USERPROG1 = uudecode uuencode
@@ -38,8 +39,6 @@ SBINPROG = in.uucpd
PROG = $(UUCPPROG) $(USERPROG) $(SBINPROG)
-MANIFEST = uucp.xml
-
LIBSHELLS = Uutry uudemon.admin uudemon.cleanup uudemon.hour uudemon.poll
BINSHELLS = uulog uupick uuto
SHELLS = $(LIBSHELLS) $(BINSHELLS)
@@ -58,7 +57,6 @@ TXTFILES = README $(FILES) \
Cvt Install SetUp Teardown dial.c dial.h getopt.c strpbrk.c
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-$(ROOTMANIFEST) := FILEMODE= 444
CAT = cat
POFILE = bnu.po
diff --git a/usr/src/cmd/cmd-crypto/scripts/Makefile b/usr/src/cmd/cmd-crypto/scripts/Makefile
index 1b0c75febb..9aa297ad53 100644
--- a/usr/src/cmd/cmd-crypto/scripts/Makefile
+++ b/usr/src/cmd/cmd-crypto/scripts/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -44,11 +43,11 @@ CLASS_SCR_FILES = $(CLASS_ACTION_SCRIPTS:%=$(CLASS_SCR_DIR)/%)
ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE = 0444
-
$(CLASS_SCR_DIR)/%: %
$(INS.file)
install: $(CLASS_SCR_FILES) $(ROOTMANIFEST)
check: $(CHKMANIFEST)
+
+include ../../Makefile.targ
diff --git a/usr/src/cmd/cmd-inet/usr.lib/Makefile.inetsvc b/usr/src/cmd/cmd-inet/usr.lib/Makefile.inetsvc
index 920d0d65f3..4cc1ef7551 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/Makefile.inetsvc
+++ b/usr/src/cmd/cmd-inet/usr.lib/Makefile.inetsvc
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,13 +27,9 @@
# cmd/cmd-inet/usr.lib/%M%
#
-OBJS = ${PROG}.o
-SRCS = $(OBJS:%.o=%.c)
-
include ../../../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-$(ROOTMANIFEST) := FILEMODE= 444
LDLIBS += -linetsvc
@@ -42,27 +37,14 @@ LDLIBS += -linetsvc
all: $(PROG)
-$(PROG): $(OBJS)
- $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
- $(POST_PROCESS)
-
include ../Makefile.lib
install: all $(ROOTLIBINETPROG) $(ROOTMANIFEST)
-$(ROOTMANIFEST): $(ROOTMANIFESTDIR)
-
-$(ROOTMANIFESTDIR):
- $(INS.dir)
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
-
check: $(CHKMANIFEST)
clean:
- $(RM) $(OBJS)
-lint: lint_SRCS
+lint: lint_PROG
include ../../../Makefile.targ
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile
index 0b36ed8a25..4788abbea5 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/Makefile
@@ -46,7 +46,6 @@ OBJS = $(LOCAL_OBJS) $(CMN_OBJS)
include ../../../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-$(ROOTMANIFEST) := FILEMODE= 444
CPPFLAGS += -DNDEBUG -DNPROBE -D_REENTRANT -I./ -I$(CMN_DIR)
LINTFLAGS += -u
@@ -85,14 +84,6 @@ install: all $(ROOTLIBINETPROG) $(ROOTMANIFEST)
$(COMPILE.c) $(OUTPUT_OPTION) $<
$(POST_PROCESS_O)
-$(ROOTMANIFEST): $(ROOTMANIFESTDIR)
-
-$(ROOTMANIFESTDIR):
- $(INS.dir)
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
-
$(POFILE): $(POFILES)
$(RM) $@
$(CAT) $(POFILES) > $@
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/Makefile
index c7225e3e61..7c8b6b78b1 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/Makefile
@@ -29,9 +29,13 @@
PROG= in.ndpd
OBJS= config.o main.o ndp.o tables.o trace.o
SRCS= $(OBJS:%.o=%.c)
+SVCMETHOD= svc-ndp
+MANIFEST= ndp.xml
include ../../../Makefile.cmd
+ROOTMANIFESTDIR= $(ROOTSVCNETWORKROUTING)
+
# in.ndpd uses the ancillary data feature which is available only through
# UNIX 98 standards version of Socket interface. This interface is supposed to
# be accessed by -lxnet. In addition -lsocket and -lnsl are used to
@@ -66,7 +70,9 @@ $(PROG): $(OBJS)
include ../Makefile.lib
-install: all $(ROOTLIBINETPROG)
+install: all $(ROOTLIBINETPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
+
+check: $(CHKMANIFEST)
clean:
$(RM) $(OBJS)
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.xml b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.xml
new file mode 100644
index 0000000000..492255a1b6
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/ndp.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2006 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 (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+-->
+
+<service_bundle type='manifest' name='SUNWroute:ndp'>
+
+<service
+ name='network/routing/ndp'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <instance name='default' enabled='false' >
+
+ <dependency
+ name='network_routing_setup'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/network/routing-setup' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-ndp'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'
+privileges='basic,proc_owner,proc_fork,proc_exec,proc_info,proc_session,file_chown,sys_net_config,net_privaddr,net_icmpaccess'/>
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'/>
+ </method_context>
+ </exec_method>
+
+ <!-- to start stop routing services -->
+ <property_group name='general' type='framework'>
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ </property_group>
+
+ <!-- Properties in this group are used by routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <stability value='Unstable' />
+ <propval name='protocol' type='astring' value='ipv6' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+
+ <!-- Properties in this group are modifiable via routeadm (1M) -->
+ <property_group name='routing' type='application'>
+ <stability value='Evolving' />
+
+ <!-- equivalent to -a option if false -->
+ <propval name='stateless_addr_conf' type='boolean'
+ value='true' />
+
+ <!-- equivalent to -d option if true -->
+ <propval name='debug' type='boolean' value='false' />
+
+ <!-- equivalent to -f config_file option if set -->
+ <propval name='config_file' type='astring' value='' />
+
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ in.ndpd IPv6 neighbour discovery daemon
+ </loctext>
+ </common_name>
+ <documentation>
+ <manpage title='in.ndpd' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+ </instance>
+ <stability value='Unstable' />
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/svc-ndp b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/svc-ndp
new file mode 100644
index 0000000000..a5d53087b7
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/svc-ndp
@@ -0,0 +1,76 @@
+#!/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+. /lib/svc/share/smf_include.sh
+. /lib/svc/share/routing_include.sh
+
+smf_is_globalzone || exit $SMF_EXIT_OK
+
+daemon_args=`get_daemon_args $SMF_FMRI`
+options="adtf:"
+
+numv6ifs=`/usr/sbin/ifconfig -au6 | /usr/bin/grep -c inet6`
+if [ "$numv6ifs" = "0" ]; then
+ #
+ # No v6 interfaces configured, trigger an error
+ #
+ echo "No IPv6 interfaces are configured, cannot run ndp service."
+ exit $SMF_EXIT_ERROR_CONFIG
+fi
+
+#
+# Handle upgrade - routing/daemon-args property must be mapped to properties
+# in routeadm property group. Note that the SMF-incompatible -t option is not
+# supported, since it requires that in.ndpd run in the foreground.
+#
+if [ -n "$daemon_args" ]; then
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "a" stateless_addr_conf false true
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "d" debug true false
+ set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "f" config_file
+ clear_daemon_args $SMF_FMRI
+fi
+
+#
+# Assemble arguments to daemon from properties
+#
+args="`get_daemon_option_from_boolean_property $SMF_FMRI stateless_addr_conf \
+ a false`"
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI debug d true`"
+if [ -n "$args" ]; then
+ args="-${args}"
+fi
+args="$args `get_daemon_option_from_property $SMF_FMRI config_file f`"
+
+
+/usr/lib/inet/in.ndpd $args
+
+[ "$?" = 0 ] || exit $SMF_EXIT_ERR_FATAL
+
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/Makefile
index e31bb691a2..3a83bbdb9f 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,12 +27,17 @@
# cmd/cmd-inet/usr.lib/in.ripngd/Makefile
#
+SVCMETHOD= svc-ripng
+MANIFEST= ripng.xml
+
PROG= in.ripngd
OBJS= if.o input.o main.o output.o startup.o tables.o timer.o trace.o
SRCS= $(OBJS:%.o=%.c)
include ../../../Makefile.cmd
+ROOTMANIFESTDIR= $(ROOTSVCNETWORKROUTING)
+
# these #defines are required to use UNIX 98 interfaces
_D_UNIX98_EXTN= -D_XOPEN_SOURCE=500 -D__EXTENSIONS__
@@ -61,12 +65,13 @@ $(PROG): $(OBJS)
include ../Makefile.lib
-install: all $(ROOTLIBINETPROG)
+install: all $(ROOTLIBINETPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
+
+check: $(CHKMANIFEST)
clean:
$(RM) $(OBJS)
-lint:
- $(LINT.c) $(SRCS) $(LDLIBS)
+lint: lint_SRCS
include ../../../Makefile.targ
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/ripng.xml b/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/ripng.xml
new file mode 100644
index 0000000000..63a41b3d66
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/ripng.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2006 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 (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+-->
+
+<service_bundle type='manifest' name='SUNWroute:ripng'>
+
+<service
+ name='network/routing/ripng'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <instance name='default' enabled='false' >
+
+ <!--
+ in.ripngd will not run unless routing-setup has run.
+ -->
+ <dependency
+ name='network_routing_setup'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/network/routing-setup' />
+ </dependency>
+
+ <!--
+ We only start in.ripngd if IPv6 forwarding is enabled. This
+ is due to a giant gap in in.ripngd's design which causes
+ in.ripngd to propagate routes on all interfaces regardless of
+ their forwarding status. If that's fixed, then we can start
+ in.ripngd regardless of the global IPv6 forwarding status.
+ -->
+ <dependency
+ name='ipv6_forwarding'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/network/ipv6-forwarding' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-ripng'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'
+privileges='basic,proc_owner,proc_fork,proc_exec,proc_info,proc_session,file_chown,sys_net_config,net_privaddr,net_icmpaccess,net_rawaccess'/>
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'/>
+ </method_context>
+ </exec_method>
+
+ <!-- to start stop routing services -->
+ <property_group name='general' type='framework'>
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ </property_group>
+
+ <!-- Properties in this group are used by routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <stability value='Unstable' />
+ <!-- Identifies service as a routing service -->
+ <propval name='protocol' type='astring' value='ipv6' />
+ <propval name='daemon' type='astring'
+ value='/usr/lib/inet/in.ripngd' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <!-- Properties in this group are modifiable via routeadm (1M) -->
+ <property_group name='routing' type='application'>
+ <stability value='Evolving' />
+
+ <!-- Equivalent to -s option if true, -q option if false -->
+ <propval name='supply_routes' type='boolean' value='true' />
+
+ <!-- Equivalent to -p port option -->
+ <propval name='udp_port' type='integer' value='521' />
+
+ <!-- Equivalent to -P option if false -->
+ <propval name='poison_reverse' type='boolean' value='true' />
+
+ <!-- Equivalent to -v option if true -->
+ <propval name='verbose' type='boolean' value='false' />
+
+ <!-- Equivalent to optional logging file -->
+ <propval name='log_file' type='astring' value='' />
+
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ in.ripngd network routing daemon
+ </loctext>
+ </common_name>
+ <documentation>
+ <manpage title='in.ripngd' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+ </instance>
+ <stability value='Unstable' />
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/svc-ripng b/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/svc-ripng
new file mode 100644
index 0000000000..4e810af458
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/svc-ripng
@@ -0,0 +1,83 @@
+#!/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+. /lib/svc/share/smf_include.sh
+. /lib/svc/share/routing_include.sh
+
+smf_is_globalzone || exit $SMF_EXIT_OK
+
+daemon_args=`get_daemon_args $SMF_FMRI`
+options="sqp:Ptv"
+
+#
+# Handle upgrade - routing/daemon-args property must be mapped to properties
+# in routeadm property group. Note the SMF-incompatible -t option is not
+# supported, since it requires that in.ripngd run in the foreground.
+#
+if [ -n "$daemon_args" ]; then
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "q" supply_routes false true
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "s" supply_routes true
+ set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "p" udp_port 521
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "P" poison_reverse false true
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "v" verbose true false
+ set_daemon_nonoption_properties "$SMF_FMRI" "$daemon_args" \
+ "$options" "log_file"
+ clear_daemon_args $SMF_FMRI
+fi
+
+#
+# Assemble arguments to daemon from properties
+#
+args="`get_daemon_option_from_boolean_property $SMF_FMRI \
+ supply_routes -q false`"
+args="$args `get_daemon_option_from_boolean_property $SMF_FMRI \
+ supply_routes -s true`"
+args="$args `get_daemon_option_from_property $SMF_FMRI udp_port p 521`"
+args="$args `get_daemon_option_from_boolean_property $SMF_FMRI \
+ poison_reverse -P false`"
+args="$args `get_daemon_option_from_boolean_property $SMF_FMRI \
+ verbose -v true`"
+args="$args `get_daemon_nonoption_property $SMF_FMRI log_file`"
+
+#
+# If in.ndpd isn't already running, then we start it here because
+# in.ripngd depends on having routes based on the prefixes configured by
+# in.ndpd.
+#
+/usr/sbin/svcadm enable -st ndp
+[ "$?" = "$SMF_EXIT_OK" ] || exit $SMF_EXIT_ERR_FATAL
+
+/usr/lib/inet/in.ripngd $args
+
+[ "$?" = 0 ] || exit $SMF_EXIT_ERR_FATAL
+
+exit "$SMF_EXIT_OK"
diff --git a/usr/src/cmd/cmd-inet/usr.lib/inetd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/inetd/Makefile
index 90d268cf6b..3e22b4662f 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/inetd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/inetd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -40,7 +39,6 @@ include ../../Makefile.cmd-inet
include ../../../svc/Makefile.ctf
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-$(ROOTMANIFEST) := FILEMODE= 444
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -I$(CMDINETCOMMONDIR) -I$(ROOTSFWINCLUDE) \
-D_REENTRANT
@@ -71,14 +69,6 @@ install: all $(ROOTLIBINETPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
-$(RM) $(ROOTUSRSBINPROG)
-$(SYMLINK) ../lib/inet/${PROG} $(ROOTUSRSBINPROG)
-$(ROOTMANIFEST): $(ROOTMANIFESTDIR)
-
-$(ROOTMANIFESTDIR):
- $(INS.dir)
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
-
check: $(CHKMANIFEST)
clean:
diff --git a/usr/src/cmd/cmd-inet/usr.lib/slpd/Makefile b/usr/src/cmd/cmd-inet/usr.lib/slpd/Makefile
index bbad20743c..61fc159dd4 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/slpd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.lib/slpd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/Makefile
index fffa73e349..431d407e70 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/Makefile
@@ -33,7 +33,7 @@ XMODPROG= wanbootutil
# EXPORT DELETE END
PROG= 6to4relay arp gettable if_mpadm ikeadm ikecert \
- in.comsat in.fingerd in.rarpd in.rdisc in.rexecd in.rlogind \
+ in.comsat in.fingerd in.rarpd in.rexecd in.rlogind \
in.rshd in.rwhod in.telnetd in.tftpd in.tnamed ipaddrsel \
ipsecalgs ipsecconf ipseckey ndd $(SYNCPROG) $(DHCPPROG) \
$(XMODPROG)
@@ -41,18 +41,18 @@ PROG= 6to4relay arp gettable if_mpadm ikeadm ikecert \
MANIFEST= rarp.xml telnet.xml comsat.xml finger.xml \
login.xml shell.xml rexec.xml tname.xml
-ROOTFS_PROG= hostconfig route routeadm soconfig
-SBINLINKS= hostconfig route routeadm
+ROOTFS_PROG= hostconfig route soconfig
+SBINLINKS= hostconfig route
RPCSVCPROG= hostconfig
AUDITPROG= in.rexecd in.rlogind in.rshd in.telnetd
PAMPROG= in.rexecd in.rlogind in.rshd in.telnetd
SOCKETPROG= 6to4relay arp gettable hostconfig if_mpadm in.comsat \
- in.fingerd in.rarpd in.rdisc in.rexecd in.rlogind in.rshd \
+ in.fingerd in.rarpd in.rexecd in.rlogind in.rshd \
in.rwhod in.telnetd in.tftpd in.tnamed ipaddrsel \
- ipsecalgs ipsecconf ipseckey route routeadm
+ ipsecalgs ipsecconf ipseckey route
NSLPROG= 6to4relay arp gettable hostconfig ikeadm in.comsat in.rarpd \
- in.rdisc in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
+ in.rexecd in.rlogind in.rshd in.rwhod in.telnetd \
in.tftpd in.tnamed ipaddrsel ipsecalgs ipsecconf ipseckey route
CMDPROG= in.telnetd
IPSECUTILPROG= ikeadm ipsecalgs ipsecconf ipseckey
@@ -67,27 +67,28 @@ K5RLOGINOBJS= in.rlogind.o
K5RSHDOBJS= in.rshd.o
SRCS= $(PROGSRCS) $(OTHERSRC)
-SUBDIRS= bootconfchk htable ifconfig in.ftpd in.routed \
+SUBDIRS= bootconfchk htable ifconfig in.ftpd in.rdisc in.routed \
in.talkd inetadm inetconv ipqosconf kssl/kssladm \
- kssl/ksslcfg mipagentconfig mipagentstat ping snoop \
- sppptun traceroute wificonfig
+ kssl/ksslcfg mipagentconfig mipagentstat ping routeadm \
+ snoop sppptun traceroute wificonfig
MSGSUBDIRS= bootconfchk htable ifconfig in.ftpd in.routed in.talkd \
inetadm inetconv ipqosconf kssl/ksslcfg mipagentconfig \
- mipagentstat sppptun snoop wificonfig
+ mipagentstat routeadm sppptun snoop wificonfig
# As programs get lint-clean, add them here and to the 'lint' target.
# Eventually this hack should go away, and all in PROG should be
# lint-clean.
LINTCLEAN= 6to4relay arp ikeadm in.rlogind in.rshd in.telnetd in.tftpd \
- ipaddrsel ipsecalgs ipseckey ipsecconf route routeadm \
+ ipaddrsel ipsecalgs ipseckey ipsecconf route \
in.rarpd if_mpadm $(SYNCPROG)
# Likewise, as subdirs get lint-clean, add them here. Once
# they're all clean, replace the dependency of the lint target
# with SUBDIRS. Also (sigh) deal with the commented-out build lines
# for the lint rule.
-LINTSUBDIRS= bootconfchk in.routed in.talkd inetadm inetconv ipqosconf \
- mipagentstat ping sppptun traceroute wificonfig
+LINTSUBDIRS= bootconfchk in.rdisc in.routed in.talkd inetadm inetconv \
+ ipqosconf mipagentstat ping routeadm sppptun traceroute \
+ wificonfig
# And as programs are verified not to attempt to write into constants,
# -xstrconst should be used to ensure they stay that way.
CONSTCLEAN= ikeadm
@@ -108,7 +109,7 @@ SRCS+= $(COMMONSRCS)
# Message catalog
#
POFILES= 6to4relay.po if_mpadm.po ikeadm.po in.comsat.po ipaddrsel.po \
- ipsecalgs.po ipsecconf.po ipseckey.po route.po routeadm.po
+ ipsecalgs.po ipsecconf.po ipseckey.po route.po
POFILE= usr.sbin.po
all:= TARGET= all
@@ -121,7 +122,7 @@ _msg:= TARGET= _msg
CLOBBERFILES += $(ROOTFS_PROG) $(PROG)
CLEANFILES += $(COMMONOBJS) $(K5RLOGINOBJS) $(K5RSHDOBJS) $(TFTPDOBJS)
-CPPFLAGS += -DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I.
+CPPFLAGS += -DSYSV -DBSD_COMP -I$(CMDINETCOMMONDIR) -I
include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
K5LIBS=
@@ -247,7 +248,6 @@ lint: $(LINTSUBDIRS)
$(LINT.c) ipseckey.c $(LDLIBS) -lsocket -lnsl -lipsecutil
$(LINT.c) ikeadm.c $(LDLIBS) -lnsl -lipsecutil
$(LINT.c) route.c $(LDLIBS) -lsocket -lnsl -ltsnet
- $(LINT.c) routeadm.c $(LDLIBS) -lsocket
$(LINT.c) syncinit.c $(LDLIBS) -ldlpi
$(LINT.c) syncloop.c $(LDLIBS) -ldlpi
$(LINT.c) syncstat.c $(LDLIBS) -ldlpi
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/Makefile
index 099577dde1..5b317f637b 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.ftpd/Makefile
@@ -1,15 +1,16 @@
#
# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-include ../../../Makefile.cmd
-
PROG= in.ftpd ftpcount ftpshut ftprestart privatepw
-MANIFEST= ftp.xml
SCRIPTS= ftpaddhost ftpconfig
+MANIFEST= ftp.xml
+
+include ../../../Makefile.cmd
+
COMMON_OBJS= COPYRIGHT.o vers.o
FTPD_OBJS= $(COMMON_OBJS) ftpd.o ftpcmd.o glob.o logwtmp.o popen.o \
access.o extensions.o realpath.o acl.o private.o \
@@ -35,7 +36,6 @@ ROOTFTPCOUNT= $(ROOTUSRSBIN)/ftpcount
ROOTFTPWHO= $(ROOTUSRSBIN)/ftpwho
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-$(ROOTMANIFEST) := FILEMODE= 444
# I18n
POFILE= in.ftpd_all.po
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/Makefile
new file mode 100644
index 0000000000..63f1fb1fb6
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/Makefile
@@ -0,0 +1,49 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+PROG= in.rdisc
+MANIFEST= rdisc.xml
+SVCMETHOD= svc-rdisc
+
+include ../../../Makefile.cmd
+
+ROOTMANIFESTDIR= $(ROOTSVCNETWORKROUTING)
+
+LDLIBS += -lsocket -lnsl
+
+CPPFLAGS += -DSYSV -DBSD_COMP
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+install: all $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
+
+check: $(CHKMANIFEST)
+
+clean lint:
+
+include ../../../Makefile.targ
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc.c b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/in.rdisc.c
index bf0aec2212..bf0aec2212 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/in.rdisc.c
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/rdisc.xml b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/rdisc.xml
new file mode 100644
index 0000000000..1e31425b01
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/rdisc.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2006 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 (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+-->
+
+<service_bundle type='manifest' name='SUNWroute:rdisc'>
+
+<service
+ name='network/routing/rdisc'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <instance name='default' enabled='false' >
+
+ <!-- in.rdisc will not run unless routing-setup has run -->
+ <dependency
+ name='network_routing_setup'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/network/routing-setup' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-rdisc'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'
+privileges='basic,proc_owner,proc_fork,proc_exec,proc_info,proc_session,file_chown,sys_net_config,net_icmpaccess,net_rawaccess'/>
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'/>
+ </method_context>
+ </exec_method>
+
+ <!-- to start stop routing services -->
+ <property_group name='general' type='framework'>
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ </property_group>
+
+ <!-- Properties in this group are used by routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <stability value='Unstable' />
+ <propval name='protocol' type='astring' value='ipv4' />
+ <propval name='daemon' type='astring'
+ value='/usr/sbin/in.rdisc' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+
+ <!-- Properties in this group are modifiable via routeadm (1M) -->
+ <property_group name='routing' type='application'>
+ <stability value='Evolving' />
+
+ <!-- Equivalent to specifying send_address -->
+ <propval name='send_address' type='astring' value='' />
+
+ <!-- Equivalent to specifying receive_address -->
+ <propval name='receive_address' type='astring' value='' />
+
+ <!-- Equivalent to -r option if true -->
+ <propval name='act_as_router' type='boolean' value='false' />
+
+ <!-- Equivalent to -a option if true -->
+ <propval name='accept_all' type='boolean' value='false' />
+
+ <!-- Equivalent to -p preference option if set -->
+ <propval name='preference' type='integer' value='0' />
+
+ <!-- Equivalent to -T interval option -->
+ <propval name='transmit_interval' type='integer' value='600' />
+
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ in.rdisc network router discovery daemon
+ </loctext>
+ </common_name>
+ <documentation>
+ <manpage title='in.rdisc' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+
+ </instance>
+ <stability value='Unstable' />
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/svc-rdisc b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/svc-rdisc
new file mode 100644
index 0000000000..76cdda3604
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.rdisc/svc-rdisc
@@ -0,0 +1,71 @@
+#!/bin/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+. /lib/svc/share/smf_include.sh
+. /lib/svc/share/routing_include.sh
+
+smf_is_globalzone || exit $SMF_EXIT_OK
+
+daemon_args=`get_daemon_args $SMF_FMRI`
+options="afsp:T:r"
+
+#
+# Handle upgrade - routing/daemon-args property must be mapped to properties
+# in routeadm property group. The -s option is not supported as it is
+# not compatible with SMF.
+#
+if [ -n "$daemon_args" ]; then
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "a" accept_all true false
+ set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "p" preference 0
+ set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "T" transmit_interval 600
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "r" act_as_router true false
+ set_daemon_nonoption_properties "$SMF_FMRI" "$daemon_args" \
+ "$options" "send_address receive_address"
+ clear_daemon_args $SMF_FMRI
+fi
+
+#
+# Assemble arguments to daemon from properties
+#
+args="`get_daemon_option_from_boolean_property $SMF_FMRI accept_all -a true`"
+args="$args `get_daemon_option_from_property $SMF_FMRI preference -p 0`"
+args="$args `get_daemon_option_from_property $SMF_FMRI transmit_interval \
+ T 600`"
+args="$args `get_daemon_option_from_boolean_property $SMF_FMRI act_as_router \
+ -r true`"
+args="$args `get_daemon_nonoption_property $SMF_FMRI send_address`"
+args="$args `get_daemon_nonoption_property $SMF_FMRI receive_address`"
+
+/usr/sbin/in.rdisc $args -f
+
+[ "$?" = 0 ] || exit $SMF_EXIT_ERR_FATAL
+
+exit "$SMF_EXIT_OK"
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/Makefile
index e225fb1df9..a76371fb0e 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/Makefile
@@ -17,7 +17,12 @@ POFILEOBJS= $(ROUTEDOBJS) $(RTQUERYOBJS)
PROG= $(ROUTEDPROG) $(RTQUERYPROG)
SRCS= $(ROUTEDSRCS) $(RTQUERYSRCS)
-include ../../../Makefile.cmd
+MANIFEST= route.xml
+SVCMETHOD= svc-route
+
+include ../../../Makefile.cmd
+
+ROOTMANIFESTDIR= $(ROOTSVCNETWORKROUTING)
#
# in.routed uses ancillary data features available through
@@ -74,7 +79,9 @@ lint:
$(LINT.c) $(ROUTEDSRCS) $(LDLIBS)
$(LINT.c) $(RTQUERYSRCS) $(LDLIBS)
-install: all $(ROOTUSRSBINPROG) $(MANTARGET)
+install: all $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
+
+check: $(CHKMANIFEST)
clean:
$(RM) $(CLEAN_FILES)
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/route.xml b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/route.xml
new file mode 100644
index 0000000000..5802b97ff8
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/route.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2006 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 (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+-->
+
+<service_bundle type='manifest' name='SUNWroute:route'>
+
+<service
+ name='network/routing/route'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <instance name='default' enabled='false' >
+
+ <!-- in.routed will not run unless routing-setup has run -->
+ <dependency
+ name='network_routing_setup'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/network/routing-setup' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-route'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'
+privileges='basic,proc_owner,proc_fork,proc_exec,proc_info,proc_session,file_chown,sys_net_config,net_privaddr,net_icmpaccess,net_rawaccess'/>
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='60'>
+ <method_context>
+ <method_credential user='root' group='root'/>
+ </method_context>
+ </exec_method>
+
+ <!-- to start stop routing services -->
+ <property_group name='general' type='framework'>
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ </property_group>
+
+ <!-- Properties in this group are used by routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <stability value='Unstable' />
+ <propval name='protocol' type='astring' value='ipv4' />
+ <propval name='daemon' type='astring'
+ value='/usr/sbin/in.routed' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <!-- Properties in this group are modifiable via routeadm (1M) -->
+ <property_group name='routing' type='application'>
+ <stability value='Evolving' />
+
+ <!-- Equivalent to -A option if false -->
+ <propval name='ignore_auth' type='boolean' value='true' />
+
+ <!-- Equivalent to -F specificied route minimization list -->
+ <propval name='minimize_routes' type='astring' value=''/>
+
+ <!-- Equivalent to -g option if true -->
+ <propval name='offer_default_route' type='boolean'
+ value='false' />
+
+ <!-- Equivalent to -h option if false -->
+ <propval name='advertise_host_routes' type='boolean'
+ value='true' />
+
+ <!-- Equivalent to -m option if true -->
+ <propval name='advertise_host_routes_primary' type='boolean'
+ value='false' />
+
+ <!-- Equivalent to -n option if false -->
+ <propval name='install_routes' type='boolean' value='false' />
+
+ <!-- Equivalent to -P specified parameter list -->
+ <propval name='parameters' type='astring' value='' />
+
+ <!-- Equivalent to -s option if true, -q if false -->
+ <propval name='supply_routes' type='boolean' value='true' />
+
+ <!-- Equivalent to -S option if true -->
+ <propval name='default_routes_only' type='boolean'
+ value='false' />
+
+ <!-- Equivalent to -T tracefile option -->
+ <propval name='log_file' type='astring' value='' />
+
+ <!-- Equivalent to -v/-z option if true -->
+ <propval name='debug' type='boolean' value='false' />
+
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ in.routed network routing daemon
+ </loctext>
+ </common_name>
+ <documentation>
+ <manpage title='in.routed' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+ </instance>
+ <stability value='Unstable' />
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/svc-route b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/svc-route
new file mode 100644
index 0000000000..aa674562eb
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/svc-route
@@ -0,0 +1,112 @@
+#!/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+. /lib/svc/share/smf_include.sh
+. /lib/svc/share/routing_include.sh
+
+smf_is_globalzone || exit $SMF_EXIT_OK
+
+daemon_args=`get_daemon_args $SMF_FMRI`
+options="AdghmnqsStvVzT:F:P:"
+
+#
+# Handle upgrade - routing/daemon-args property must be mapped to properties
+# in routeadm property group. Note that the SMF-incompatible -t option is not
+# supported, since it requires that in.routed run in the foreground.
+#
+if [ -n "$daemon_args" ]; then
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "A" ignore_auth false true
+ set_daemon_ordered_multivalue_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "F" minimize_routes
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "g" offer_default_route true false
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "h" advertise_host_routes false true
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "m" advertise_host_routes_primary true false
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "n" install_routes false true
+ set_daemon_ordered_multivalue_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "P" parameters
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "q" supply_routes false true
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "s" supply_routes true
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "S" default_routes_only true false
+ set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "T" log_file
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "v" debug true false
+ set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
+ "$options" "z" debug true
+ clear_daemon_args $SMF_FMRI
+fi
+
+#
+# Assemble arguments to daemon from properties
+#
+args="`get_daemon_option_from_boolean_property $SMF_FMRI ignore_auth \
+ A false`"
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ offer_default_route g true`"
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ advertise_host_routes h false`"
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ advertise_host_routes_primary m true`"
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ install_routes n false`"
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ supply_routes q false`"
+# We only use -s option when there are multiple network interfaces.
+numv4ifs=`/usr/sbin/ifconfig -a4u | \
+ /usr/bin/nawk '($1 == "inet" && $2 != "127.0.0.1") { print $2 }' | \
+ /usr/bin/wc -l`
+if [ "$numv4ifs" -gt 1 ]; then
+ args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ supply_routes s true`"
+fi
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ default_routes_only S true`"
+args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
+ debug z true`"
+if [ -n "$args" ]; then
+ args="-${args}"
+fi
+args="$args `get_daemon_ordered_multivalue_option_from_property $SMF_FMRI \
+ minimize_routes F`"
+args="$args `get_daemon_ordered_multivalue_option_from_property \
+ $SMF_FMRI parameters P`"
+args="$args `get_daemon_option_from_property $SMF_FMRI \
+ log_file T`"
+
+/usr/sbin/in.routed $args
+
+[ "$?" = 0 ] || exit $SMF_EXIT_ERR_FATAL
+
+exit "$SMF_EXIT_OK"
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.talkd/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/in.talkd/Makefile
index 2cd82d1018..0d9a813d9f 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.talkd/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.talkd/Makefile
@@ -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.
@@ -22,7 +21,7 @@
#
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/kssl/ksslcfg/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/kssl/ksslcfg/Makefile
index 6103a7d746..7adf6a121a 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/kssl/ksslcfg/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.sbin/kssl/ksslcfg/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -44,7 +43,6 @@ POFILE = $(PROG)_all.po
SRCS = $(OBJS:%.o=%.c)
ROOTMANIFESTDIR= $(ROOTSVCNETWORKSSL)
-$(ROOTMANIFEST):= FILEMODE= 444
.KEEP_STATE:
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm.c b/usr/src/cmd/cmd-inet/usr.sbin/routeadm.c
deleted file mode 100644
index dd7783cf7f..0000000000
--- a/usr/src/cmd/cmd-inet/usr.sbin/routeadm.c
+++ /dev/null
@@ -1,1280 +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 2004 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 <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <ctype.h>
-#include <stropts.h>
-#include <errno.h>
-#include <libintl.h>
-#include <locale.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <procfs.h>
-#include <inet/ip.h>
-#include <inet/nd.h>
-#include <net/if.h>
-
-static char *myname; /* copied from argv[0] */
-
-#define RA_CONF_FILE "/etc/inet/routing.conf"
-#define RA_MAX_CONF_LINE 256
-#define ND_IP_FORWARDING "ip_forwarding"
-#define ND_IP6_FORWARDING "ip6_forwarding"
-#define ND_IP6_SENDREDIR "ip6_send_redirects"
-#define ND_IP6_IGNREDIR "ip6_ignore_redirect"
-#define ND_ON_STR "\0" "1" "\0"
-#define ND_OFF_STR "\0" "0" "\0"
-#define OPT_STRBUFSIZE 1024
-#define RAD_ARGNUM 10
-
-#define IPV4_ROUTING_DAEMON_DEF "/usr/sbin/in.routed"
-#define IPV4_ROUTING_DAEMON_ARGS_DEF ""
-#define IPV4_ROUTING_STOP_CMD_DEF "kill -TERM `cat /var/tmp/in.routed.pid`"
-#define IPV6_ROUTING_DAEMON_DEF "/usr/lib/inet/in.ripngd"
-#define IPV6_ROUTING_DAEMON_ARGS_DEF "-s"
-#define IPV6_ROUTING_STOP_CMD_DEF "kill -TERM `cat /var/tmp/in.ripngd.pid`"
-#define NDPD_DAEMON_DEF "/usr/lib/inet/in.ndpd"
-#define NDPD_STOP_CMD_DEF "kill -TERM `cat /var/run/in.ndpd.pid`"
-
-#define IN_ROUTED_PID "/var/run/in.routed.pid"
-#define IN_RIPNGD_PID "/var/run/in.ripngd.pid"
-#define IN_NDPD_PID "/var/run/in.ndpd.pid"
-
-/*
- * The rad_stop_cmd is exec-ed only if rad_pidfile is NULL, i.e.,
- * default routing daemon has changed.
- */
-typedef struct ra_daemon {
- size_t rad_argvsize;
- char **rad_argv;
- char *rad_pidfile;
- char *rad_stop_cmd;
-} ra_daemon_t;
-
-static ra_daemon_t v4d, v6d;
-static char *ndpd_args[] = { NDPD_DAEMON_DEF, NULL };
-static ra_daemon_t in_ndpd = { 2, ndpd_args, IN_NDPD_PID, NDPD_STOP_CMD_DEF };
-
-static char nd_ip_forw_on[] = ND_IP_FORWARDING ND_ON_STR;
-static char nd_ip_forw_off[] = ND_IP_FORWARDING ND_OFF_STR;
-static char nd_ip6_forw_on[] = ND_IP6_FORWARDING ND_ON_STR;
-static char nd_ip6_forw_off[] = ND_IP6_FORWARDING ND_OFF_STR;
-static char nd_ip6_sendredir_on[] = ND_IP6_SENDREDIR ND_ON_STR;
-static char nd_ip6_sendredir_off[] = ND_IP6_SENDREDIR ND_OFF_STR;
-static char nd_ip6_ignredir_on[] = ND_IP6_IGNREDIR ND_ON_STR;
-static char nd_ip6_ignredir_off[] = ND_IP6_IGNREDIR ND_OFF_STR;
-
-static int ipsock = -1;
-static boolean_t booting = B_FALSE; /* boot script defaults? */
-static boolean_t forwarding_only = B_FALSE;
-
-typedef enum option_values {
- OPT_INVALID, OPT_ENABLED, OPT_DISABLED, OPT_DEFAULT, OPT_UNKNOWN
-} oval_t;
-
-#define OPT2STR(oval) \
- (oval == OPT_ENABLED ? "enabled" : \
- (oval == OPT_UNKNOWN ? "unknown" : \
- (oval == OPT_DISABLED ? "disabled" : "default")))
-#define OPT2INTLSTR(oval) \
- (oval == OPT_ENABLED ? gettext("enabled") : \
- (oval == OPT_UNKNOWN ? gettext("unknown") : \
- (oval == OPT_DISABLED ? gettext("disabled") : \
- gettext("default"))))
-
-typedef oval_t (*ra_stat_func_t)(void);
-typedef void (*ra_update_func_t)(void);
-
-/*
- * A routeadm option. These options are those that are enabled or disabled
- * with the -e and -d command-line options.
- */
-typedef struct ra_opt {
- const char *opt_name;
- oval_t opt_new; /* specified on command-line */
- oval_t opt_newrev; /* new revert value on command-line */
- oval_t opt_conf; /* value currently configured */
- oval_t opt_rev; /* revert value configured */
- oval_t opt_def; /* default value */
- ra_update_func_t opt_enable;
- ra_update_func_t opt_disable;
- ra_stat_func_t opt_getcur;
-} raopt_t;
-
-#define OPT_IS_FORWARDING(opt) \
- (strcmp((opt).opt_name, "ipv4-forwarding") == 0 || \
- strcmp((opt).opt_name, "ipv6-forwarding") == 0)
-
-/*
- * A routeadm variable. These are assigned using the -s command-line
- * option.
- */
-typedef struct ra_var {
- const char *var_name;
- char *var_new; /* specified on command-line */
- char *var_conf; /* Currently configured value */
- char *var_def; /* The variable's default value */
-} ravar_t;
-
-static boolean_t init_daemon(ra_daemon_t *, ravar_t *, ravar_t *, ravar_t *,
- char *);
-static oval_t v4forw_cur(void);
-static oval_t v4rout_cur(void);
-static oval_t v6forw_cur(void);
-static oval_t v6rout_cur(void);
-static void enable_v4forw(void);
-static void disable_v4forw(void);
-static void enable_v4rout(void);
-static void disable_v4rout(void);
-static void enable_v6forw(void);
-static void disable_v6forw(void);
-static void enable_v6rout(void);
-static void disable_v6rout(void);
-static void usage(void);
-static void ra_update(void);
-static void ra_report(boolean_t);
-static int ra_parseconf(void);
-static int ra_parseopt(char *, int, raopt_t *);
-static int ra_parsevar(char *, int, ravar_t *);
-static int ra_writeconf(void);
-static raopt_t *ra_str2opt(const char *);
-static oval_t ra_str2oval(const char *);
-static ravar_t *ra_str2var(const char *);
-static char *ra_intloptname(const char *);
-static int open_ipsock(void);
-static int ra_ndioctl(int, char *, int);
-static pid_t ra_isrunning(ra_daemon_t *);
-static void ra_rundaemon(ra_daemon_t *);
-static void ra_killdaemon(ra_daemon_t *);
-static int ra_numv6intfs(void);
-static void start_ndpd(void);
-
-
-/*
- * The list describing the supported options. If an option is added here,
- * remember to also add support for the human readable description of the
- * option to the ra_intloptname() function.
- */
-static raopt_t ra_opts[] = {
- { "ipv4-forwarding",
- OPT_INVALID, OPT_INVALID, OPT_INVALID, OPT_DISABLED, OPT_DISABLED,
- enable_v4forw, disable_v4forw, v4forw_cur },
- { "ipv4-routing",
- OPT_INVALID, OPT_INVALID, OPT_INVALID, OPT_ENABLED, OPT_DEFAULT,
- enable_v4rout, disable_v4rout, v4rout_cur },
- { "ipv6-forwarding",
- OPT_INVALID, OPT_INVALID, OPT_INVALID, OPT_DISABLED, OPT_DISABLED,
- enable_v6forw, disable_v6forw, v6forw_cur },
- { "ipv6-routing",
- OPT_INVALID, OPT_INVALID, OPT_INVALID, OPT_DISABLED, OPT_DISABLED,
- enable_v6rout, disable_v6rout, v6rout_cur },
- { NULL,
- OPT_INVALID, OPT_INVALID, OPT_INVALID, OPT_INVALID, OPT_INVALID,
- NULL, NULL, NULL }
-};
-
-char *v_opt[] = {
-#define IPV4_ROUTING_DAEMON 0
- "ipv4-routing-daemon",
-#define IPV4_ROUTING_DAEMON_ARGS 1
- "ipv4-routing-daemon-args",
-#define IPV4_ROUTING_STOP_CMD 2
- "ipv4-routing-stop-cmd",
-#define IPV6_ROUTING_DAEMON 3
- "ipv6-routing-daemon",
-#define IPV6_ROUTING_DAEMON_ARGS 4
- "ipv6-routing-daemon-args",
-#define IPV6_ROUTING_STOP_CMD 5
- "ipv6-routing-stop-cmd",
- NULL
-};
-
-
-/*
- * the list describing the supported routeadm variables.
- */
-static ravar_t ra_vars[] = {
- { "ipv4-routing-daemon", NULL, NULL, IPV4_ROUTING_DAEMON_DEF },
- { "ipv4-routing-daemon-args", NULL, NULL,
- IPV4_ROUTING_DAEMON_ARGS_DEF },
- { "ipv4-routing-stop-cmd", NULL, NULL, IPV4_ROUTING_STOP_CMD_DEF },
- { "ipv6-routing-daemon", NULL, NULL, IPV6_ROUTING_DAEMON_DEF },
- { "ipv6-routing-daemon-args", NULL, NULL,
- IPV6_ROUTING_DAEMON_ARGS_DEF },
- { "ipv6-routing-stop-cmd", NULL, NULL, IPV6_ROUTING_STOP_CMD_DEF },
- { NULL, NULL, NULL, NULL }
-};
-
-
-static void
-usage(void)
-{
- (void) fprintf(stderr, gettext(
- "usage: %1$s [-p] [-R <root-dir>]\n"
- " %1$s [-e <option>] [-d <option>] [-r <option>]\n"
- " [-s <var>=<val>] [-R <root-dir>]\n"
- " %1$s -u\n\n"
- " <option> is one of:\n"
- " ipv4-forwarding\n"
- " ipv4-routing\n"
- " ipv6-forwarding\n"
- " ipv6-routing\n\n"
- " <var> is one of:\n"
- " ipv4-routing-daemon\n"
- " ipv4-routing-daemon-args\n"
- " ipv4-routing-stop-cmd\n"
- " ipv6-routing-daemon\n"
- " ipv6-routing-daemon-args\n"
- " ipv6-routing-stop-cmd\n"), myname);
-}
-
-int
-main(int argc, char *argv[])
-{
- int opt, status = 0, opt_index;
- raopt_t *raopt;
- ravar_t *ravar;
- oval_t *val;
- boolean_t modify = B_FALSE;
- boolean_t update = B_FALSE;
- boolean_t parseable = B_FALSE;
- char *options, *value;
- int fdnull;
-
- myname = argv[0];
-
- (void) setlocale(LC_ALL, "");
-
-#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
-#define TEXT_DOMAIN "SYS_TEST"
-#endif
-
- (void) textdomain(TEXT_DOMAIN);
-
- while ((opt = getopt(argc, argv, "bd:e:FpR:r:s:u")) != EOF) {
- switch (opt) {
- case 'b':
- /*
- * This is a project-private option that allows the
- * boot script to give us revert values for all of
- * the options. These values will be used if the
- * user hasn't set the options, or has reverted
- * them using the -r flag. We save these values in
- * the config file so that we can fall back to
- * these when the admin uses "-r <option>".
- */
- booting = B_TRUE;
- break;
- case 'd':
- case 'e':
- case 'r':
- if ((raopt = ra_str2opt(optarg)) != NULL) {
- /*
- * If -b was specified, then the
- * values given are those we will revert to.
- */
- if (booting)
- val = &raopt->opt_newrev;
- else
- val = &raopt->opt_new;
- switch (opt) {
- case 'd':
- *val = OPT_DISABLED;
- break;
- case 'e':
- *val = OPT_ENABLED;
- break;
- case 'r':
- *val = raopt->opt_def;
- break;
- }
- } else if ((ravar = ra_str2var(optarg)) != NULL) {
- if (opt != 'r') {
- usage();
- return (EXIT_FAILURE);
- }
- ravar->var_new = ravar->var_def;
- } else {
- (void) fprintf(stderr, gettext(
- "%1$s: invalid option: %2$s\n"),
- myname, optarg);
- usage();
- return (EXIT_FAILURE);
- }
- modify = B_TRUE;
- break;
- case 'F':
- /*
- * This is a project-private option that allows the
- * net-loopback method to configure IP forwarding
- * before network interfaces are configured in
- * net-physical. This allows administrators to
- * configure interface-specific IP forwarding
- * settings in /etc/hostname*.* files by using the
- * "router" or "-router" ifconfig commands.
- */
- forwarding_only = B_TRUE;
- break;
- case 'p':
- parseable = B_TRUE;
- break;
- case 'R':
- if (chroot(optarg) == -1) {
- (void) fprintf(stderr, gettext(
- "%1$s: failed to chroot to %2$s: %3$s\n"),
- myname, optarg, strerror(errno));
- return (EXIT_FAILURE);
- }
- break;
- case 's':
- options = optarg;
- while (*options != '\0') {
- opt_index = getsubopt(&options, v_opt, &value);
-
- if (value == NULL) {
- usage();
- return (EXIT_FAILURE);
- }
- if (opt_index == -1) {
- (void) fprintf(stderr, gettext(
- "%1$s: invalid variable: %2$s\n"),
- myname, optarg);
- usage();
- return (EXIT_FAILURE);
- }
-
- ravar = &ra_vars[opt_index];
- if ((ravar->var_new = strdup(value)) == NULL) {
- (void) fprintf(stderr, gettext("%s: "
- "unable to allocate memory.\n"),
- myname);
- return (EXIT_FAILURE);
- }
- }
- modify = B_TRUE;
- break;
- case 'u':
- update = B_TRUE;
- break;
- default:
- usage();
- return (EXIT_FAILURE);
- }
- }
-
- if (argc > optind) {
- /* There shouldn't be any extra args. */
- usage();
- return (EXIT_FAILURE);
- }
-
- if (booting) {
- fdnull = open("/dev/null", O_RDWR);
- (void) dup2(fdnull, 2);
- }
-
- if (parseable && (update || modify)) {
- (void) fprintf(stderr, gettext("%s: the -p option cannot be "
- "used with any of -deru\n"), myname);
- usage();
- return (EXIT_FAILURE);
- }
-
- if (ra_parseconf() != 0)
- return (EXIT_FAILURE);
-
- if (modify)
- status = ra_writeconf();
-
- /*
- * In order to update the running system or print a report, the
- * daemon structures must reflect the current state of the
- * daemon configuration variables.
- */
- if (!init_daemon(&v4d, &ra_vars[IPV4_ROUTING_DAEMON],
- &ra_vars[IPV4_ROUTING_DAEMON_ARGS],
- &ra_vars[IPV4_ROUTING_STOP_CMD], IN_ROUTED_PID) ||
- !init_daemon(&v6d, &ra_vars[IPV6_ROUTING_DAEMON],
- &ra_vars[IPV6_ROUTING_DAEMON_ARGS],
- &ra_vars[IPV6_ROUTING_STOP_CMD], IN_RIPNGD_PID)) {
- return (EXIT_FAILURE);
- }
-
- if (update)
- ra_update();
-
- if (!modify && !update)
- ra_report(parseable);
-
- return (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
-}
-
-
-/*
- * Initialize the daemon structure pointed to by rad with the variables
- * passed in.
- */
-static boolean_t
-init_daemon(ra_daemon_t *rad, ravar_t *rv_exec, ravar_t *rv_args,
- ravar_t *rv_kill, char *rv_pidfile)
-{
- int i = 1;
- char *token = rv_args->var_conf;
- char *args;
-
- /*
- * We only use the pidfile if the admin hasn't altered the name
- * of the daemon or its kill command.
- */
- if (strcmp(rv_exec->var_conf, rv_exec->var_def) != 0 ||
- strcmp(rv_kill->var_conf, rv_kill->var_def) != 0) {
- rad->rad_pidfile = NULL;
- rad->rad_stop_cmd = rv_kill->var_conf;
- } else {
- rad->rad_pidfile = rv_pidfile;
- rad->rad_stop_cmd = NULL;
- }
- rad->rad_argvsize = RAD_ARGNUM;
- if ((rad->rad_argv = malloc(RAD_ARGNUM * sizeof (char *))) == NULL) {
- (void) fprintf(stderr, gettext("%s: out of memory\n"), myname);
- return (B_FALSE);
- }
- rad->rad_argv[0] = rv_exec->var_conf;
- if ((args = strdup(rv_args->var_conf)) == NULL) {
- (void) fprintf(stderr, gettext("%s: out of memory\n"), myname);
- free(rad->rad_argv);
- return (B_FALSE);
- }
- token = strtok(args, " ");
- while (token != NULL) {
- if (i == (rad->rad_argvsize - 1)) {
- rad->rad_argvsize += RAD_ARGNUM;
- if ((rad->rad_argv = realloc(rad->rad_argv,
- rad->rad_argvsize * sizeof (char *))) == NULL) {
- (void) fprintf(stderr,
- gettext("%s: out of memory\n"), myname);
- return (B_FALSE);
- }
- }
- rad->rad_argv[i] = token;
- token = strtok(NULL, " ");
- i++;
- }
- rad->rad_argv[i] = NULL;
- return (B_TRUE);
-}
-
-/* Apply currently configured values to the running system. */
-static void
-ra_update(void)
-{
- int i;
-
- for (i = 0; ra_opts[i].opt_name != NULL; i++) {
- /*
- * If we're only updating forwarding settings, skip all
- * options that aren't related to IP forwarding.
- */
- if (forwarding_only && !OPT_IS_FORWARDING(ra_opts[i]))
- continue;
-
- /*
- * Likewise, if we're booting (the net-init boot script has
- * specified -b on the command line) and we're updating the
- * rest of the options, skip the forwarding options we set
- * in the network boot script.
- */
- if (booting && OPT_IS_FORWARDING(ra_opts[i]))
- continue;
-
- switch (ra_opts[i].opt_conf) {
- case OPT_ENABLED:
- (ra_opts[i].opt_enable)();
- break;
- case OPT_DISABLED:
- (ra_opts[i].opt_disable)();
- break;
- case OPT_DEFAULT:
- switch (ra_opts[i].opt_rev) {
- case OPT_ENABLED:
- (ra_opts[i].opt_enable)();
- break;
- case OPT_DISABLED:
- (ra_opts[i].opt_disable)();
- break;
- }
- }
- }
-}
-
-/*
- * Print the configured values to stdout. If parseable is set, the output
- * is machine readable. The parseable output is of the form:
- * <varname> persistent=<opt_conf> default=<opt_rev> current=<opt_getcur()>
- * for options, and is of the form:
- * <varname> persistent=<var_conf> default=<var_def>
- * for variables.
- */
-static void
-ra_report(boolean_t parseable)
-{
- int i;
- char confstr[OPT_STRBUFSIZE];
- oval_t curval;
-
- if (parseable) {
- for (i = 0; ra_opts[i].opt_name != NULL; i++) {
- curval = (ra_opts[i].opt_getcur)();
- (void) printf("%s persistent=%s default=%s "
- "current=%s\n", ra_opts[i].opt_name,
- OPT2STR(ra_opts[i].opt_conf),
- OPT2STR(ra_opts[i].opt_rev),
- OPT2STR(curval));
- }
- for (i = 0; ra_vars[i].var_name != NULL; i++) {
- (void) printf("%s persistent=\"%s\" "
- "default=\"%s\" \n",
- ra_vars[i].var_name, ra_vars[i].var_conf,
- ra_vars[i].var_def);
- }
- return;
- }
-
- (void) printf(gettext(
- " Configuration Current Current\n"
- " Option Configuration System State\n"
- "---------------------------------------------------------------"
- "\n"));
- for (i = 0; ra_opts[i].opt_name != NULL; i++) {
- if (ra_opts[i].opt_conf == OPT_DEFAULT) {
- (void) snprintf(confstr, sizeof (confstr),
- "%s (%s)",
- OPT2INTLSTR(ra_opts[i].opt_conf),
- OPT2INTLSTR(ra_opts[i].opt_rev));
- } else {
- (void) snprintf(confstr, sizeof (confstr),
- "%s", OPT2INTLSTR(ra_opts[i].opt_conf));
- }
- curval = (ra_opts[i].opt_getcur)();
- (void) printf(gettext("%1$27s %2$-21s%3$s\n"),
- ra_intloptname(ra_opts[i].opt_name), confstr,
- OPT2INTLSTR(curval));
- }
- (void) printf("\n");
- for (i = 0; ra_vars[i].var_name != NULL; i++) {
- (void) snprintf(confstr, sizeof (confstr), "\"%s\"",
- ra_vars[i].var_conf);
- (void) printf(gettext("%1$27s %2$s\n"),
- ra_intloptname(ra_vars[i].var_name), confstr);
- }
-}
-
-/*
- * Parse the configuration file and fill the ra_opts array with opt_conf
- * and opt_rev values, and the ra_vars array with opt_conf values.
- */
-static int
-ra_parseconf(void)
-{
- FILE *fp;
- uint_t lineno;
- char line[RA_MAX_CONF_LINE];
- char *cp, *confstr;
- raopt_t *raopt;
- ravar_t *ravar;
-
- if ((fp = fopen(RA_CONF_FILE, "r")) == NULL) {
- /*
- * There's no config file, so we need to create one. The
- * system doesn't ship with one, so this is not an error
- * condition.
- *
- * If we're being called from the net-loopback boot script
- * (forwarding_only is set), then there isn't anything for
- * us to do in the absense of a configuration file. In
- * this case, we would only set user-configured forwarding
- * settings. If the routing.conf file doesn't exist, then
- * we just exit since the user obviously hasn't configured
- * anything.
- */
- if (forwarding_only)
- exit(EXIT_SUCCESS);
-
- return (ra_writeconf());
- }
-
- for (lineno = 1; fgets(line, sizeof (line), fp) != NULL; lineno++) {
- if (line[strlen(line) - 1] == '\n')
- line[strlen(line) - 1] = '\0';
-
- cp = line;
-
- /* Skip leading whitespace */
- while (isspace(*cp))
- cp++;
-
- /* Skip comment lines and empty lines */
- if (*cp == '#' || *cp == '\0')
- continue;
-
- /*
- * Anything else must be of the form:
- * <option> <value> <default_value>
- */
- if ((confstr = strtok(cp, " ")) == NULL) {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: invalid entry on line %3$d\n"),
- myname, RA_CONF_FILE, lineno);
- continue;
- }
-
- if ((raopt = ra_str2opt(confstr)) != NULL) {
- if (ra_parseopt(confstr, lineno, raopt) != 0) {
- (void) fclose(fp);
- return (-1);
- }
- } else if ((ravar = ra_str2var(confstr)) != NULL) {
- if (ra_parsevar(confstr, lineno, ravar) != 0) {
- (void) fclose(fp);
- return (-1);
- }
- } else {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: invalid option name on "
- "line %3$d\n"),
- myname, RA_CONF_FILE, lineno);
- continue;
- }
- }
-
- (void) fclose(fp);
-
- /*
- * We call ra_writeconf() here in case there were missing entries
- * in the file. If all entries have been read, ra_writeconf() will
- * return without having written anything.
- */
- return (ra_writeconf());
-}
-
-static int
-ra_parseopt(char *confstr, int lineno, raopt_t *raopt)
-{
- oval_t oval;
-
- if (raopt->opt_conf != OPT_INVALID) {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: WARNING, option defined on "
- "multiple lines, ignoring line %3$d\n"),
- myname, RA_CONF_FILE, lineno);
- return (0);
- }
-
- if ((confstr = strtok(NULL, " ")) == NULL) {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: missing value on line %3$d\n"),
- myname, RA_CONF_FILE, lineno);
- return (0);
- }
- if ((oval = ra_str2oval(confstr)) == OPT_INVALID) {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: invalid option "
- "value on line %3$d\n"),
- myname, RA_CONF_FILE, lineno);
- return (0);
- }
- raopt->opt_conf = oval;
-
- if ((confstr = strtok(NULL, " ")) == NULL) {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: missing revert "
- "value on line %3$d\n"),
- myname, RA_CONF_FILE, lineno);
- return (0);
- }
- if ((oval = ra_str2oval(confstr)) == OPT_INVALID) {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: invalid revert "
- "value on line %3$d\n"),
- myname, RA_CONF_FILE, lineno, confstr);
- return (0);
- }
- raopt->opt_rev = oval;
- return (0);
-}
-
-static int
-ra_parsevar(char *confstr, int lineno, ravar_t *ravar)
-{
- if (ravar->var_conf != NULL) {
- (void) fprintf(stderr,
- gettext("%1$s: %2$s: WARNING, variable defined on "
- "multiple lines, ignoring line %3$d\n"),
- myname, RA_CONF_FILE, lineno);
- return (0);
- }
-
- confstr = strtok(NULL, "=");
- if (confstr == NULL) {
- /*
- * This isn't an error condition, it simply means that the
- * variable has no value.
- */
- ravar->var_conf = "";
- return (0);
- }
-
- if ((ravar->var_conf = strdup(confstr)) == NULL) {
- (void) fprintf(stderr, gettext("%s: "
- "unable to allocate memory\n"), myname);
- return (-1);
- }
- return (0);
-}
-
-/*
- * Write options to the configuration file. The options are gathered from
- * the ra_opts[] and ra_vars[] arrays.
- *
- * The format of the file is:
- * - comment lines start with '#'
- * - other lines are written in the form "<opt_name> <opt_new> <opt_newrev>"
- */
-static int
-ra_writeconf(void)
-{
- int fd, i;
- FILE *fp;
- mode_t mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); /* 0644 */
- boolean_t changed = B_FALSE;
-
- /*
- * At this point, the *_conf members are the current configuration
- * in the /etc/inet/routing.conf file. The *_new members are those
- * that were passed in on the command line to override the current
- * configuration.
- */
-
- /* Make sure we don't needlessly overwrite the file. */
- for (i = 0; ra_opts[i].opt_name != NULL; i++) {
- if (ra_opts[i].opt_conf == OPT_INVALID) {
- /* there was no configuration for this option */
- ra_opts[i].opt_conf = ra_opts[i].opt_def;
- changed = B_TRUE;
- }
- if (ra_opts[i].opt_new != OPT_INVALID &&
- ra_opts[i].opt_conf != ra_opts[i].opt_new) {
- /* the new configuration overrides the existing one */
- ra_opts[i].opt_conf = ra_opts[i].opt_new;
- changed = B_TRUE;
- }
- if (ra_opts[i].opt_newrev != OPT_INVALID &&
- ra_opts[i].opt_rev != ra_opts[i].opt_newrev) {
- /* a new revert value was passed in */
- ra_opts[i].opt_rev = ra_opts[i].opt_newrev;
- changed = B_TRUE;
- }
- }
-
- for (i = 0; ra_vars[i].var_name != NULL; i++) {
- if (ra_vars[i].var_conf == NULL) {
- /* the variable wasn't in the configuration file */
- ra_vars[i].var_conf = ra_vars[i].var_def;
- changed = B_TRUE;
- }
- if (ra_vars[i].var_new != NULL &&
- strcmp(ra_vars[i].var_conf, ra_vars[i].var_new) != 0) {
- /* a new variable value was passed in */
- ra_vars[i].var_conf = ra_vars[i].var_new;
- changed = B_TRUE;
- }
- }
-
- if (!changed)
- return (0);
-
- if ((fd = open(RA_CONF_FILE, O_WRONLY|O_CREAT|O_TRUNC, mode)) == -1) {
- (void) fprintf(stderr,
- gettext("%1$s: failed to open %2$s: %3$s\n"),
- myname, RA_CONF_FILE, strerror(errno));
- return (-1);
- }
- if ((fp = fdopen(fd, "w")) == NULL) {
- (void) fprintf(stderr,
- gettext("%1$s: failed to open stream for %2$s: %3$s\n"),
- myname, RA_CONF_FILE, strerror(errno));
- return (-1);
- }
-
- (void) fputs(
- "#\n"
- "# routing.conf\n"
- "#\n"
- "# Parameters for IP forwarding and routing.\n"
- "# Do not edit this file by hand -- use routeadm(1m) instead.\n"
- "#\n",
- fp);
-
- /*
- * Option entries are of the form:
- * <name> <val> <revert-val>
- */
- for (i = 0; ra_opts[i].opt_name != NULL; i++) {
- (void) fprintf(fp, "%s %s %s\n",
- ra_opts[i].opt_name,
- OPT2STR(ra_opts[i].opt_conf),
- OPT2STR(ra_opts[i].opt_rev));
- }
- /*
- * Variable entries are of the form:
- * <name> =<value>
- */
- for (i = 0; ra_vars[i].var_name != NULL; i++) {
- (void) fprintf(fp, "%s =%s\n",
- ra_vars[i].var_name,
- ra_vars[i].var_conf);
- }
-
- (void) fclose(fp);
-
- return (0);
-}
-
-
-
-/*
- * return the ra_opts array element whose opt_name matches the string
- * passed in as an argument.
- */
-static raopt_t *
-ra_str2opt(const char *optnamestr)
-{
- int i;
-
- for (i = 0; ra_opts[i].opt_name != NULL; i++) {
- if (strcmp(optnamestr, ra_opts[i].opt_name) == 0)
- break;
- }
- if (ra_opts[i].opt_name == NULL)
- return (NULL);
- else
- return (&ra_opts[i]);
-}
-
-/* Convert a string to an option value. */
-static oval_t
-ra_str2oval(const char *valstr)
-{
- if (strcmp(valstr, "enabled") == 0)
- return (OPT_ENABLED);
- else if (strcmp(valstr, "disabled") == 0)
- return (OPT_DISABLED);
- else if (strcmp(valstr, "default") == 0)
- return (OPT_DEFAULT);
- return (OPT_INVALID);
-}
-
-static ravar_t *
-ra_str2var(const char *varnamestr)
-{
- int i;
-
- for (i = 0; ra_vars[i].var_name != NULL; i++) {
- if (strcmp(varnamestr, ra_vars[i].var_name) == 0)
- break;
- }
- if (ra_vars[i].var_name == NULL)
- return (NULL);
- else
- return (&ra_vars[i]);
-}
-
-/*
- * Given an option name, this function provides an internationalized, human
- * readable version of the option name.
- */
-static char *
-ra_intloptname(const char *optname)
-{
- if (strcmp(optname, "ipv4-forwarding") == 0)
- return (gettext("IPv4 forwarding"));
- else if (strcmp(optname, "ipv4-routing") == 0)
- return (gettext("IPv4 routing"));
- else if (strcmp(optname, "ipv6-forwarding") == 0)
- return (gettext("IPv6 forwarding"));
- else if (strcmp(optname, "ipv6-routing") == 0)
- return (gettext("IPv6 routing"));
- else if (strcmp(optname, "ipv4-routing-daemon") == 0)
- return (gettext("IPv4 routing daemon"));
- else if (strcmp(optname, "ipv4-routing-daemon-args") == 0)
- return (gettext("IPv4 routing daemon args"));
- else if (strcmp(optname, "ipv4-routing-stop-cmd") == 0)
- return (gettext("IPv4 routing daemon stop"));
- else if (strcmp(optname, "ipv6-routing-daemon") == 0)
- return (gettext("IPv6 routing daemon"));
- else if (strcmp(optname, "ipv6-routing-daemon-args") == 0)
- return (gettext("IPv6 routing daemon args"));
- else if (strcmp(optname, "ipv6-routing-stop-cmd") == 0)
- return (gettext("IPv6 routing daemon stop"));
- /*
- * If we get here, there's a bug and someone should trip over this
- * NULL pointer.
- */
- return (NULL);
-}
-
-static int
-open_ipsock(void)
-{
- if (ipsock == -1 && (ipsock = socket(PF_INET6, SOCK_DGRAM, 0)) == -1) {
- (void) fprintf(stderr,
- gettext("%1$s: unable to open %2$s: %3$s\n"),
- myname, IP_DEV_NAME, strerror(errno));
- }
- return (ipsock);
-}
-
-static int
-ra_ndioctl(int cmd, char *data, int ilen)
-{
- struct strioctl stri;
-
- if (open_ipsock() == -1)
- return (-1);
-
- stri.ic_cmd = cmd;
- stri.ic_timout = 0;
- stri.ic_len = ilen;
- stri.ic_dp = data;
- if (ioctl(ipsock, I_STR, &stri) == -1)
- return (-1);
- return (0);
-}
-
-/*
- * Returns the process id of the specified command if it's running, -1 if
- * it's not.
- */
-static pid_t
-ra_isrunning(ra_daemon_t *daemon)
-{
- FILE *pidfp;
- pid_t pid = -1;
- char procpath[MAXPATHLEN];
- int procfd;
- psinfo_t ps;
-
- if (daemon->rad_pidfile == NULL)
- return (-1);
-
- if ((pidfp = fopen(daemon->rad_pidfile, "r")) == NULL)
- return (-1);
- if (fscanf(pidfp, "%ld", &pid) != 1)
- return (-1);
- (void) fclose(pidfp);
-
- /* Make sure the process we're interested in is still running. */
- (void) snprintf(procpath, sizeof (procpath), "/proc/%ld/psinfo", pid);
- if ((procfd = open(procpath, O_RDONLY)) == -1)
- return (-1);
- if (read(procfd, &ps, sizeof (ps)) != sizeof (ps)) {
- (void) close(procfd);
- return (-1);
- }
- (void) close(procfd);
- if (strncmp(daemon->rad_argv[0], ps.pr_psargs,
- strlen(daemon->rad_argv[0])) != 0) {
- return (-1);
- }
-
- return (pid);
-}
-
-/*
- * Fork and exec a daemon, and wait until it has daemonized to return. We
- * first attempt to kill it if it's already running, as the command-line
- * arguments may have changed.
- */
-static void
-ra_rundaemon(ra_daemon_t *daemon)
-{
- pid_t daemon_pid;
-
- ra_killdaemon(daemon);
-
- if ((daemon_pid = fork()) == -1) {
- (void) fprintf(stderr,
- gettext("%1$s: unable to fork %2$s: %3$s\n"),
- myname, daemon->rad_argv[0], strerror(errno));
- } else if (daemon_pid == 0) {
- /* We're the child, execute the daemon. */
- if (execv(daemon->rad_argv[0], daemon->rad_argv) == -1) {
- (void) fprintf(stderr,
- gettext("%1$s: unable to execute %2$s: %3$s\n"),
- myname, daemon->rad_argv[0], strerror(errno));
- _exit(EXIT_FAILURE);
- }
- } else {
- /* Wait for the child to daemonize or terminate. */
- (void) wait(NULL);
- }
-}
-
-/*
- * If the daemon has a pidfile, use the pid to kill the targeted process.
- * Otherwise, use the daemon's configured stop command.
- */
-static void
-ra_killdaemon(ra_daemon_t *daemon)
-{
- pid_t pid;
-
- /*
- * rad_pidfile is cleared out if the user sets a non-default
- * routing daemon
- */
- if (daemon->rad_pidfile != NULL) {
- if ((pid = ra_isrunning(daemon)) == -1)
- return;
- if (kill(pid, SIGTERM) == -1) {
- (void) fprintf(stderr, gettext(
- "%1$s: unable to kill %2$s: %3$s\n"), myname,
- daemon->rad_argv[0], strerror(errno));
- }
- } else {
- if (system(daemon->rad_stop_cmd) == -1)
- if (!booting) {
- (void) fprintf(stderr, gettext("%1$s: "
- "%2$s failed: %3$s\n"),
- myname, daemon->rad_stop_cmd,
- strerror(errno));
- }
- }
-}
-
-/*
- * Return the number of IPv6 addresses configured. This answers the
- * generic question, "is IPv6 configured?". We only start in.ndpd if IPv6
- * is configured, and we also only enable IPv6 routing if IPv6 is enabled.
- */
-static int
-ra_numv6intfs(void)
-{
- static int num = -1;
- struct lifnum lifn;
-
- if (num != -1)
- return (num);
-
- if (open_ipsock() == -1)
- return (0);
-
- lifn.lifn_family = AF_INET6;
- lifn.lifn_flags = 0;
-
- if (ioctl(ipsock, SIOCGLIFNUM, &lifn) == -1)
- return (0);
-
- return (num = lifn.lifn_count);
-}
-
-/* Run in.ndpd */
-static void
-start_ndpd(void)
-{
- ra_rundaemon(&in_ndpd);
-}
-
-/* Is ip_forwarding turned on? */
-static oval_t
-v4forw_cur(void)
-{
- char ndbuf[] = ND_IP_FORWARDING;
-
- if (ra_ndioctl(ND_GET, ndbuf, sizeof (ndbuf)) == -1)
- return (OPT_DISABLED);
- return (atoi(ndbuf) == 0 ? OPT_DISABLED : OPT_ENABLED);
-}
-
-/* Is in.routed running? */
-static oval_t
-v4rout_cur(void)
-{
- /*
- * routeadm cannot really know the status of a user-configured
- * routing daemon. We clear the rad_pidfile field of the daemon
- * structure when the user configures the daemon.
- */
- if (v4d.rad_pidfile == NULL)
- return (OPT_UNKNOWN);
- return (ra_isrunning(&v4d) == -1 ? OPT_DISABLED : OPT_ENABLED);
-}
-
-/* Is ip6_forwarding turned on? */
-static oval_t
-v6forw_cur(void)
-{
- char ndbuf[] = ND_IP6_FORWARDING;
-
- if (ra_ndioctl(ND_GET, ndbuf, sizeof (ndbuf)) == -1)
- return (OPT_DISABLED);
- return (atoi(ndbuf) == 0 ? OPT_DISABLED : OPT_ENABLED);
-}
-
-/* Is in.ripngd running? */
-static oval_t
-v6rout_cur(void)
-{
- /*
- * routeadm cannot really know the status of a user-configured
- * routing daemon. We clear the rad_pidfile field of the daemon
- * structure when the user configures the daemon.
- */
- if (v6d.rad_pidfile == NULL)
- return (OPT_UNKNOWN);
- return (ra_isrunning(&v6d) == -1 ? OPT_DISABLED : OPT_ENABLED);
-}
-
-static void
-enable_v4forw(void)
-{
- (void) ra_ndioctl(ND_SET, nd_ip_forw_on, sizeof (nd_ip_forw_on));
-}
-
-static void
-disable_v4forw(void)
-{
- (void) ra_ndioctl(ND_SET, nd_ip_forw_off, sizeof (nd_ip_forw_off));
-}
-
-static void
-enable_v4rout(void)
-{
- if (v4d.rad_argv[0][0] == '\0') {
- (void) fprintf(stderr, gettext("%1$s: %2$s is not set.\n"
- " Use -s to set the ipv4-routing-daemon variable, \n"
- " or use -d to disable ipv4-routing.\n"), myname,
- ra_intloptname("ipv4-routing-daemon"));
- } else {
- ra_rundaemon(&v4d);
- }
-}
-
-static void
-disable_v4rout(void)
-{
- ra_killdaemon(&v4d);
-}
-
-/* Turn on ip6_forwarding, ip6_ignore_redirect, and ip6_send_redirects. */
-static void
-enable_v6forw(void)
-{
- (void) ra_ndioctl(ND_SET, nd_ip6_sendredir_on,
- sizeof (nd_ip6_sendredir_on));
- (void) ra_ndioctl(ND_SET, nd_ip6_forw_on, sizeof (nd_ip6_forw_on));
-}
-
-/*
- * in.ripngd is tied to IPv6 forwarding due to a limitation in its
- * implementation. It will propagate routes blindly without checking if
- * forwarding is enabled on the interfaces it's using. Until that's fixed,
- * make sure in.ripngd doesn't run if IPv6 forwarding isn't enabled.
- */
-static void
-disable_v6forw(void)
-{
- pid_t pid;
-
- if ((pid = ra_isrunning(&v6d)) != -1 &&
- kill(pid, SIGTERM) == -1) {
- (void) fprintf(stderr,
- gettext("%1$s: unable to kill %2$s: %3$s\n"),
- myname, v6d.rad_argv[0], strerror(errno));
- }
-
- (void) ra_ndioctl(ND_SET, nd_ip6_sendredir_off,
- sizeof (nd_ip6_sendredir_off));
- (void) ra_ndioctl(ND_SET, nd_ip6_forw_off, sizeof (nd_ip6_forw_off));
-}
-
-/*
- * We only enable IPv6 routing if there is at least one IPv6 interface
- * configured.
- *
- * If in.ndpd isn't already running, then we start it here because
- * in.ripngd depends on having routes based on the prefixes configured by
- * in.ndpd. We only start in.ripngd if IPv6 forwarding is enabled. This
- * is due to a giant gap in in.ripngd's design which causes in.ripngd to
- * propagate routes on all interfaces regardless of their forwarding
- * status. If that's fixed, then we can start in.ripngd regardless of the
- * global IPv6 forwarding status.
- */
-static void
-enable_v6rout(void)
-{
- if (ra_numv6intfs() == 0)
- return;
- start_ndpd();
- if (v6forw_cur() != OPT_ENABLED)
- return;
- (void) ra_ndioctl(ND_SET, nd_ip6_ignredir_on,
- sizeof (nd_ip6_ignredir_on));
- if (v6d.rad_argv[0][0] == '\0') {
- (void) fprintf(stderr, gettext("%1$s: %2$s is not set.\n"
- " Use -s to set the ipv6-routing-daemon variable, \n"
- " or use -d to disable ipv6-routing.\n"), myname,
- ra_intloptname("ipv6-routing-daemon"));
- } else {
- ra_rundaemon(&v6d);
- }
-}
-
-static void
-disable_v6rout(void)
-{
- /*
- * We always start in.ndpd if there is an IPv6 interface
- * configured, regardless of the status of IPv6 routing.
- */
- if (ra_numv6intfs() > 0)
- start_ndpd();
-
- (void) ra_ndioctl(ND_SET, nd_ip6_ignredir_off,
- sizeof (nd_ip6_ignredir_off));
- ra_killdaemon(&v6d);
-}
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/Makefile
new file mode 100644
index 0000000000..edc1d0622e
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/Makefile
@@ -0,0 +1,87 @@
+#
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+
+
+SVCMETHOD= svc-legacy-routing svc-forwarding
+MANIFEST= legacy-routing.xml forwarding.xml
+
+PROG= routeadm
+ROOTFS_PROG= $(PROG)
+
+include ../../../Makefile.cmd
+
+#
+# We cannot use the usual manifest rules here since we deliver
+# manifests to two different locations, /var/svc/manifest/network/forwarding.xml
+# and /var/svc/manifest/network/routing/legacy-routing.xml
+#
+
+ROOTSVCMANIFESTDIR= $(ROOTSVCNETWORK) $(ROOTSVCNETWORKROUTING)
+ROOTSVCMANIFEST= $(ROOTSVCNETWORKROUTING)/legacy-routing.xml \
+ $(ROOTSVCNETWORK)/forwarding.xml
+
+$(ROOTSVCMANIFEST) := OWNER= root
+$(ROOTSVCMANIFEST) := GROUP= sys
+$(ROOTSVCMANIFEST) := FILEMODE= 444
+
+ROOTUSRSBINLINKS= $(PROG:%=$(ROOTUSRSBIN)/%)
+
+CPPFLAGS += -I../../../../common/svc
+$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
+
+LDLIBS += -lscf -luutil
+
+ROOTSBINPROG= $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+install: all $(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(ROOTSVCMANIFEST) \
+ $(ROOTSVCMETHOD)
+
+$(ROOTUSRSBINLINKS):
+ -$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
+
+check: $(CHKMANIFEST)
+
+clean:
+
+lint: lint_PROG
+
+$(ROOTSVCMANIFEST): $(ROOTSVCMANIFESTDIR)
+
+$(ROOTSVCMANIFESTDIR):
+ $(INS.dir)
+
+$(ROOTSVCNETWORK)/%: %
+ $(INS.file)
+
+$(ROOTSVCNETWORKROUTING)/%: %
+ $(INS.file)
+
+include ../../../Makefile.targ
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/forwarding.xml b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/forwarding.xml
new file mode 100644
index 0000000000..b0e777ce50
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/forwarding.xml
@@ -0,0 +1,245 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2006 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 (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+
+-->
+
+<service_bundle type='manifest' name='SUNWcsr:forwarding'>
+
+<service
+ name='network/ipv4-forwarding'
+ type='service'
+ version='1'>
+
+ <create_default_instance enabled='false' />
+
+ <single_instance />
+
+ <dependency
+ name='network'
+ grouping='require_all'
+ restart_on='error'
+ type='service'>
+ <service_fmri value='svc:/network/loopback' />
+ </dependency>
+
+ <dependency
+ name='filesystem'
+ grouping='require_all'
+ restart_on='error'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local'/>
+ </dependency>
+
+ <dependency
+ name='devices'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/devices' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-forwarding %m ipv4'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec='/lib/svc/method/svc-forwarding %m ipv4'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='refresh'
+ exec='/lib/svc/method/svc-forwarding %m ipv4'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <property_group name='startd' type='framework'>
+ <propval name='duration' type='astring'
+ value='transient' />
+ </property_group>
+
+ <property_group name='general' type='framework'>
+ <!-- to start stop forwarding services -->
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ </property_group>
+
+ <!-- Properties in this group are modifiable via routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <propval name='default-ipv4-forwarding' type='boolean'
+ value='false' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ IPv4 forwarding service
+ </loctext>
+ </common_name>
+ <description>
+ <loctext xml:lang='C'>
+ IPv4 forwarding service, controlled by routeadm.
+ </loctext>
+ </description>
+ <documentation>
+ <manpage title='routeadm' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+</service>
+
+<service
+ name='network/ipv6-forwarding'
+ type='service'
+ version='1'>
+
+ <create_default_instance enabled='false' />
+
+ <single_instance />
+
+ <dependency
+ name='network'
+ grouping='require_all'
+ restart_on='error'
+ type='service'>
+ <service_fmri value='svc:/network/loopback' />
+ </dependency>
+
+ <dependency
+ name='filesystem'
+ grouping='require_all'
+ restart_on='error'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local'/>
+ </dependency>
+
+ <dependency
+ name='devices'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/devices' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-forwarding %m ipv6'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec='/lib/svc/method/svc-forwarding %m ipv6'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='refresh'
+ exec='/lib/svc/method/svc-forwarding %m ipv6'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <property_group name='startd' type='framework'>
+ <propval name='duration' type='astring'
+ value='transient' />
+ </property_group>
+
+ <property_group name='general' type='framework'>
+ <!-- to start stop forwarding services -->
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ </property_group>
+
+ <!-- Properties in this group are modifiable via routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <propval name='default-ipv6-forwarding' type='boolean'
+ value='false' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ IPv6 forwarding service
+ </loctext>
+ </common_name>
+ <description>
+ <loctext xml:lang='C'>
+ IPv6 forwarding service, controlled by routeadm.
+ </loctext>
+ </description>
+ <documentation>
+ <manpage title='routeadm' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/legacy-routing.xml b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/legacy-routing.xml
new file mode 100644
index 0000000000..5db846b48a
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/legacy-routing.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2006 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 (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+
+-->
+
+<service_bundle type='manifest' name='SUNWcsr:legacy_routing'>
+
+<service
+ name='network/routing/legacy-routing'
+ type='service'
+ version='1'>
+
+ <!-- loopback/physical network configuration is required -->
+ <dependency
+ name='network'
+ grouping='require_all'
+ restart_on='error'
+ type='service'>
+ <service_fmri value='svc:/network/initial' />
+ </dependency>
+
+ <!-- local fs is needed for routing.conf updates -->
+ <dependency
+ name='filesystem'
+ grouping='require_all'
+ restart_on='error'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local'/>
+ </dependency>
+
+ <!-- some daemons need /dev/ip -->
+ <dependency
+ name='devices'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/devices' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/svc-legacy-routing %m %i'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root'/>
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec='/lib/svc/method/svc-legacy-routing %m %i'
+ timeout_seconds='60' >
+ <method_context>
+ <method_credential user='root' group='root'/>
+ </method_context>
+ </exec_method>
+
+ <property_group name='general' type='framework'>
+ <!-- to start stop routing services -->
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.routing' />
+ </property_group>
+
+ <instance name='ipv4' enabled='false'>
+
+ <!-- Properties in this group are used by routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <stability value='Evolving' />
+ <propval name='protocol' type='astring' value='ipv4' />
+ <propval name='daemon' type='astring' value='' />
+ <propval name='default-daemon' type='astring'
+ value='' />
+ <propval name='daemon-args' type='astring' value='' />
+ <propval name='default-daemon-args' type='astring'
+ value='' />
+ <propval name='daemon-stop-cmd' type='astring'
+ value='' />
+ <propval name='default-daemon-stop-cmd' type='astring'
+ value='' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ </instance>
+
+ <instance name='ipv6' enabled='false'>
+
+ <!-- Properties in this group are used by routeadm (1M) -->
+ <property_group name='routeadm' type='application'>
+ <stability value='Evolving' />
+ <propval name='protocol' type='astring' value='ipv6' />
+ <propval name='daemon' type='astring' value='' />
+ <propval name='default-daemon' type='astring'
+ value='' />
+ <propval name='daemon-args' type='astring' value='' />
+ <propval name='default-daemon-args' type='astring'
+ value='' />
+ <propval name='daemon-stop-cmd' type='astring'
+ value='' />
+ <propval name='default-daemon-stop-cmd' type='astring'
+ value='' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ </instance>
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ Legacy routing service
+ </loctext>
+ </common_name>
+ <description>
+ <loctext xml:lang='C'>
+ Legacy routing services, controlled by routeadm.
+ </loctext>
+ </description>
+ <documentation>
+ <manpage title='routeadm' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c
new file mode 100644
index 0000000000..90d5f88dfa
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/routeadm.c
@@ -0,0 +1,2502 @@
+/*
+ * 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 2006 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 <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <ctype.h>
+#include <stropts.h>
+#include <errno.h>
+#include <libintl.h>
+#include <locale.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <libscf.h>
+#include <libscf_priv.h>
+#include <libuutil.h>
+
+/*
+ * This program moves routing management under SMF. We do this by giving
+ * routeadm options that allow interaction with SMF services. These include:
+ * - setting the routing services routeadm will enable
+ * # routeadm -s routing-svcs="fmri [fmri...]"
+ * where each fmri is an SMF routing service.
+ * - changing properties of routing services
+ * # routeadm -m fmri key=value [key=value...]
+ * - listing routing daemon properties
+ * # routeadm -l fmri
+ * where all properties in the "routing" property group are listed.
+ *
+ * By providing legacy routing services (legacy-routing:ipv4 and ipv6), we
+ * can also support running of routing daemons with no SMF service under SMF.
+ * Specifying a routing daemon with no SMF counterpart results in the
+ * daemon, it`s arguments and stop command being set in the appropriate instance
+ * to be picked up by start/stop methods.
+ *
+ * Internally, routeadm keeps track of routing services by setting the
+ * "current-routing-svc" property to "true" in the services it manages.
+ * So for example, running
+ * # routeadm -s routing-svcs="route:default ripng:default"
+ * sets this variable in each instance specified. If the user specifies a
+ * non-SMF routing daemon via
+ * # routeadm -s ipv4-routing-daemon=/usr/sbin/mydaemon
+ * the variable will be set for the legacy-routing:ipv4 instance.
+ *
+ * In order to ensure that the SMF versions of routing daemons are used
+ * where possible, routeadm will check the daemons specified in
+ * ipv4-routing-daemon/ipv6-routing-daemon to determine if there is an
+ * SMF counterpart. If so, rather than running the legacy service
+ * we move configuration, specifically the associated daemon arguments
+ * to the SMF counterpart. From there, when the daemon is enabled, it
+ * will pick up the daemon arguments setting, transfer the argument string
+ * to the appropriate properties and run the service.
+ *
+ * To support the semantics of routeadm -e (enable at next boot) through SMF,
+ * we make use of temporary state changes, which last only until reboot.
+ * For example, if a service is disabled, and it is to be enabled via
+ * routeadm -e, we simply change the disable to a temporary disable,
+ * and set the persistent enabled value to true. This ensures the daemon
+ * will run at next boot, but not now. The reverse is true for disabling
+ * enabled instances (and if the daemon is enabled when we issue the enable,
+ * we do nothing since it is already in the desired state).
+ *
+ * Since the code is quite involved, we provide a guide to the more complex
+ * actions taken in response to user commands.
+ *
+ * routeadm -e[d] ipv4[6]-routing[forwarding]
+ *
+ * In this case, the goal is to prepare the configured routing daemons
+ * (specified through routeadm -s routing-svcs="...") or forwarding
+ * services to switch on (-e) or of (-d) at next boot.
+ *
+ * Since this operation must be applied to multiple services in the
+ * routing daemon case (as opposed to the single ipv4[6]-forwarding
+ * service), we make use of the scf_walk_fmri() function, which
+ * applies a callback function to all matching functions. In the case
+ * of the routing daemons, we pass in a NULL signifying that all
+ * instances should be walked (we then weed out the relevant routing
+ * services through presence of the routeadm/protocol property). In
+ * the case of enable, a routing service is enabled IFF it has the
+ * previously-mentioned property - with an appropriate value (i.e. ipv4
+ * for "routeadm -e ipv4-routing") - and it has routeadm/curr-routing-svc
+ * property set to true (this is set by other operations such as
+ * routeadm -s routing-svcs="..."). Then, smf_enable_instance() or
+ * smf_disable_instance() is called, setting the temporary state to
+ * the current state of the service. This then allows setting of
+ * general/enabled value to next-boot value. In the case of disabling
+ * ipv4[6]-routing, all valid ipv4[6] routing daemons are prepared
+ * for next-boot disable, not just those specified via routing-svcs (this
+ * means that if the user enables routing daemons with "svcadm enable",
+ * disabling global routing does really switch off all routing daemons).
+ *
+ * This is implemented through the ra_get_set_opt_common_cb() function,
+ * called by the ra_set_persistent_opt_cb() function. The same
+ * function can be used for both routing and forwarding options, in the
+ * latter case we simply provide the specific FMRI of the forwarding
+ * service in question (ipv4-forwarding or ipv6-forwarding), and dispense
+ * with the eligibility tests we need to weed out the routing services
+ * from the rest.
+ *
+ * Before we initiate the "enable" however, we must check routing daemons
+ * specified via the legacy variables (ipv4-routing-daemon etc).
+ * If they map to SMF routing services, we wish to transfer their
+ * configuration to the corresponding services and use them instead of
+ * the legacy services. To do this, we need to match the daemon program
+ * against the routeadm/daemon property of each routing daemon (we use
+ * scf_walk_fmri() and the routeadm/protocol property again to identify
+ * daemons). If a match is found, the daemon arguments are transferred
+ * to the appropriate service`s daemon-args property, to be picked up
+ * by it`s start method and converted into appropriate property values.
+ * This is accomplished by ra_check_legacy_daemons(), and the callback
+ * operation is carried out by ra_upgrade_legacy_daemons_cb(). If the
+ * daemon was not upgraded, we need to mark the legacy-routing:ipv4[6]
+ * instance to be enabled (by routeadm -e), since it now must run the
+ * un-upgradeable legacy daemon.
+ *
+ * routeadm -l fmri
+ *
+ * Lists all properties and values in the routing property group associated
+ * with instance fmri. We simply walk through the composed property
+ * group, displaying all values. See ra_list_props_cb().
+ *
+ * routeadm -m fmri key=value ...
+ *
+ * Modify property values in the routing property group. If the same
+ * key is used more than once, multiple property values are set for that
+ * property. Properties must exist in the composed property group, but
+ * will only ever be set at the instance level to prevent multiple
+ * instances inheriting the property in error. See ra_modify_props_cb().
+ *
+ * routeadm -s var=value
+ *
+ * In all cases bar the routing-svcs variable, this simply involves
+ * setting the appropriate SMF property value for the variable. The
+ * routing-svcs case is more complex, since we would like operations
+ * like the following to have intuitive effects:
+ * # routeadm -s routing-svcs=route -e ipv4-routing -u
+ * # routeadm -s routing-svcs=rdisc -u
+ * i.e., in the end, rdisc is the only routing service running. To
+ * accomplish this switchover, we need to disable the old routing-svcs
+ * and enable the new, marking the latter with the curr-routing-svc
+ * property so that routeadm -e will pick them up. This is carried
+ * out by the ra_update_routing_svcs() function.
+ *
+ * routeadm -R alt_root ...
+ *
+ * Used to support use of routeadm in Custom Jumpstart scripts, this
+ * option causes all subsequent commands to be appended to the
+ * /var/svc/profile/upgrade file, which is run on the subsequent boot.
+ * This is done because the SMF repository is not available to make
+ * the modifications to property values required in routeadm operations.
+ *
+ * routeadm -u
+ *
+ * Update applies the "next boot" state to the current system. Here
+ * we simply take the persistent state (general/enabled value) and
+ * make it the current state through smf_enable_instance() or
+ * smf_disable_instance() as appropriate (these calls, without the
+ * temporary flag set, delete the general_ovr/enabled property).
+ */
+
+#define RA_OPT_IPV4_ROUTING "ipv4-routing"
+#define RA_OPT_IPV6_ROUTING "ipv6-routing"
+#define RA_OPT_IPV4_FORWARDING "ipv4-forwarding"
+#define RA_OPT_IPV6_FORWARDING "ipv6-forwarding"
+
+#define IS_ROUTING_OPT(opt) (strcmp(opt, RA_OPT_IPV4_ROUTING) == 0 || \
+ strcmp(opt, RA_OPT_IPV6_ROUTING) == 0)
+
+#define RA_VAR_IPV4_ROUTING_DAEMON "ipv4-routing-daemon"
+#define RA_VAR_IPV4_ROUTING_DAEMON_ARGS "ipv4-routing-daemon-args"
+#define RA_VAR_IPV4_ROUTING_STOP_CMD "ipv4-routing-stop-cmd"
+#define RA_VAR_IPV6_ROUTING_DAEMON "ipv6-routing-daemon"
+#define RA_VAR_IPV6_ROUTING_DAEMON_ARGS "ipv6-routing-daemon-args"
+#define RA_VAR_IPV6_ROUTING_STOP_CMD "ipv6-routing-stop-cmd"
+#define RA_VAR_ROUTING_SVCS "routing-svcs"
+
+
+#define RA_INSTANCE_ALL NULL
+#define RA_INSTANCE_ROUTING_SETUP "svc:/network/routing-setup:default"
+#define RA_INSTANCE_IPV4_FORWARDING "svc:/network/ipv4-forwarding:default"
+#define RA_INSTANCE_IPV6_FORWARDING "svc:/network/ipv6-forwarding:default"
+#define RA_INSTANCE_LEGACY_ROUTING_IPV4 \
+ "svc:/network/routing/legacy-routing:ipv4"
+#define RA_INSTANCE_LEGACY_ROUTING_IPV6 \
+ "svc:/network/routing/legacy-routing:ipv6"
+
+#define RA_PG_ROUTEADM "routeadm"
+#define RA_PROP_CURR_ROUTING_SVC "current-routing-svc"
+#define RA_PROP_ROUTING_SVCS "routing-svcs"
+#define RA_PROP_DEFAULT_ROUTING_SVCS "default-routing-svcs"
+#define RA_PROP_PROTO "protocol"
+#define RA_PROP_DAEMON "daemon"
+#define RA_PROP_DEFAULT_DAEMON "default-daemon"
+#define RA_PROP_DAEMON_ARGS "daemon-args"
+#define RA_PROP_DEFAULT_DAEMON_ARGS "default-daemon-args"
+#define RA_PROP_DAEMON_STOP_CMD "daemon-stop-cmd"
+#define RA_PROP_DEFAULT_STOP_CMD "default-daemon"
+#define RA_PROP_LEGACY_DAEMON "legacy-daemon"
+#define RA_PROP_DEFAULT_IPV4_ROUTING "default-ipv4-routing"
+#define RA_PROP_DEFAULT_IPV6_ROUTING "default-ipv6-routing"
+#define RA_PROP_DEFAULT_IPV4_FORWARDING "default-ipv4-forwarding"
+#define RA_PROP_DEFAULT_IPV6_FORWARDING "default-ipv6-forwarding"
+#define RA_PROP_IPV4_ROUTING_SET "ipv4-routing-set"
+#define RA_PROP_IPV6_ROUTING_SET "ipv6-routing-set"
+#define RA_PROP_ROUTING_CONF_READ "routing-conf-read"
+
+#define RA_PG_ROUTING "routing"
+
+#define RA_PROPVAL_BOOLEAN_TRUE "true"
+#define RA_PROPVAL_BOOLEAN_FALSE "false"
+#define RA_PROPVAL_PROTO_IPV4 "ipv4"
+#define RA_PROPVAL_PROTO_IPV6 "ipv6"
+
+#define RA_SVC_FLAG_NONE 0x0
+#define RA_SVC_FLAG_IPV4_ROUTING 0x1
+#define RA_SVC_FLAG_IPV6_ROUTING 0x2
+
+#define RA_SMF_UPGRADE_FILE "/var/svc/profile/upgrade"
+#define RA_SMF_UPGRADE_MSG " # added by routeadm(1M)"
+#define RA_CONF_FILE "/etc/inet/routing.conf"
+#define RA_CONF_FILE_OLD "/etc/inet/routing.conf.old"
+#define RA_MAX_CONF_LINE 256
+
+/*
+ * Option value. Each option requires an FMRI identifying which services
+ * to run the get_current/persistent scf_walk_fmri() function with, and
+ * associated flags (to ensure that in the case that multiple services
+ * match, we select the correct ones). In addition, we specify the FMRI
+ * and property used to set default option value. The opt_enabled field
+ * is used to hold retrieved state from get_*_opt_() callbacks and to specify
+ * desired state for set_*_opt() operations.
+ */
+
+typedef struct raopt {
+ const char *opt_name;
+ const char *opt_fmri;
+ int opt_flags;
+ boolean_t opt_enabled;
+ const char *opt_default_fmri;
+ const char *opt_default_prop;
+ boolean_t opt_default_enabled;
+} raopt_t;
+
+
+raopt_t ra_opts[] = {
+ { RA_OPT_IPV4_ROUTING, RA_INSTANCE_ALL, RA_SVC_FLAG_IPV4_ROUTING,
+ B_FALSE, RA_INSTANCE_ROUTING_SETUP, RA_PROP_DEFAULT_IPV4_ROUTING,
+ B_FALSE },
+ { RA_OPT_IPV6_ROUTING, RA_INSTANCE_ALL, RA_SVC_FLAG_IPV6_ROUTING,
+ B_FALSE, RA_INSTANCE_ROUTING_SETUP, RA_PROP_DEFAULT_IPV6_ROUTING,
+ B_FALSE },
+ { RA_OPT_IPV4_FORWARDING, RA_INSTANCE_IPV4_FORWARDING, RA_SVC_FLAG_NONE,
+ B_FALSE, RA_INSTANCE_IPV4_FORWARDING, RA_PROP_DEFAULT_IPV4_FORWARDING,
+ B_FALSE },
+ { RA_OPT_IPV6_FORWARDING, RA_INSTANCE_IPV6_FORWARDING, RA_SVC_FLAG_NONE,
+ B_FALSE, RA_INSTANCE_IPV6_FORWARDING, RA_PROP_DEFAULT_IPV6_FORWARDING,
+ B_FALSE },
+ { NULL, NULL, RA_SVC_FLAG_NONE, B_FALSE, NULL, NULL, B_FALSE }
+};
+
+typedef enum option_values {
+ OPT_INVALID, OPT_ENABLED, OPT_DISABLED, OPT_DEFAULT, OPT_UNKNOWN
+} oval_t;
+
+typedef struct ra_var {
+ const char *var_name;
+ const char *var_fmri;
+ const char *var_prop;
+ char *var_value;
+ const char *var_default_fmri;
+ const char *var_default_prop;
+ char *var_default_value;
+} ravar_t;
+
+ravar_t ra_vars[] = {
+ { RA_VAR_IPV4_ROUTING_DAEMON, RA_INSTANCE_LEGACY_ROUTING_IPV4,
+ RA_PROP_DAEMON, NULL, RA_INSTANCE_LEGACY_ROUTING_IPV4,
+ RA_PROP_DEFAULT_DAEMON, NULL},
+ { RA_VAR_IPV4_ROUTING_DAEMON_ARGS, RA_INSTANCE_LEGACY_ROUTING_IPV4,
+ RA_PROP_DAEMON_ARGS, NULL, RA_INSTANCE_LEGACY_ROUTING_IPV4,
+ RA_PROP_DEFAULT_DAEMON_ARGS, NULL },
+ { RA_VAR_IPV4_ROUTING_STOP_CMD, RA_INSTANCE_LEGACY_ROUTING_IPV4,
+ RA_PROP_DAEMON_STOP_CMD, NULL, RA_INSTANCE_LEGACY_ROUTING_IPV4,
+ RA_PROP_DEFAULT_STOP_CMD, NULL },
+ { RA_VAR_IPV6_ROUTING_DAEMON, RA_INSTANCE_LEGACY_ROUTING_IPV6,
+ RA_PROP_DAEMON, NULL, RA_INSTANCE_LEGACY_ROUTING_IPV6,
+ RA_PROP_DEFAULT_DAEMON, NULL },
+ { RA_VAR_IPV6_ROUTING_DAEMON_ARGS, RA_INSTANCE_LEGACY_ROUTING_IPV6,
+ RA_PROP_DAEMON_ARGS, NULL, RA_INSTANCE_LEGACY_ROUTING_IPV6,
+ RA_PROP_DEFAULT_DAEMON_ARGS, NULL },
+ { RA_VAR_IPV6_ROUTING_STOP_CMD, RA_INSTANCE_LEGACY_ROUTING_IPV6,
+ RA_PROP_DAEMON_STOP_CMD, NULL, RA_INSTANCE_LEGACY_ROUTING_IPV6,
+ RA_PROP_DEFAULT_STOP_CMD, NULL },
+ { RA_VAR_ROUTING_SVCS, RA_INSTANCE_ROUTING_SETUP,
+ RA_PROP_ROUTING_SVCS, NULL, RA_INSTANCE_ROUTING_SETUP,
+ RA_PROP_DEFAULT_ROUTING_SVCS, NULL },
+ { NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+};
+
+char *v_opt[] = {
+#define IPV4_ROUTING_DAEMON 0
+ RA_VAR_IPV4_ROUTING_DAEMON,
+#define IPV4_ROUTING_DAEMON_ARGS 1
+ RA_VAR_IPV4_ROUTING_DAEMON_ARGS,
+#define IPV4_ROUTING_STOP_CMD 2
+ RA_VAR_IPV4_ROUTING_STOP_CMD,
+#define IPV6_ROUTING_DAEMON 3
+ RA_VAR_IPV6_ROUTING_DAEMON,
+#define IPV6_ROUTING_DAEMON_ARGS 4
+ RA_VAR_IPV6_ROUTING_DAEMON_ARGS,
+#define IPV6_ROUTING_STOP_CMD 5
+ RA_VAR_IPV6_ROUTING_STOP_CMD,
+#define ROUTING_SVCS 6
+ RA_VAR_ROUTING_SVCS,
+ NULL
+};
+
+#define IS_IPV4_VAR(varname) (strncmp(varname, "ipv4", 4) == 0)
+#define IS_IPV6_VAR(varname) (strncmp(varname, "ipv6", 4) == 0)
+#define VAR_PROTO_MATCH(varname, proto) (strncmp(varname, proto, 4) == 0)
+#define IPV4_VARS_UNSET \
+ (strtok(ra_vars[IPV4_ROUTING_DAEMON].var_value, " \t") == NULL && \
+ strtok(ra_vars[IPV4_ROUTING_DAEMON_ARGS].var_value, " \t") == NULL && \
+ strtok(ra_vars[IPV4_ROUTING_STOP_CMD].var_value, " \t") == NULL)
+
+#define IPV6_VARS_UNSET \
+ (strtok(ra_vars[IPV6_ROUTING_DAEMON].var_value, " \t") == NULL && \
+ strtok(ra_vars[IPV6_ROUTING_DAEMON_ARGS].var_value, " \t") == NULL && \
+ strtok(ra_vars[IPV6_ROUTING_STOP_CMD].var_value, " \t") == NULL)
+
+/*
+ * Structure used in modify operations to tie property name and multiple values
+ * together.
+ */
+typedef struct ra_prop {
+ char *prop_name;
+ char **prop_values;
+ int prop_numvalues;
+} ra_prop_t;
+
+typedef int (*ra_smf_cb_t)(void *, scf_walkinfo_t *);
+
+/* Used to store program name */
+static const char *myname;
+
+static void usage(void);
+
+static int ra_check_legacy_daemons(void);
+static int ra_upgrade_legacy_daemons(void);
+static int ra_upgrade_cmd(char, int, char **);
+static int ra_update(void);
+static int ra_update_routing_svcs(char *);
+static int ra_report(boolean_t, const char *);
+static int ra_smf_cb(ra_smf_cb_t, const char *, void *);
+static int ra_upgrade_from_legacy_conf(void);
+static int ra_parseconf(void);
+static int ra_parseopt(char *, int, raopt_t *);
+static int ra_parsevar(char *, ravar_t *);
+static oval_t ra_str2oval(const char *);
+static raopt_t *ra_str2opt(const char *);
+static void ra_resetopts(void);
+static ravar_t *ra_str2var(const char *);
+static void ra_resetvars(const char *);
+static char *ra_intloptname(const char *);
+
+/* Callback for upgrade of legacy daemons */
+static int ra_upgrade_legacy_daemons_cb(void *, scf_walkinfo_t *);
+
+/* Callbacks used to set/retieve routing options */
+static int ra_set_current_opt_cb(void *, scf_walkinfo_t *);
+static int ra_set_persistent_opt_cb(void *, scf_walkinfo_t *);
+static int ra_set_default_opt_cb(void *, scf_walkinfo_t *);
+static int ra_get_current_opt_cb(void *, scf_walkinfo_t *);
+static int ra_get_persistent_opt_cb(void *, scf_walkinfo_t *);
+static int ra_get_default_opt_cb(void *, scf_walkinfo_t *);
+static int ra_get_set_opt_common_cb(raopt_t *, scf_walkinfo_t *, boolean_t,
+ boolean_t);
+
+/* Callbacks used to set/retrieve routing variables */
+static int ra_set_persistent_var_cb(void *, scf_walkinfo_t *);
+static int ra_get_persistent_var_cb(void *, scf_walkinfo_t *);
+static int ra_get_default_var_cb(void *, scf_walkinfo_t *);
+static int ra_mark_routing_svcs_cb(void *, scf_walkinfo_t *);
+
+/* Callbacks used to list/set daemon properties and list daemons and states. */
+static int ra_list_props_cb(void *, scf_walkinfo_t *);
+static int ra_modify_props_cb(void *, scf_walkinfo_t *);
+static int ra_print_state_cb(void *, scf_walkinfo_t *);
+
+/* Utility functions for SMF operations */
+static int ra_get_pg(scf_handle_t *, scf_instance_t *, const char *,
+ boolean_t, boolean_t, scf_propertygroup_t **);
+static int ra_get_boolean_prop(scf_handle_t *, scf_instance_t *,
+ const char *, const char *, boolean_t, boolean_t, boolean_t *);
+static int ra_get_single_prop_as_string(scf_handle_t *, scf_instance_t *,
+ const char *, const char *, boolean_t, boolean_t, scf_type_t *, char **);
+static int ra_get_prop_as_string(scf_handle_t *, scf_instance_t *,
+ const char *, const char *, boolean_t, boolean_t, scf_type_t *, int *,
+ char ***);
+static void ra_free_prop_values(int, char **);
+static int ra_set_boolean_prop(scf_handle_t *, scf_instance_t *,
+ const char *, const char *, boolean_t, boolean_t);
+static int ra_set_prop_from_string(scf_handle_t *, scf_instance_t *,
+ const char *, const char *, scf_type_t, boolean_t, int,
+ const char **);
+
+static void
+usage(void)
+{
+ (void) fprintf(stderr, gettext(
+ "usage: %1$s [-p] [-R <root-dir>]\n"
+ " %1$s [-e <option>] [-d <option>] [-r <option>]\n"
+ " [-l <FMRI>] [-m <FMRI> key=value [...]]\n"
+ " [-s <var>=<val>] [-R <root-dir>]\n"
+ " %1$s -u\n\n"
+ " <option> is one of:\n"
+ " ipv4-forwarding\n"
+ " ipv4-routing\n"
+ " ipv6-forwarding\n"
+ " ipv6-routing\n\n"
+ " <var> is one of:\n"
+ " ipv4-routing-daemon\n"
+ " ipv4-routing-daemon-args\n"
+ " ipv4-routing-stop-cmd\n"
+ " ipv6-routing-daemon\n"
+ " ipv6-routing-daemon-args\n"
+ " ipv6-routing-stop-cmd\n"
+ " routing-svcs\n"), myname);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int opt, opt_index, numargs, status = 0;
+ int numvalues, i;
+ ssize_t keylen;
+ boolean_t modify = B_FALSE, report = B_TRUE, update = B_FALSE;
+ boolean_t alt_root_set = B_FALSE;
+ boolean_t parseable = B_FALSE;
+ char *key, *nk, *keyend, *val, **vals, *options, *fmri;
+ char *parseopt = NULL;
+ raopt_t *raopt;
+ ravar_t *ravar;
+ ra_prop_t raprop;
+
+ myname = argv[0];
+
+ (void) setlocale(LC_ALL, "");
+
+#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
+#define TEXT_DOMAIN "SYS_TEST"
+#endif
+
+ (void) textdomain(TEXT_DOMAIN);
+
+ /*
+ * Before processing any options, we parse /etc/inet/routing.conf
+ * (if present) and transfer values to SMF.
+ */
+ if (ra_upgrade_from_legacy_conf() == -1)
+ exit(EXIT_FAILURE);
+ while ((opt = getopt(argc, argv, ":d:e:l:m:p:R:r:s:u")) != EOF) {
+ switch (opt) {
+ case 'd':
+ case 'e':
+ case 'r':
+ if (alt_root_set) {
+ if (ra_upgrade_cmd(opt, 1, &optarg) != 0)
+ exit(EXIT_FAILURE);
+ modify = B_TRUE;
+ break;
+ }
+ if ((raopt = ra_str2opt(optarg)) != NULL) {
+ /* Set current value appropriately */
+ switch (opt) {
+ case 'd':
+ raopt->opt_enabled = B_FALSE;
+ break;
+ case 'e':
+ /*
+ * Check legacy daemons, mark
+ * routing-svcs.
+ */
+ if (IS_ROUTING_OPT(optarg) &&
+ ra_check_legacy_daemons() == -1)
+ exit(EXIT_FAILURE);
+ raopt->opt_enabled = B_TRUE;
+ break;
+ case 'r':
+ /*
+ * This callback sets opt_enabled to
+ * the default value.
+ */
+ ra_resetopts();
+ if (ra_smf_cb(ra_get_default_opt_cb,
+ raopt->opt_default_fmri, raopt)
+ == -1)
+ exit(EXIT_FAILURE);
+ if (raopt->opt_enabled &&
+ IS_ROUTING_OPT(optarg) &&
+ ra_check_legacy_daemons() == -1)
+ exit(EXIT_FAILURE);
+ /* set value to default */
+ raopt->opt_enabled =
+ raopt->opt_default_enabled;
+ break;
+ }
+ if (ra_smf_cb(ra_set_persistent_opt_cb,
+ raopt->opt_fmri, raopt) == -1)
+ exit(EXIT_FAILURE);
+ } else if ((ravar = ra_str2var(optarg)) != NULL) {
+ if (opt != 'r') {
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ /* set current value to default */
+ ra_resetopts();
+ if (ra_smf_cb(ra_get_default_var_cb,
+ ravar->var_default_fmri, ravar) == -1)
+ exit(EXIT_FAILURE);
+ /* Need special case for routing-svcs var */
+ if (strcmp(ravar->var_name, RA_VAR_ROUTING_SVCS)
+ == 0) {
+ if (ra_update_routing_svcs(
+ ravar->var_default_value) == -1)
+ exit(EXIT_FAILURE);
+ } else if (ra_smf_cb(ra_set_persistent_var_cb,
+ ravar->var_fmri, ravar) == -1)
+ exit(EXIT_FAILURE);
+ } else {
+ (void) fprintf(stderr, gettext(
+ "%1$s: invalid option: %2$s\n"), myname,
+ optarg);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ modify = B_TRUE;
+ break;
+ case 'l':
+ if (ra_smf_cb(ra_list_props_cb, optarg, NULL) == -1)
+ exit(EXIT_FAILURE);
+ report = B_FALSE;
+ break;
+ case 'm':
+ fmri = optarg;
+ modify = B_TRUE;
+ /*
+ * Argument list of key=value pairs, we need to
+ * collate all matching keys to set multiple values.
+ */
+ numargs = 1;
+ i = optind;
+ for (numargs = 1; argv[i] != NULL && argv[i][0] != '-';
+ numargs++)
+ i++;
+ if (numargs == 1) {
+ (void) fprintf(stderr, gettext(
+ "%s: key=value required for "
+ "property change\n"), myname);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ if (alt_root_set) {
+ if (ra_upgrade_cmd(opt, numargs,
+ &argv[optind - 1]) == -1)
+ exit(EXIT_FAILURE);
+ optind += numargs - 1;
+ break;
+ }
+ /*
+ * Collect all key=value pairs which use same key
+ * so we can add multiple property values.
+ */
+ for (key = argv[optind]; key != NULL && key[0] != '-';
+ key = argv[++optind]) {
+ if (key[0] == '\0')
+ continue;
+ vals = malloc(sizeof (char *));
+ if ((vals[0] = strchr(key, '=')) == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%s: Malformed name=value "
+ "pair %s\n"), myname, key);
+ exit(EXIT_FAILURE);
+ }
+ numvalues = 1;
+ *(vals[0]) = '\0';
+ (vals[0])++;
+ i = optind + 1;
+ for (nk = argv[i];
+ nk != NULL && nk[0] != '-';
+ nk = argv[++i]) {
+ if (nk[0] == '\0')
+ continue;
+ if ((keyend = strchr(nk, '='))
+ == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%s: Malformed name=value "
+ " pair %s\n"), myname, nk);
+ exit(EXIT_FAILURE);
+ }
+ if ((keylen = keyend - nk) !=
+ strlen(key))
+ continue;
+ if (strncmp(key, nk, keylen) == 0) {
+ vals = realloc(vals, ++numvalues
+ * sizeof (char *));
+ vals[numvalues - 1] = ++keyend;
+ nk[0] = '\0';
+ optind++;
+ }
+ }
+ raprop.prop_name = key;
+ raprop.prop_values = vals;
+ raprop.prop_numvalues = numvalues;
+ if (ra_smf_cb(ra_modify_props_cb, fmri,
+ &raprop) == -1)
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case 'p':
+ parseable = B_TRUE;
+ parseopt = optarg;
+ break;
+ case 'R':
+ if (chroot(optarg) == -1) {
+ (void) fprintf(stderr, gettext(
+ "%1$s: failed to chroot to %2$s: %3$s\n"),
+ myname, optarg, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ alt_root_set = B_TRUE;
+ report = B_FALSE;
+ break;
+ case 's':
+ if (alt_root_set) {
+ if (ra_upgrade_cmd(opt, 1, &optarg) == -1)
+ exit(EXIT_FAILURE);
+ modify = B_TRUE;
+ break;
+ }
+ options = optarg;
+ while (*options != '\0') {
+ opt_index = getsubopt(&options, v_opt, &val);
+ if (val == NULL) {
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ if (opt_index == -1) {
+ (void) fprintf(stderr, gettext(
+ "%1$s: invalid variable: %2$s\n"),
+ myname, optarg);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ ravar = &ra_vars[opt_index];
+ /* Need special case for routing-svcs var */
+ if (strcmp(ravar->var_name, RA_VAR_ROUTING_SVCS)
+ == 0) {
+ if (ra_update_routing_svcs(val) == -1)
+ return (-1);
+ } else {
+ ravar->var_value = strdup(val);
+ if (ra_smf_cb(ra_set_persistent_var_cb,
+ ravar->var_fmri, ravar) == -1)
+ exit(EXIT_FAILURE);
+ }
+ }
+ modify = B_TRUE;
+ break;
+ case 'u':
+ update = B_TRUE;
+ break;
+ case ':':
+ /* if not 'p', usage failure */
+ if (strcmp(argv[optind - 1], "-p") != 0) {
+ (void) fprintf(stderr, gettext(
+ "%s: option requires an argument -%s\n"),
+ myname, argv[optind - 1]);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ parseable = B_TRUE;
+ break;
+ case '?':
+ usage();
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc > optind) {
+ /* There shouldn't be any extra args. */
+ usage();
+ exit(EXIT_FAILURE);
+ }
+
+ if (parseable && (update || modify)) {
+ (void) fprintf(stderr, gettext("%s: the -p option cannot be "
+ "used with any of -demrsu\n"), myname);
+ usage();
+ exit(EXIT_FAILURE);
+ }
+
+ if (update && ! alt_root_set)
+ status = ra_update();
+
+ if (report && !modify && !update)
+ status = ra_report(parseable, parseopt);
+
+ return (status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+}
+
+/*
+ * Upgrade legacy daemons, mark to-be-enabled routing services.
+ */
+static int
+ra_check_legacy_daemons(void)
+{
+ ravar_t *routing_svcs = ra_str2var(RA_VAR_ROUTING_SVCS);
+ ravar_t *v4d = ra_str2var(RA_VAR_IPV4_ROUTING_DAEMON);
+ ravar_t *v6d = ra_str2var(RA_VAR_IPV6_ROUTING_DAEMON);
+ char *fmri, *nextfmri;
+ boolean_t mark = B_FALSE;
+
+ if (ra_smf_cb(ra_get_persistent_var_cb, routing_svcs->var_fmri,
+ routing_svcs) == -1)
+ return (-1);
+
+ /* First unmark all services */
+ if (ra_smf_cb(ra_mark_routing_svcs_cb, NULL, &mark) == -1)
+ return (-1);
+
+ mark = B_TRUE;
+ if (routing_svcs->var_value != NULL) {
+ /*
+ * For routing-svcs variable, mark each named
+ * service as a current-routing-svc.
+ */
+ if ((fmri = strdup(routing_svcs->var_value)) == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%s: out of memory\n"), myname);
+ return (-1);
+ }
+ /* Now, mark each service named in routing-svcs. */
+ for (nextfmri = strtok(fmri, " \t");
+ nextfmri != NULL;
+ nextfmri = strtok(NULL, " \t")) {
+ if (ra_smf_cb(ra_mark_routing_svcs_cb, nextfmri,
+ &mark) == -1) {
+ free(fmri);
+ return (-1);
+ }
+ }
+ free(fmri);
+ }
+
+ /*
+ * Now check if legacy variables (if specified) map to SMF routing
+ * daemons. If so, transfer associated daemon arguments.
+ */
+ if (ra_upgrade_legacy_daemons() == -1)
+ return (-1);
+
+ ra_resetvars(NULL);
+ /*
+ * At this point, if the legacy services still have ipv4/ipv6
+ * routing daemons specified, we know they weren`t upgraded, so
+ * we mark them also.
+ */
+ if (ra_smf_cb(ra_get_persistent_var_cb, v4d->var_fmri, v4d) == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, v6d->var_fmri, v6d) == -1)
+ return (-1);
+
+ if (v4d->var_value != NULL && strtok(v4d->var_value, " \t") != NULL &&
+ ra_smf_cb(ra_mark_routing_svcs_cb, RA_INSTANCE_LEGACY_ROUTING_IPV4,
+ &mark) == -1)
+ return (-1);
+ if (v6d->var_value != NULL && strtok(v6d->var_value, " \t") != NULL &&
+ ra_smf_cb(ra_mark_routing_svcs_cb, RA_INSTANCE_LEGACY_ROUTING_IPV6,
+ &mark) == -1)
+ return (-1);
+
+ return (0);
+}
+
+/*
+ * Retrieve legacy daemon variables, and check if any SMF routing daemons
+ * run the daemons specified. If so, the legacy configuration (arguments
+ * to the daemon) is transferred to the routeadm/daemon-args property
+ * of the corresponding instance. From there, the instance picks up the
+ * value and will transfer the daemon arguments to individiual properties
+ * when enabled.
+ */
+static int
+ra_upgrade_legacy_daemons(void)
+{
+ ravar_t *v4d = ra_str2var(RA_VAR_IPV4_ROUTING_DAEMON);
+ ravar_t *v6d = ra_str2var(RA_VAR_IPV6_ROUTING_DAEMON);
+ ravar_t *v4args = ra_str2var(RA_VAR_IPV4_ROUTING_DAEMON_ARGS);
+ ravar_t *v6args = ra_str2var(RA_VAR_IPV6_ROUTING_DAEMON_ARGS);
+ ravar_t *v4stop = ra_str2var(RA_VAR_IPV4_ROUTING_STOP_CMD);
+ ravar_t *v6stop = ra_str2var(RA_VAR_IPV6_ROUTING_STOP_CMD);
+
+ if (ra_smf_cb(ra_get_persistent_var_cb, v4d->var_fmri, v4d) == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, v6d->var_fmri, v6d) == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, v4args->var_fmri, v4args)
+ == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, v6args->var_fmri, v6args)
+ == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, v4stop->var_fmri, v4stop)
+ == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, v6stop->var_fmri, v6stop)
+ == -1)
+ return (-1);
+
+ return (ra_smf_cb(ra_upgrade_legacy_daemons_cb, NULL, NULL));
+}
+
+/*
+ * Determine if service runs the same daemon as that which is specified
+ * in ipv4-routing-daemon or ipv6-routing-daemon. If so, the associated
+ * daemon arguments are transferred to the service.
+ */
+
+/* ARGSUSED0 */
+static int
+ra_upgrade_legacy_daemons_cb(void *data, scf_walkinfo_t *wip)
+{
+ const char *inst_fmri = wip->fmri;
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ char *daemon, *l_daemon = NULL;
+ ravar_t *v4d = ra_str2var(RA_VAR_IPV4_ROUTING_DAEMON);
+ ravar_t *v6d = ra_str2var(RA_VAR_IPV6_ROUTING_DAEMON);
+ ravar_t *v4args = ra_str2var(RA_VAR_IPV4_ROUTING_DAEMON_ARGS);
+ ravar_t *v6args = ra_str2var(RA_VAR_IPV6_ROUTING_DAEMON_ARGS);
+ ravar_t *v4stop = ra_str2var(RA_VAR_IPV4_ROUTING_STOP_CMD);
+ ravar_t *v6stop = ra_str2var(RA_VAR_IPV6_ROUTING_STOP_CMD);
+ ravar_t *routing_svcs = ra_str2var(RA_VAR_ROUTING_SVCS);
+ boolean_t mark, marked;
+ char *new_routing_svcs;
+
+ /*
+ * Ensure instance is a routing service, and not one of the
+ * legacy instances - if it is, the daemon property is already
+ * set to the legacy daemon.
+ */
+ if (ra_get_single_prop_as_string(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_DAEMON, B_TRUE, B_FALSE, NULL, &daemon) == -1 ||
+ strcmp(RA_INSTANCE_LEGACY_ROUTING_IPV4, inst_fmri) == 0 ||
+ strcmp(RA_INSTANCE_LEGACY_ROUTING_IPV6, inst_fmri) == 0)
+ return (0);
+
+ /* A legacy daemon may be defined */
+ (void) ra_get_single_prop_as_string(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_LEGACY_DAEMON, B_TRUE, B_FALSE, NULL, &l_daemon);
+
+ /*
+ * If we match daemon/legacy_daemon with ipv4-routing-daemon or
+ * ipv6-routing-daemon values, transfer daemon-args value
+ * to the matching service.
+ */
+ if (v4d->var_value != NULL && (strcmp(v4d->var_value, daemon) == 0 ||
+ (l_daemon != NULL && strcmp(v4d->var_value, l_daemon) == 0))) {
+ (void) printf(gettext("%s: migrating daemon configuration "
+ "for %s to %s\n"), myname, l_daemon != NULL ?
+ l_daemon : daemon, inst_fmri);
+ /* Transfer daemon-args value, clear legacy v4 values */
+ if (ra_set_prop_from_string(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_DAEMON_ARGS, SCF_TYPE_ASTRING, B_TRUE, 1,
+ (const char **)&(v4args->var_value)) == -1)
+ return (-1);
+ ra_resetvars(RA_PROPVAL_PROTO_IPV4);
+ if (ra_smf_cb(ra_set_persistent_var_cb,
+ RA_INSTANCE_LEGACY_ROUTING_IPV4, v4d) == -1 ||
+ ra_smf_cb(ra_set_persistent_var_cb,
+ RA_INSTANCE_LEGACY_ROUTING_IPV4, v4args) == -1 ||
+ ra_smf_cb(ra_set_persistent_var_cb,
+ RA_INSTANCE_LEGACY_ROUTING_IPV4, v4stop) == -1)
+ return (-1);
+ } else if (v6d->var_value != NULL && (strcmp(v6d->var_value, daemon)
+ == 0 ||
+ (l_daemon != NULL && strcmp(v6d->var_value, l_daemon) == 0))) {
+ (void) printf(gettext("%s: migrating daemon configuration "
+ "for %s to %s\n"), myname, l_daemon != NULL ?
+ l_daemon : daemon, inst_fmri);
+ /* Transfer daemon-args value, clear legacy v6 values */
+ if (ra_set_prop_from_string(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_DAEMON_ARGS, SCF_TYPE_ASTRING, B_TRUE, 1,
+ (const char **)&(v6args->var_value)) == -1)
+ return (-1);
+ ra_resetvars(RA_PROPVAL_PROTO_IPV6);
+ if (ra_smf_cb(ra_set_persistent_var_cb,
+ RA_INSTANCE_LEGACY_ROUTING_IPV6, v6d) == -1 ||
+ ra_smf_cb(ra_set_persistent_var_cb,
+ RA_INSTANCE_LEGACY_ROUTING_IPV6, v6args) == -1 ||
+ ra_smf_cb(ra_set_persistent_var_cb,
+ RA_INSTANCE_LEGACY_ROUTING_IPV6, v6stop) == -1)
+ return (-1);
+ } else
+ return (0);
+
+ /*
+ * If service is unmarked at this point, add it to routing-svcs and
+ * mark it.
+ */
+ if (ra_get_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_CURR_ROUTING_SVC, B_FALSE, B_FALSE, &marked) == -1 ||
+ marked == B_FALSE) {
+ mark = B_TRUE;
+ if (ra_smf_cb(ra_mark_routing_svcs_cb, inst_fmri, &mark)
+ == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, routing_svcs->var_fmri,
+ routing_svcs) == -1)
+ return (-1);
+ if ((new_routing_svcs =
+ malloc(strlen(routing_svcs->var_value) +
+ strlen(inst_fmri) + 2)) == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%s: out of memory"), myname);
+ return (-1);
+ }
+ if (strlen(routing_svcs->var_value) == 0)
+ (void) snprintf(new_routing_svcs,
+ strlen(inst_fmri) + 1, "%s", inst_fmri);
+ else
+ (void) snprintf(new_routing_svcs,
+ strlen(routing_svcs->var_value) +
+ strlen(inst_fmri) + 2, "%s %s",
+ routing_svcs->var_value, inst_fmri);
+ free(routing_svcs->var_value);
+ routing_svcs->var_value = new_routing_svcs;
+ (void) smf_refresh_instance(inst_fmri);
+ return (ra_smf_cb(ra_set_persistent_var_cb,
+ routing_svcs->var_fmri, routing_svcs));
+ }
+ (void) smf_refresh_instance(inst_fmri);
+ return (0);
+}
+
+/*
+ * If we are upgrading, append operation to <alt_root>/var/svc/profile/upgrade.
+ */
+static int
+ra_upgrade_cmd(char opt, int argc, char **argv)
+{
+ FILE *fp;
+ int i;
+
+ if ((fp = fopen(RA_SMF_UPGRADE_FILE, "a+")) == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%1$s: failed to open %2$s: %3$s\n"),
+ myname, RA_SMF_UPGRADE_FILE, strerror(errno));
+ return (-1);
+ }
+ (void) fprintf(fp, "/sbin/routeadm -%c ", opt);
+ if (argv != NULL) {
+ for (i = 0; i < argc; i++)
+ (void) fprintf(fp, "%s ", argv[i]);
+ }
+ (void) fprintf(fp, "%s\n", RA_SMF_UPGRADE_MSG);
+ (void) fclose(fp);
+ return (0);
+}
+
+/*
+ * Set current state to "next boot" state, i.e. if general/enabled
+ * value is overlaid by a general_ovr/enabled value, set the current state
+ * to the value of the latter. Doing this applies "next boot" changes to
+ * the current setup.
+ */
+static int
+ra_update(void)
+{
+ int i, ret = 0;
+
+ if (ra_check_legacy_daemons() == -1)
+ return (-1);
+ for (i = 0; ra_opts[i].opt_name != NULL; i++) {
+ if ((ret = ra_smf_cb(ra_set_current_opt_cb, ra_opts[i].opt_fmri,
+ &ra_opts[i])) == -1)
+ break;
+ }
+ return (ret);
+}
+
+/*
+ * Here we catch the special case where ipv4/ipv6 routing was enabled,
+ * and the user updates the routing-svcs list. The problem is that
+ * the enabled state is the result of services on the old routing-svcs list
+ * being enabled, and we want to support users doing something like this:
+ *
+ * # routeadm -s routing-svcs=route -e ipv4-routing -u
+ *
+ * followed by
+ *
+ * # routeadm -s routing-svcs=rdisc -u
+ *
+ * To do this, we need to:
+ * - cache the old ipv4-routing/ipv6-routing values.
+ * - persistently disable the old routing-svcs list.
+ * - if ipv4-routing was enabled, mark and persistently enable all the new
+ * v4 routing-svcs
+ * - if ipv6-routing was enabled, mark and persistently enable all the new
+ * v6 routing-svcs.
+ * This will result in the next "-u" switching on the new routing-svcs, and
+ * switching off the old ones, as the user would expect.
+ */
+static int
+ra_update_routing_svcs(char *routing_svcs_new)
+{
+ raopt_t *v4opt = ra_str2opt(RA_OPT_IPV4_ROUTING);
+ raopt_t *v6opt = ra_str2opt(RA_OPT_IPV6_ROUTING);
+ ravar_t *routing_svcs = ra_str2var(RA_VAR_ROUTING_SVCS);
+ char *routing_svcs_old, *fmri;
+ boolean_t v4_old, v6_old, mark = B_FALSE;
+
+ ra_resetopts();
+ if (ra_smf_cb(ra_get_persistent_opt_cb, v4opt->opt_fmri, v4opt) == -1 ||
+ ra_smf_cb(ra_get_persistent_opt_cb, v6opt->opt_fmri, v6opt) == -1 ||
+ ra_smf_cb(ra_get_persistent_var_cb, routing_svcs->var_fmri,
+ routing_svcs) == -1)
+ return (-1);
+ v4_old = v4opt->opt_enabled;
+ v6_old = v6opt->opt_enabled;
+ routing_svcs_old = routing_svcs->var_value;
+ routing_svcs->var_value = routing_svcs_new;
+
+ if (ra_smf_cb(ra_set_persistent_var_cb, routing_svcs->var_fmri,
+ routing_svcs) == -1) {
+ free(routing_svcs_old);
+ return (-1);
+ }
+
+ if (!v4_old && !v6_old) {
+ /* We don`t need to do anything, since services were disabled */
+ free(routing_svcs_old);
+ return (0);
+ }
+ v4opt->opt_enabled = B_FALSE;
+ v6opt->opt_enabled = B_FALSE;
+
+ /* Persistently disable each old v4/v6 "routing-svc" */
+ for (fmri = strtok(routing_svcs_old, " \t"); fmri != NULL;
+ fmri = strtok(NULL, " \t")) {
+ if (ra_smf_cb(ra_mark_routing_svcs_cb, fmri, &mark) == -1) {
+ free(routing_svcs_old);
+ return (-1);
+ }
+ if (v4_old &&
+ ra_smf_cb(ra_set_persistent_opt_cb, fmri, v4opt) == -1) {
+ free(routing_svcs_old);
+ return (-1);
+ }
+ if (v6_old &&
+ ra_smf_cb(ra_set_persistent_opt_cb, fmri, v6opt) == -1) {
+ free(routing_svcs_old);
+ return (-1);
+ }
+ }
+ free(routing_svcs_old);
+ v4opt->opt_enabled = v4_old;
+ v6opt->opt_enabled = v6_old;
+
+ /* Persistently enable each new v4/v6 "routing-svc" */
+ mark = B_TRUE;
+ for (fmri = strtok(routing_svcs_new, " \t"); fmri != NULL;
+ fmri = strtok(NULL, " \t")) {
+ if (ra_smf_cb(ra_mark_routing_svcs_cb, fmri, &mark) == -1)
+ return (-1);
+ if (v4_old &&
+ ra_smf_cb(ra_set_persistent_opt_cb, fmri, v4opt) == -1)
+ return (-1);
+ if (v6_old &&
+ ra_smf_cb(ra_set_persistent_opt_cb, fmri, v6opt) == -1)
+ return (-1);
+ }
+ return (0);
+}
+
+/*
+ * Display status, in parseable form if required. If param is
+ * specified, only the named option/variable is displayed (this option is
+ * for parseable display only).
+ */
+static int
+ra_report(boolean_t parseable, const char *param)
+{
+ int i;
+ char *c_state, *d_state, *p_state, *p_var, *d_var;
+ char *enabled = "enabled";
+ char *disabled = "disabled";
+ boolean_t param_found = B_FALSE;
+
+ if (!parseable) {
+ (void) printf(gettext(
+ " Configuration Current "
+ "Current\n"
+ " Option Configuration "
+ "System State\n"
+ "---------------------------------------------------"
+ "------------\n"));
+ }
+ for (i = 0; ra_opts[i].opt_name != NULL; i++) {
+ if (param != NULL) {
+ if (strcmp(ra_opts[i].opt_name, param) == 0)
+ param_found = B_TRUE;
+ else
+ continue;
+ }
+ if (ra_smf_cb(ra_get_current_opt_cb,
+ ra_opts[i].opt_fmri, &ra_opts[i]) == -1)
+ return (-1);
+ c_state = ra_opts[i].opt_enabled ? enabled : disabled;
+ ra_resetopts();
+ if (ra_smf_cb(ra_get_persistent_opt_cb,
+ ra_opts[i].opt_fmri, &ra_opts[i]) == -1)
+ return (-1);
+ p_state = ra_opts[i].opt_enabled ? enabled : disabled;
+ ra_resetopts();
+ if (ra_smf_cb(ra_get_default_opt_cb,
+ ra_opts[i].opt_default_fmri, &ra_opts[i]) == -1)
+ return (-1);
+ d_state = ra_opts[i].opt_default_enabled ? enabled : disabled;
+ ra_resetopts();
+ if (parseable) {
+ if (param == NULL)
+ (void) printf("%s ", ra_opts[i].opt_name);
+ (void) printf("persistent=%s default=%s "
+ "current=%s\n", p_state, d_state, c_state);
+ } else {
+ (void) printf(gettext("%1$27s %2$-21s%3$s\n"),
+ ra_intloptname(ra_opts[i].opt_name),
+ p_state, c_state);
+ }
+ }
+ if (!parseable)
+ (void) printf("\n");
+
+ ra_resetvars(NULL);
+
+ /* Gather persistent/default variable values */
+ for (i = 0; ra_vars[i].var_name != NULL; i++) {
+ if (ra_smf_cb(ra_get_persistent_var_cb,
+ ra_vars[i].var_fmri, &ra_vars[i]) == -1 ||
+ ra_smf_cb(ra_get_default_var_cb,
+ ra_vars[i].var_default_fmri, &ra_vars[i]) == -1)
+ return (-1);
+
+ }
+ for (i = 0; ra_vars[i].var_name != NULL; i++) {
+ if (param != NULL) {
+ if (strcmp(ra_vars[i].var_name, param) == 0)
+ param_found = B_TRUE;
+ else
+ continue;
+ }
+ p_var = ra_vars[i].var_value == NULL ? "":
+ ra_vars[i].var_value;
+ d_var = ra_vars[i].var_default_value == NULL ?
+ "": ra_vars[i].var_default_value;
+ if (parseable) {
+ if (param == NULL)
+ (void) printf("%s ", ra_vars[i].var_name);
+ (void) printf("persistent=\"%s\" "
+ "default=\"%s\" \n", p_var, d_var);
+ } else {
+ /* If daemon variables are not set, do not display. */
+ if ((IS_IPV4_VAR(ra_vars[i].var_name) &&
+ IPV4_VARS_UNSET) ||
+ (IS_IPV6_VAR(ra_vars[i].var_name) &&
+ IPV6_VARS_UNSET))
+ continue;
+ (void) printf(gettext("%1$27s \"%2$s\"\n"),
+ ra_intloptname(ra_vars[i].var_name), p_var);
+ }
+ }
+
+ if (param != NULL && !param_found) {
+ (void) fprintf(stderr, gettext(
+ "%s: no such option/variable %s\n"), myname, param);
+ return (-1);
+ }
+ if (parseable)
+ return (0);
+ (void) printf(gettext("\nRouting daemons:\n"));
+ (void) printf("\n %s %s\n", "STATE", "FMRI");
+ if (ra_smf_cb(ra_print_state_cb, NULL, NULL) == -1)
+ return (-1);
+ return (0);
+}
+
+/*
+ * Call scf_walk_fmri() with appropriate function, fmri, and data.
+ * A NULL fmri causes scf_walk_fmri() to run on all instances. We make
+ * use of this many times in applying changes to the routing services.
+ */
+static int
+ra_smf_cb(ra_smf_cb_t cbfunc, const char *fmri, void *data)
+{
+ scf_handle_t *h;
+ int exit_status = 0;
+
+ if ((h = scf_handle_create(SCF_VERSION)) == NULL ||
+ scf_handle_bind(h) == -1) {
+ (void) fprintf(stderr, gettext(
+ "%s: cannot connect to SMF repository\n"), myname);
+ return (-1);
+ }
+ return (scf_walk_fmri(h, fmri == NULL ? 0 : 1,
+ fmri == NULL ? NULL : (char **)&fmri, 0,
+ cbfunc, data, &exit_status, uu_die));
+}
+
+/*
+ * Applies persistent configuration settings to current setup.
+ */
+static int
+ra_set_current_opt_cb(void *data, scf_walkinfo_t *wip)
+{
+ return (ra_get_set_opt_common_cb(data, wip, B_FALSE, B_FALSE));
+}
+
+/*
+ * Sets persistent value for option, to be applied on next boot
+ * or by "routeadm -u".
+ */
+static int
+ra_set_persistent_opt_cb(void *data, scf_walkinfo_t *wip)
+{
+ return (ra_get_set_opt_common_cb(data, wip, B_TRUE, B_FALSE));
+}
+
+static int
+ra_get_current_opt_cb(void *data, scf_walkinfo_t *wip)
+{
+ return (ra_get_set_opt_common_cb(data, wip, B_FALSE, B_TRUE));
+}
+
+static int
+ra_get_persistent_opt_cb(void *data, scf_walkinfo_t *wip)
+{
+ return (ra_get_set_opt_common_cb(data, wip, B_TRUE, B_TRUE));
+}
+
+/*
+ * Shared function that either sets or determines persistent or current
+ * state. Setting persistent state (for next boot) involves setting
+ * the general_ovr/enabled value to the current service state, and
+ * the general/enabled value to the desired (next-boot) state.
+ * Setting current state involves removing the temporary state
+ * setting so the persistent state has effect.
+ *
+ * Persistent state is reported as being enabled if any of the
+ * candidate services have a general/enabled value set to true,
+ * while current state is reported as being enabled if any of the
+ * candidate services has a general_ovr/enabled or general/enabled
+ * value set to true.
+ */
+static int
+ra_get_set_opt_common_cb(raopt_t *raopt, scf_walkinfo_t *wip,
+ boolean_t persistent, boolean_t get)
+{
+ const char *inst_fmri = wip->fmri;
+ scf_instance_t *inst = wip->inst;
+ scf_instance_t *rinst = NULL;
+ scf_handle_t *h = scf_instance_handle(inst);
+ scf_propertygroup_t *routeadm_pg;
+ boolean_t persistent_state_enabled;
+ boolean_t temporary_state_enabled;
+ boolean_t current_state_enabled;
+ boolean_t curr_svc = B_TRUE;
+ boolean_t found_proto;
+ char **protolist = NULL;
+ int i, ret, numvalues = 0;
+
+ /*
+ * Ensure we are dealing with a routeadm-managed service. If
+ * the FMRI used for walking instances is NULL, it is reasonable
+ * that a service not have a routeadm property group as we will
+ * check all services in this case.
+ */
+ if (ra_get_pg(h, inst, RA_PG_ROUTEADM, B_TRUE, raopt->opt_fmri != NULL,
+ &routeadm_pg) == -1) {
+ /* Not a routing service, not an error. */
+ if (scf_error() == SCF_ERROR_NOT_FOUND &&
+ raopt->opt_fmri == NULL)
+ return (0);
+ return (-1);
+ }
+ scf_pg_destroy(routeadm_pg);
+
+ /* Services with no "protocol" property are not routing daemons */
+ if (raopt->opt_fmri == NULL && ra_get_prop_as_string(h, inst,
+ RA_PG_ROUTEADM, RA_PROP_PROTO, B_TRUE, B_FALSE, NULL, &numvalues,
+ &protolist) == -1) {
+ if (scf_error() == SCF_ERROR_NOT_FOUND)
+ return (0);
+ return (-1);
+ }
+
+ /*
+ * Skip invalid services based on flag settings. Flags are used when
+ * we run callback functions on all instances to identify
+ * the correct instances to operate on.
+ */
+ if (raopt->opt_flags & RA_SVC_FLAG_IPV4_ROUTING) {
+ found_proto = B_FALSE;
+ if (protolist != NULL) {
+ /* Check if protolist contains "ipv4" */
+ for (i = 0; i < numvalues; i++) {
+ if (protolist[i] != NULL && strcmp(
+ protolist[i], RA_PROPVAL_PROTO_IPV4) == 0)
+ found_proto = B_TRUE;
+ }
+ }
+ /* If not an ipv4 routing service, skip. */
+ if (protolist == NULL || !found_proto) {
+ ra_free_prop_values(numvalues, protolist);
+ return (0);
+ }
+ }
+ if (raopt->opt_flags & RA_SVC_FLAG_IPV6_ROUTING) {
+ found_proto = B_FALSE;
+ if (protolist != NULL) {
+ /* Check if protolist contains "ipv6" */
+ for (i = 0; i < numvalues; i++) {
+ if (protolist[i] != NULL && strcmp(
+ protolist[i], RA_PROPVAL_PROTO_IPV6) == 0)
+ found_proto = B_TRUE;
+ }
+ }
+ /* If not an ipv6 routing service, skip. */
+ if (protolist == NULL || !found_proto) {
+ ra_free_prop_values(numvalues, protolist);
+ return (0);
+ }
+ }
+ ra_free_prop_values(numvalues, protolist);
+
+ /* If enabling routing services, select only current routing services */
+ if (raopt->opt_fmri == NULL && !get && raopt->opt_enabled) {
+ if (ra_get_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_CURR_ROUTING_SVC, B_FALSE, B_FALSE,
+ &curr_svc) == -1)
+ return (0);
+ else if (!curr_svc && persistent) {
+ /*
+ * We apply "current" routing changes to all routing
+ * daemons, whether current or not, so bail if
+ * we are trying to make a persistent update to a
+ * non-"routing-svc".
+ */
+ return (0);
+ }
+ }
+ if (ra_get_boolean_prop(h, inst, SCF_PG_GENERAL, SCF_PROPERTY_ENABLED,
+ B_FALSE, B_TRUE, &persistent_state_enabled) == -1)
+ return (-1);
+
+ current_state_enabled = persistent_state_enabled;
+
+ if (ra_get_boolean_prop(h, inst, SCF_PG_GENERAL_OVR,
+ SCF_PROPERTY_ENABLED, B_FALSE, B_FALSE, &temporary_state_enabled)
+ == 0)
+ current_state_enabled = temporary_state_enabled;
+
+ if (get) {
+ /*
+ * Persistent state is enabled if any services are
+ * persistently enabled, i.e. general/enabled == true).
+ * current state is enabled if any services
+ * services are currently enabled, i.e. if defined,
+ * general_ovr/enabled == true, if not, general/enabled == true.
+ */
+ if (persistent)
+ raopt->opt_enabled = raopt->opt_enabled ||
+ persistent_state_enabled;
+ else
+ raopt->opt_enabled = raopt->opt_enabled ||
+ current_state_enabled;
+ } else {
+ if (persistent) {
+ /*
+ * For peristent state changes, from -e/-d,
+ * we set the general_ovr/enabled value to the
+ * current state (to ensure it is preserved),
+ * while setting the general/enabled value to
+ * the desired value. This has the effect of
+ * the desired value coming into effect on next boot.
+ */
+ ret = current_state_enabled ?
+ smf_enable_instance(inst_fmri, SMF_TEMPORARY) :
+ smf_disable_instance(inst_fmri, SMF_TEMPORARY);
+ if (ret != 0) {
+ (void) fprintf(stderr, gettext(
+ "%s: unexpected libscf error: %s\n"),
+ myname, scf_strerror(scf_error()));
+ return (-1);
+ }
+ /*
+ * Refresh here so general_ovr/enabled state overrides
+ * general/enabled state.
+ */
+ (void) smf_refresh_instance(inst_fmri);
+ /*
+ * Now we can safely set the general/enabled value
+ * to the value we require on next boot (or
+ * "routeadm -u").
+ */
+ ret = ra_set_boolean_prop(h, inst, SCF_PG_GENERAL,
+ SCF_PROPERTY_ENABLED, B_FALSE, raopt->opt_enabled);
+ if (ret != 0)
+ return (-1);
+ /*
+ * Refresh here so general/enabled value is set.
+ */
+ (void) smf_refresh_instance(inst_fmri);
+ if (raopt->opt_fmri != NULL)
+ return (0);
+ /*
+ * Notify network/routing-setup service that
+ * administrator has explicitly set ipv4(6)-routing
+ * value. If no explicit setting of this value is
+ * done, ipv4-routing can be enabled in the situation
+ * when no default routes can be determined.
+ */
+ if ((rinst = scf_instance_create(h)) == NULL ||
+ scf_handle_decode_fmri(h, RA_INSTANCE_ROUTING_SETUP,
+ NULL, NULL, rinst, NULL, NULL,
+ SCF_DECODE_FMRI_EXACT) == -1) {
+ (void) fprintf(stderr, gettext(
+ "%s: unexpected libscf error: %s\n"),
+ myname, scf_strerror(scf_error()));
+ return (-1);
+ }
+ ret = ra_set_boolean_prop(h, rinst, RA_PG_ROUTEADM,
+ raopt->opt_flags & RA_SVC_FLAG_IPV4_ROUTING ?
+ RA_PROP_IPV4_ROUTING_SET :
+ RA_PROP_IPV6_ROUTING_SET, B_FALSE, B_TRUE);
+ scf_instance_destroy(rinst);
+ if (ret != 0)
+ return (-1);
+ (void) smf_refresh_instance(RA_INSTANCE_ROUTING_SETUP);
+ } else {
+ /*
+ * For current changes (result of -u), we
+ * enable/disable depending on persistent value
+ * stored in general/enabled. Here we disable
+ * old routing-svcs (identified by a current-routing-svc
+ * value of false) also.
+ */
+ ret = persistent_state_enabled && curr_svc ?
+ smf_enable_instance(inst_fmri, 0) :
+ smf_disable_instance(inst_fmri, 0);
+ if (ret != 0) {
+ (void) fprintf(stderr, gettext(
+ "%s: unexpected libscf error: %s\n"),
+ myname, scf_strerror(scf_error()));
+ return (-1);
+ }
+ (void) smf_refresh_instance(inst_fmri);
+ }
+ }
+ return (0);
+}
+
+static int
+ra_set_default_opt_cb(void *data, scf_walkinfo_t *wip)
+{
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ raopt_t *raopt = data;
+
+ return (ra_set_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ raopt->opt_default_prop, B_FALSE, raopt->opt_default_enabled));
+}
+
+static int
+ra_get_default_opt_cb(void *data, scf_walkinfo_t *wip)
+{
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ raopt_t *raopt = data;
+
+ return (ra_get_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ raopt->opt_default_prop, B_TRUE, B_TRUE,
+ &(raopt->opt_default_enabled)));
+}
+
+/*
+ * Callbacks to set/retrieve persistent/default routing variable values.
+ * The set functions use the value stored in the var_value/var_default_value
+ * field of the associated ra_var_t, while the retrieval functions store
+ * the value retrieved in that field.
+ */
+static int
+ra_get_persistent_var_cb(void *data, scf_walkinfo_t *wip)
+{
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ ravar_t *ravar = data;
+
+ return (ra_get_single_prop_as_string(h, inst, RA_PG_ROUTEADM,
+ ravar->var_prop, B_TRUE, B_TRUE, NULL, &ravar->var_value));
+}
+
+static int
+ra_set_persistent_var_cb(void *data, scf_walkinfo_t *wip)
+{
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ ravar_t *ravar = data;
+
+ return (ra_set_prop_from_string(h, inst, RA_PG_ROUTEADM,
+ ravar->var_prop, SCF_TYPE_INVALID, B_FALSE, 1,
+ (const char **)&ravar->var_value));
+}
+
+static int
+ra_get_default_var_cb(void *data, scf_walkinfo_t *wip)
+{
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ ravar_t *ravar = data;
+
+ return (ra_get_single_prop_as_string(h, inst, RA_PG_ROUTEADM,
+ ravar->var_default_prop, B_TRUE, B_TRUE, NULL,
+ &ravar->var_default_value));
+}
+
+/*
+ * Depending on the value of the boolean_t * passed in, this callback
+ * either marks the relevant service(s) as current-routing-svcs (or unmarking)
+ * by setting that property to true or false. When routing services
+ * are to be enabled, the a current-routing-svc value of true flags the
+ * service as one to be enabled.
+ */
+static int
+ra_mark_routing_svcs_cb(void *data, scf_walkinfo_t *wip)
+{
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ boolean_t *mark = data;
+ boolean_t marked;
+ int numvalues = 0;
+ char **protolist = NULL;
+
+ /* Check we are dealing with a routing daemon service */
+ if (ra_get_prop_as_string(h, inst, RA_PG_ROUTEADM, RA_PROP_PROTO,
+ B_TRUE, B_FALSE, NULL, &numvalues, &protolist) == -1)
+ return (0);
+ ra_free_prop_values(numvalues, protolist);
+ if (*mark)
+ return (ra_set_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_CURR_ROUTING_SVC, B_TRUE, B_TRUE));
+ /* Unmark service. */
+ if (ra_get_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_CURR_ROUTING_SVC, B_TRUE, B_FALSE, &marked) == 0 && marked)
+ return (ra_set_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_CURR_ROUTING_SVC, B_TRUE, B_FALSE));
+ return (0);
+}
+
+/*
+ * List property values for all properties in the "routing" property
+ * group of the routing service instance.
+ */
+
+/* ARGSUSED0 */
+static int
+ra_list_props_cb(void *data, scf_walkinfo_t *wip)
+{
+ const char *inst_fmri = wip->fmri;
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ scf_iter_t *propiter, *valiter;
+ scf_propertygroup_t *pg;
+ scf_property_t *prop;
+ scf_value_t *val;
+ char **protolist = NULL, *pnamebuf, *valbuf;
+ ssize_t pnamelen, vallen;
+ int numvalues = 0;
+ int propiterret, valiterret, retval = 0;
+
+ /* Services with no "protocol" property are not routing daemons */
+ if (ra_get_prop_as_string(h, inst, RA_PG_ROUTEADM, RA_PROP_PROTO,
+ B_TRUE, B_FALSE, NULL, &numvalues, &protolist) == -1) {
+ if (scf_error() == SCF_ERROR_NOT_FOUND)
+ (void) fprintf(stderr,
+ gettext("%s: %s is not a routing daemon service\n"),
+ myname, inst_fmri);
+ else
+ (void) fprintf(stderr,
+ gettext("%s: unexpected libscf error: %s\n"),
+ myname, scf_strerror(scf_error()));
+ ra_free_prop_values(numvalues, protolist);
+ return (-1);
+ }
+ ra_free_prop_values(numvalues, protolist);
+
+ if (ra_get_pg(h, inst, RA_PG_ROUTING, B_TRUE, B_FALSE, &pg) == -1) {
+ if (scf_error() == SCF_ERROR_NOT_FOUND) {
+ (void) printf("%s: no %s property group for %s\n",
+ myname, RA_PG_ROUTING, inst_fmri);
+ return (0);
+ }
+ (void) fprintf(stderr,
+ gettext("%s: unexpected libscf error: %s\n"),
+ myname, scf_strerror(scf_error()));
+ return (-1);
+ }
+
+ (void) printf("%s:\n", inst_fmri);
+
+ /* Create an iterator to walk through all properties */
+ if ((propiter = scf_iter_create(h)) == NULL ||
+ (prop = scf_property_create(h)) == NULL ||
+ scf_iter_pg_properties(propiter, pg) != 0) {
+ (void) fprintf(stderr, gettext
+ ("%s: could not iterate through properties for %s: %s\n"),
+ myname, inst_fmri, scf_strerror(scf_error()));
+ }
+ while ((propiterret = scf_iter_next_property(propiter, prop)) == 1) {
+ if ((pnamelen = scf_property_get_name(prop, NULL, 0) + 1)
+ == 0) {
+ (void) fprintf(stderr, gettext("%s: could not retrieve "
+ "property name for instance %s: %s\n"), myname,
+ inst_fmri, scf_strerror(scf_error()));
+ retval = -1;
+ break;
+ }
+ if ((pnamebuf = malloc(pnamelen)) == NULL) {
+ (void) fprintf(stderr,
+ gettext("%s: out of memory\n"), myname);
+ retval = -1;
+ break;
+ }
+ (void) scf_property_get_name(prop, pnamebuf,
+ pnamelen);
+ (void) printf("\t%s = ", pnamebuf);
+ if ((valiter = scf_iter_create(h)) == NULL ||
+ (val = scf_value_create(h)) == NULL ||
+ scf_iter_property_values(valiter, prop)
+ != 0) {
+ (void) fprintf(stderr, gettext
+ ("%s: could not iterate through "
+ "properties for %s: %s\n"), myname, inst_fmri,
+ scf_strerror(scf_error()));
+ scf_value_destroy(val);
+ scf_iter_destroy(valiter);
+ free(pnamebuf);
+ retval = -1;
+ break;
+ }
+ while ((valiterret = scf_iter_next_value(valiter, val)) == 1) {
+ if ((vallen = scf_value_get_as_string
+ (val, NULL, 0) + 1) == 0) {
+ (void) fprintf(stderr, gettext
+ ("%s: could not retrieve "
+ "property value for instance %s, "
+ "property %s: %s\n"), myname, inst_fmri,
+ pnamebuf, scf_strerror(scf_error()));
+ retval = -1;
+ } else if ((valbuf = malloc(vallen)) == NULL) {
+ (void) fprintf(stderr,
+ gettext("%s: out of memory\n"), myname);
+ retval = -1;
+ }
+ if (retval == -1) {
+ scf_iter_destroy(valiter);
+ scf_value_destroy(val);
+ free(pnamebuf);
+ goto out;
+ }
+ (void) scf_value_get_as_string(val, valbuf, vallen);
+ (void) printf("%s ", valbuf);
+ free(valbuf);
+ }
+ (void) printf("\n");
+ scf_iter_destroy(valiter);
+ scf_value_destroy(val);
+ free(pnamebuf);
+ if (valiterret == -1) {
+ (void) fprintf(stderr,
+ gettext("%s: could not iterate through"
+ "properties for %s: %s\n"), myname, inst_fmri,
+ scf_strerror(scf_error()));
+ retval = -1;
+ break;
+ }
+ }
+out:
+ scf_iter_destroy(propiter);
+ scf_property_destroy(prop);
+ scf_pg_destroy(pg);
+ if (propiterret == -1)
+ (void) fprintf(stderr, gettext
+ ("%s: could not iterate through properties for %s: %s\n"),
+ myname, inst_fmri, scf_strerror(scf_error()));
+ return (retval);
+}
+
+/*
+ * Modify property with name stored in passed-in ra_prop_t to have
+ * the assocatied values. Only works for existing properties in
+ * the "routing" property group for routing daemon services, so all
+ * routing daemons should place configurable options in that group.
+ */
+static int
+ra_modify_props_cb(void *data, scf_walkinfo_t *wip)
+{
+ const char *inst_fmri = wip->fmri;
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ ra_prop_t *raprop = data;
+ int numvalues = 0;
+ char **protolist = NULL;
+
+ /* Services with no "protocol" property are not routing daemons */
+ if (ra_get_prop_as_string(h, inst, RA_PG_ROUTEADM, RA_PROP_PROTO,
+ B_TRUE, B_FALSE, NULL, &numvalues, &protolist) == -1) {
+ if (scf_error() == SCF_ERROR_NOT_FOUND)
+ (void) fprintf(stderr,
+ gettext("%s: %s is not a routing daemon service\n"),
+ myname, inst_fmri);
+ else
+ (void) fprintf(stderr,
+ gettext("%s: unexpected libscf error: %s\n"),
+ myname, scf_strerror(scf_error()));
+ ra_free_prop_values(numvalues, protolist);
+ return (-1);
+ }
+ ra_free_prop_values(numvalues, protolist);
+
+ if (ra_set_prop_from_string(h, inst, RA_PG_ROUTING, raprop->prop_name,
+ SCF_TYPE_INVALID, B_FALSE, raprop->prop_numvalues,
+ (const char **)raprop->prop_values) == -1)
+ return (-1);
+
+ (void) smf_refresh_instance(inst_fmri);
+ return (0);
+}
+
+/*
+ * Display FMRI, state for each routing daemon service.
+ */
+
+/* ARGSUSED0 */
+static int
+ra_print_state_cb(void *data, scf_walkinfo_t *wip)
+{
+ const char *inst_fmri = wip->fmri;
+ scf_instance_t *inst = wip->inst;
+ scf_handle_t *h = scf_instance_handle(inst);
+ char *inst_state, **protolist = NULL;
+ int numvalues = 0;
+
+ /* Ensure service is a routing daemon */
+ if (ra_get_prop_as_string(h, inst, RA_PG_ROUTEADM, RA_PROP_PROTO,
+ B_TRUE, B_FALSE, NULL, &numvalues, &protolist) == -1)
+ return (0);
+ ra_free_prop_values(numvalues, protolist);
+
+ if ((inst_state = smf_get_state(inst_fmri)) == NULL) {
+ (void) fprintf(stderr,
+ gettext("%s: could not retrieve state for %s: %s\n"),
+ myname, inst_fmri, scf_strerror(scf_error()));
+ return (-1);
+ }
+ (void) printf("%27s %2s\n", inst_state, inst_fmri);
+ free(inst_state);
+
+ return (0);
+}
+
+static int
+ra_get_pg(scf_handle_t *h, scf_instance_t *inst, const char *pgname,
+ boolean_t composed, boolean_t required, scf_propertygroup_t **pg)
+{
+ /* Retrieve (possibly composed) property group for instance */
+ if ((*pg = scf_pg_create(h)) == NULL || (composed &&
+ scf_instance_get_pg_composed(inst, NULL, pgname, *pg) != 0) ||
+ (!composed && scf_instance_get_pg(inst, pgname, *pg) != 0)) {
+ if (scf_error() == SCF_ERROR_NOT_FOUND) {
+ if (required)
+ (void) fprintf(stderr, gettext(
+ "%s: no such property group %s\n"),
+ myname, pgname);
+ return (-1);
+ }
+ if (required)
+ (void) fprintf(stderr, gettext(
+ "%s: unexpected libscf error: %s\n"), myname,
+ scf_strerror(scf_error()));
+ return (-1);
+ }
+ return (0);
+}
+
+static int
+ra_get_boolean_prop(scf_handle_t *h, scf_instance_t *inst,
+ const char *pgname, const char *propname, boolean_t composed,
+ boolean_t required, boolean_t *val)
+{
+ char *valstr;
+
+ if (ra_get_single_prop_as_string(h, inst, pgname, propname,
+ composed, required, NULL, &valstr) != 0)
+ return (-1);
+ *val = strcmp(valstr, RA_PROPVAL_BOOLEAN_TRUE) == 0;
+ free(valstr);
+ return (0);
+}
+
+static int
+ra_get_single_prop_as_string(scf_handle_t *h, scf_instance_t *inst,
+ const char *pgname, const char *propname, boolean_t composed,
+ boolean_t required, scf_type_t *type, char **value)
+{
+ char **values;
+ int numvalues = 1;
+
+ if (ra_get_prop_as_string(h, inst, pgname, propname, composed, required,
+ type, &numvalues, &values) == -1)
+ return (-1);
+ *value = values[0];
+ free(values);
+ return (0);
+}
+
+/*
+ * Retrieve property named in propname, possibly using the composed
+ * property group view (union of instance and service-level properties,
+ * where instance-level properties override service-level values).
+ */
+static int
+ra_get_prop_as_string(scf_handle_t *h, scf_instance_t *inst,
+ const char *pgname, const char *propname, boolean_t composed,
+ boolean_t required, scf_type_t *type, int *numvalues, char ***values)
+{
+ scf_propertygroup_t *pg = NULL;
+ scf_property_t *prop = NULL;
+ scf_iter_t *valiter = NULL;
+ scf_value_t *val = NULL;
+ ssize_t vallen = 0;
+ int valiterret, i, numvalues_retrieved, ret = 0;
+
+ if (ra_get_pg(h, inst, pgname, composed, required, &pg) == -1)
+ return (-1);
+
+ *values = NULL;
+ /*
+ * Retrieve values. All values routeadm needs to retrieve
+ * (bar those gathered by routeadm -l), are known to be single-valued.
+ */
+ if ((prop = scf_property_create(h)) == NULL)
+ goto error;
+ if (scf_pg_get_property(pg, propname, prop) != 0) {
+ *numvalues = 0;
+ if (scf_error() == SCF_ERROR_NOT_FOUND) {
+ if (required)
+ (void) fprintf(stderr, gettext(
+ "%s: property %s/%s not found\n"),
+ myname, pgname, propname);
+ ret = -1;
+ goto out;
+ }
+ goto error;
+ }
+ if ((val = scf_value_create(h)) == NULL &&
+ scf_property_get_value(prop, val) != 0 ||
+ (valiter = scf_iter_create(h)) == NULL ||
+ scf_iter_property_values(valiter, prop) != 0)
+ goto error;
+ /* retrieve each value */
+ for (numvalues_retrieved = 0;
+ (valiterret = scf_iter_next_value(valiter, val)) == 1;
+ numvalues_retrieved++) {
+ if ((vallen = scf_value_get_as_string
+ (val, NULL, 0) + 1) == 0)
+ goto error;
+ if ((*values = realloc(*values,
+ sizeof (*values) + sizeof (char *))) == NULL ||
+ ((*values)[numvalues_retrieved] = malloc(vallen)) == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%s: out of memory\n"), myname);
+ ret = -1;
+ goto out;
+ }
+ (void) scf_value_get_as_string(val,
+ (*values)[numvalues_retrieved], vallen);
+ }
+ if (valiterret == -1)
+ goto error;
+ /*
+ * if *numvalues != 0, it holds expected number of values. If a
+ * different number are found, it is an error.
+ */
+ if (*numvalues != 0 && *numvalues != numvalues_retrieved) {
+ (void) fprintf(stderr, gettext(
+ "%s: got %d values for property %s/%s, expected %d\n"),
+ myname, numvalues_retrieved, pgname, propname, *numvalues);
+ ret = -1;
+ goto out;
+ }
+ *numvalues = numvalues_retrieved;
+
+ /* Retrieve property type if required. */
+ if (type != NULL)
+ (void) scf_property_type(prop, type);
+
+ goto out;
+error:
+ if (scf_error() == SCF_ERROR_NOT_FOUND) {
+ (void) fprintf(stderr, gettext(
+ "%s: property %s not found"), myname, propname);
+ } else {
+ (void) fprintf(stderr, gettext(
+ "%s: unexpected libscf error: %s, "), myname);
+ }
+ for (i = 0; i < numvalues_retrieved; i++)
+ free((*values)[i]);
+ if (*values != NULL)
+ free(*values);
+
+ ret = -1;
+out:
+ if (val != NULL)
+ scf_value_destroy(val);
+ if (valiter != NULL)
+ scf_iter_destroy(valiter);
+ if (prop != NULL)
+ scf_property_destroy(prop);
+ if (pg != NULL)
+ scf_pg_destroy(pg);
+ return (ret);
+}
+
+static void
+ra_free_prop_values(int numvalues, char **values)
+{
+ int i;
+ if (values != NULL) {
+ for (i = 0; i < numvalues; i++)
+ free(values[i]);
+ free(values);
+ }
+}
+
+static int
+ra_set_boolean_prop(scf_handle_t *h, scf_instance_t *inst, const char *pgname,
+ const char *prop, boolean_t create, boolean_t propval)
+{
+ const char *val = propval ? RA_PROPVAL_BOOLEAN_TRUE :
+ RA_PROPVAL_BOOLEAN_FALSE;
+
+ return (ra_set_prop_from_string(h, inst, pgname, prop, SCF_TYPE_BOOLEAN,
+ create, 1, &val));
+}
+
+/*
+ * Set the property named in propname to the values passed in in the propvals
+ * array. Only create a new property if "create" is true.
+ */
+static int
+ra_set_prop_from_string(scf_handle_t *h, scf_instance_t *inst,
+ const char *pgname, const char *propname, scf_type_t proptype,
+ boolean_t create, int numpropvals, const char **propvals)
+{
+ scf_propertygroup_t *instpg = NULL, *cpg = NULL;
+ scf_type_t oldproptype, newproptype = proptype;
+ scf_property_t *prop = NULL;
+ scf_value_t **values = NULL;
+ scf_transaction_t *tx = NULL;
+ scf_transaction_entry_t *ent = NULL;
+ boolean_t new = B_FALSE;
+ int i, retval, numvalues = 0, ret = 0;
+ char *pgtype = NULL, **ovalues;
+ ssize_t typelen;
+
+ /* Firstly, does property exist? If not, and create is false, bail */
+ if (ra_get_prop_as_string(h, inst, pgname, propname, B_TRUE,
+ B_FALSE, &oldproptype, &numvalues, &ovalues) == -1) {
+ if (scf_error() != SCF_ERROR_NOT_FOUND)
+ goto error;
+ if (!create) {
+ (void) fprintf(stderr, gettext(
+ "%s: no such property %s/%s\n"), myname, pgname,
+ propname);
+ return (-1);
+ }
+ } else
+ ra_free_prop_values(numvalues, ovalues);
+
+ /* Use old property type */
+ if (proptype == SCF_TYPE_INVALID)
+ newproptype = oldproptype;
+
+ /*
+ * Does property group exist at instance level? If not, we need to
+ * create it, since the composed view of the property group did
+ * contain the property. We never modify properties at the service
+ * level, as it`s possible that multiple instances will inherit those
+ * settings.
+ */
+ if (ra_get_pg(h, inst, pgname, B_FALSE, B_FALSE, &instpg) == -1) {
+ if (scf_error() != SCF_ERROR_NOT_FOUND)
+ goto error;
+ /* Ensure pg exists at service level, get composed pg */
+ if (ra_get_pg(h, inst, pgname, B_TRUE, B_FALSE, &cpg) == -1)
+ goto error;
+
+ /* Create instance-level property group */
+ if ((typelen = scf_pg_get_type(cpg, NULL, 0) + 1) == 0)
+ goto error;
+ if ((pgtype = malloc(typelen)) == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%s: out of memory\n"), myname);
+ goto error;
+ }
+ (void) scf_pg_get_type(cpg, pgtype, typelen);
+ if ((instpg = scf_pg_create(h)) == NULL ||
+ scf_instance_add_pg(inst, pgname, pgtype, 0, instpg)
+ == -1) {
+ (void) fprintf(stderr, gettext(
+ "%s: could not create property group %s\n"),
+ myname, pgname);
+ goto error;
+ }
+ }
+ if ((prop = scf_property_create(h)) == NULL)
+ goto error;
+ if ((values = calloc(numpropvals, sizeof (scf_value_t *))) == NULL) {
+ (void) fprintf(stderr, gettext("%s: out of memory"), myname);
+ goto error;
+ }
+ if (scf_pg_get_property(instpg, propname, prop) != 0) {
+ /* New property? */
+ if (scf_error() == SCF_ERROR_NOT_FOUND)
+ new = B_TRUE;
+ else
+ goto error;
+ }
+ if ((tx = scf_transaction_create(h)) == NULL ||
+ (ent = scf_entry_create(h)) == NULL)
+ goto error;
+retry:
+ if (scf_transaction_start(tx, instpg) == -1)
+ goto error;
+ if (new) {
+ if (scf_transaction_property_new(tx, ent, propname,
+ newproptype) == -1)
+ goto error;
+ } else if (scf_transaction_property_change(tx, ent, propname,
+ newproptype) == -1)
+ goto error;
+ for (i = 0; i < numpropvals; i++) {
+ if ((values[i] = scf_value_create(h)) == NULL ||
+ scf_value_set_from_string(values[i], newproptype,
+ propvals[i] == NULL ? "": propvals[i]) == -1 ||
+ scf_entry_add_value(ent, values[i]) != 0)
+ goto error;
+ }
+ retval = scf_transaction_commit(tx);
+ if (retval == 0) {
+ scf_transaction_reset(tx);
+ if (scf_pg_update(instpg) == -1)
+ goto error;
+ goto retry;
+ }
+ if (retval == -1)
+ goto error;
+ goto out;
+error:
+ switch (scf_error()) {
+ case SCF_ERROR_INVALID_ARGUMENT:
+ (void) fprintf(stderr, gettext(
+ "%s: invalid value for property %s/%s\n"), myname,
+ pgname, propname);
+ break;
+ case SCF_ERROR_NOT_FOUND:
+ (void) fprintf(stderr, gettext(
+ "%s: no such property %s/%s\n"), myname,
+ pgname, propname);
+ break;
+ default:
+ (void) fprintf(stderr, gettext(
+ "%s: unexpected libscf error: %s\n"), myname,
+ scf_strerror(scf_error()));
+ break;
+ }
+ ret = -1;
+out:
+ if (tx != NULL)
+ scf_transaction_destroy(tx);
+ if (ent != NULL)
+ scf_entry_destroy(ent);
+ if (values != NULL) {
+ for (i = 0; i < numpropvals; i++) {
+ if (values[i] != NULL)
+ scf_value_destroy(values[i]);
+ }
+ free(values);
+ }
+ if (prop != NULL)
+ scf_property_destroy(prop);
+ if (cpg != NULL)
+ scf_pg_destroy(cpg);
+ if (instpg != NULL)
+ scf_pg_destroy(instpg);
+ if (pgtype != NULL)
+ free(pgtype);
+ return (ret);
+}
+
+/*
+ * This function gathers configuration from the legacy /etc/inet/routing.conf,
+ * if any, and sets the appropriate variable values accordingly. Once
+ * these are set, the legacy daemons are checked to see if they have
+ * SMF counterparts (ra_check_legacy_daemons()). If they do, the
+ * configuration is upgraded. Finally, the legacy option settings are
+ * applied, enabling/disabling the routing/forwarding services as
+ * appropriate.
+ */
+static int
+ra_upgrade_from_legacy_conf(void)
+{
+ scf_handle_t *h = NULL;
+ scf_instance_t *inst = NULL;
+ int ret = 0, i, r;
+ boolean_t old_conf_read;
+ ravar_t *routing_svcs = ra_str2var(RA_VAR_ROUTING_SVCS);
+
+ /*
+ * First, determine if we have already upgraded - if "routing-conf-read"
+ * is true, we bail. The use of a boolean property indicating if
+ * routing.conf has been read and applied might seem a lot more
+ * work than simply copying routing.conf aside, but leaving the
+ * file in place allows users to downgrade and have their old
+ * routing configuration still in place.
+ */
+ if ((h = scf_handle_create(SCF_VERSION)) == NULL ||
+ scf_handle_bind(h) == -1) {
+ (void) fprintf(stderr, gettext(
+ "%s: cannot connect to SMF repository\n"), myname);
+ ret = -1;
+ goto out;
+ }
+ if ((inst = scf_instance_create(h)) == NULL ||
+ scf_handle_decode_fmri(h, RA_INSTANCE_ROUTING_SETUP,
+ NULL, NULL, inst, NULL, NULL, SCF_DECODE_FMRI_EXACT) == -1) {
+ (void) fprintf(stderr, gettext(
+ "%s: unexpected libscf error: %s\n"), myname,
+ scf_strerror(scf_error()));
+ ret = -1;
+ goto out;
+ }
+ if (ra_get_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_ROUTING_CONF_READ, B_TRUE, B_TRUE, &old_conf_read) == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ if (old_conf_read)
+ goto out;
+
+ /*
+ * Now set "routing-conf-read" to true so we don`t reimport legacy
+ * configuration again.
+ */
+ if (ra_set_boolean_prop(h, inst, RA_PG_ROUTEADM,
+ RA_PROP_ROUTING_CONF_READ, B_FALSE, B_TRUE) == -1)
+ return (-1);
+ (void) smf_refresh_instance(RA_INSTANCE_ROUTING_SETUP);
+
+ ra_resetvars(NULL);
+
+ /* First, gather values from routing.conf */
+ if ((r = ra_parseconf()) == -1) {
+ ret = -1;
+ goto out;
+ }
+ /* No routing.conf file found */
+ if (r == 0)
+ goto out;
+ /*
+ * Now, set the options/variables gathered. We set variables first,
+ * as we cannot enable routing before we determine the daemons
+ * to enable.
+ */
+
+ for (i = 0; ra_vars[i].var_name != NULL; i++) {
+ /* Skip routing-svcs var, not featured in legacy config */
+ if (strcmp(ra_vars[i].var_name, RA_VAR_ROUTING_SVCS) == 0)
+ continue;
+ if (ra_smf_cb(ra_set_persistent_var_cb, ra_vars[i].var_fmri,
+ &(ra_vars[i])) == -1) {
+ ret = -1;
+ goto out;
+ }
+ }
+ /* Clear routing-svcs value */
+ if (ra_smf_cb(ra_set_persistent_var_cb, routing_svcs->var_fmri,
+ routing_svcs) == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ if (ra_check_legacy_daemons() == -1) {
+ ret = -1;
+ goto out;
+ }
+
+ for (i = 0; ra_opts[i].opt_name != NULL; i++) {
+ if (ra_smf_cb(ra_set_persistent_opt_cb, ra_opts[i].opt_fmri,
+ &(ra_opts[i])) == -1 ||
+ ra_smf_cb(ra_set_default_opt_cb,
+ ra_opts[i].opt_default_fmri, &(ra_opts[i])) == -1) {
+ ret = -1;
+ break;
+ }
+ }
+out:
+ if (inst != NULL)
+ scf_instance_destroy(inst);
+ if (h != NULL)
+ scf_handle_destroy(h);
+
+ return (ret);
+}
+
+/*
+ * Parse the configuration file and fill the ra_opts array with opt_value
+ * and opt_default_value values, and the ra_vars array with var_value and
+ * var_default_value values. Then copy aside routing.conf so it will not
+ * be read by future invokations of routeadm.
+ */
+static int
+ra_parseconf(void)
+{
+ FILE *fp;
+ uint_t lineno;
+ char line[RA_MAX_CONF_LINE];
+ char *cp, *confstr;
+ raopt_t *raopt;
+ ravar_t *ravar;
+
+ if ((fp = fopen(RA_CONF_FILE, "r")) == NULL) {
+ /*
+ * There's no config file, so we simply return as there
+ * is no work to do.
+ */
+ return (0);
+ }
+
+ for (lineno = 1; fgets(line, sizeof (line), fp) != NULL; lineno++) {
+ if (line[strlen(line) - 1] == '\n')
+ line[strlen(line) - 1] = '\0';
+
+ cp = line;
+
+ /* Skip leading whitespace */
+ while (isspace(*cp))
+ cp++;
+
+ /* Skip comment lines and empty lines */
+ if (*cp == '#' || *cp == '\0')
+ continue;
+
+ /*
+ * Anything else must be of the form:
+ * <option> <value> <default_value>
+ */
+ if ((confstr = strtok(cp, " ")) == NULL) {
+ (void) fprintf(stderr,
+ gettext("%1$s: %2$s: invalid entry on line %3$d\n"),
+ myname, RA_CONF_FILE, lineno);
+ continue;
+ }
+
+ if ((raopt = ra_str2opt(confstr)) != NULL) {
+ if (ra_parseopt(confstr, lineno, raopt) != 0) {
+ (void) fclose(fp);
+ return (-1);
+ }
+ } else if ((ravar = ra_str2var(confstr)) != NULL) {
+ if (ra_parsevar(confstr, ravar) != 0) {
+ (void) fclose(fp);
+ return (-1);
+ }
+ } else {
+ (void) fprintf(stderr,
+ gettext("%1$s: %2$s: invalid option name on "
+ "line %3$d\n"),
+ myname, RA_CONF_FILE, lineno);
+ continue;
+ }
+ }
+
+ (void) fclose(fp);
+
+ return (1);
+}
+
+static int
+ra_parseopt(char *confstr, int lineno, raopt_t *raopt)
+{
+ oval_t oval, d_oval;
+
+ if ((confstr = strtok(NULL, " ")) == NULL) {
+ (void) fprintf(stderr,
+ gettext("%1$s: %2$s: missing value on line %3$d\n"),
+ myname, RA_CONF_FILE, lineno);
+ return (0);
+ }
+ if ((oval = ra_str2oval(confstr)) == OPT_INVALID) {
+ (void) fprintf(stderr,
+ gettext("%1$s: %2$s: invalid option "
+ "value on line %3$d\n"),
+ myname, RA_CONF_FILE, lineno);
+ return (0);
+ }
+ if (oval != OPT_DEFAULT)
+ raopt->opt_enabled = oval == OPT_ENABLED;
+
+ if ((confstr = strtok(NULL, " ")) == NULL) {
+ (void) fprintf(stderr,
+ gettext("%1$s: %2$s: missing revert "
+ "value on line %3$d\n"),
+ myname, RA_CONF_FILE, lineno);
+ return (0);
+ }
+ if ((d_oval = ra_str2oval(confstr)) == OPT_INVALID) {
+ (void) fprintf(stderr,
+ gettext("%1$s: %2$s: invalid revert "
+ "value on line %3$d\n"),
+ myname, RA_CONF_FILE, lineno, confstr);
+ return (0);
+ }
+ raopt->opt_default_enabled = d_oval == OPT_ENABLED;
+ if (oval == OPT_DEFAULT)
+ raopt->opt_enabled = d_oval == OPT_ENABLED;
+ return (0);
+}
+
+static int
+ra_parsevar(char *confstr, ravar_t *ravar)
+{
+ confstr = strtok(NULL, "=");
+ if (confstr == NULL) {
+ /*
+ * This isn't an error condition, it simply means that the
+ * variable has no value.
+ */
+ ravar->var_value = NULL;
+ return (0);
+ }
+
+ if ((ravar->var_value = strdup(confstr)) == NULL) {
+ (void) fprintf(stderr, gettext("%s: "
+ "unable to allocate memory\n"), myname);
+ return (-1);
+ }
+ return (0);
+}
+
+/* Convert a string to an option value. */
+static oval_t
+ra_str2oval(const char *valstr)
+{
+ if (strcmp(valstr, "enabled") == 0)
+ return (OPT_ENABLED);
+ else if (strcmp(valstr, "disabled") == 0)
+ return (OPT_DISABLED);
+ else if (strcmp(valstr, "default") == 0)
+ return (OPT_DEFAULT);
+ return (OPT_INVALID);
+}
+
+static raopt_t *
+ra_str2opt(const char *optnamestr)
+{
+ int i;
+
+ for (i = 0; ra_opts[i].opt_name != NULL; i++) {
+ if (strcmp(optnamestr, ra_opts[i].opt_name) == 0)
+ break;
+ }
+ if (ra_opts[i].opt_name == NULL)
+ return (NULL);
+ return (&ra_opts[i]);
+}
+
+/*
+ * Reset all option values previously gathered to B_FALSE.
+ */
+static void
+ra_resetopts(void)
+{
+ int i;
+
+ for (i = 0; ra_opts[i].opt_name != NULL; i++) {
+ ra_opts[i].opt_enabled = B_FALSE;
+ ra_opts[i].opt_default_enabled = B_FALSE;
+ }
+}
+
+static ravar_t *
+ra_str2var(const char *varnamestr)
+{
+ int i;
+ for (i = 0; ra_vars[i].var_name != NULL; i++) {
+ if (strcmp(varnamestr, ra_vars[i].var_name) == 0)
+ break;
+ }
+ if (ra_vars[i].var_name == NULL)
+ return (NULL);
+ return (&ra_vars[i]);
+}
+
+/*
+ * Reset variable values previously gathered to NULL.
+ */
+static void
+ra_resetvars(const char *proto)
+{
+ int i;
+ for (i = 0; ra_vars[i].var_name != NULL; i++) {
+ if (proto != NULL &&
+ !VAR_PROTO_MATCH(ra_vars[i].var_name, proto))
+ continue;
+ if (ra_vars[i].var_value != NULL)
+ free(ra_vars[i].var_value);
+ ra_vars[i].var_value = NULL;
+ if (ra_vars[i].var_default_value != NULL)
+ free(ra_vars[i].var_default_value);
+ ra_vars[i].var_default_value = NULL;
+ }
+}
+
+/*
+ * Given an option name, this function provides an internationalized, human
+ * readable version of the option name.
+ */
+static char *
+ra_intloptname(const char *optname)
+{
+ if (strcmp(optname, RA_OPT_IPV4_FORWARDING) == 0)
+ return (gettext("IPv4 forwarding"));
+ else if (strcmp(optname, RA_OPT_IPV4_ROUTING) == 0)
+ return (gettext("IPv4 routing"));
+ else if (strcmp(optname, RA_OPT_IPV6_FORWARDING) == 0)
+ return (gettext("IPv6 forwarding"));
+ else if (strcmp(optname, RA_OPT_IPV6_ROUTING) == 0)
+ return (gettext("IPv6 routing"));
+ else if (strcmp(optname, RA_VAR_IPV4_ROUTING_DAEMON) == 0)
+ return (gettext("IPv4 routing daemon"));
+ else if (strcmp(optname, RA_VAR_IPV4_ROUTING_DAEMON_ARGS) == 0)
+ return (gettext("IPv4 routing daemon args"));
+ else if (strcmp(optname, RA_VAR_IPV4_ROUTING_STOP_CMD) == 0)
+ return (gettext("IPv4 routing daemon stop"));
+ else if (strcmp(optname, RA_VAR_IPV6_ROUTING_DAEMON) == 0)
+ return (gettext("IPv6 routing daemon"));
+ else if (strcmp(optname, RA_VAR_IPV6_ROUTING_DAEMON_ARGS) == 0)
+ return (gettext("IPv6 routing daemon args"));
+ else if (strcmp(optname, RA_VAR_IPV6_ROUTING_STOP_CMD) == 0)
+ return (gettext("IPv6 routing daemon stop"));
+ else if (strcmp(optname, RA_VAR_ROUTING_SVCS) == 0)
+ return (gettext("Routing services"));
+ /*
+ * If we get here, there's a bug and someone should trip over this
+ * NULL pointer.
+ */
+ return (NULL);
+}
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-forwarding b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-forwarding
new file mode 100644
index 0000000000..fc9c5e3719
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-forwarding
@@ -0,0 +1,87 @@
+#!/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+# This script is the shared method script for the ipv4-routing, ipv6-routing,
+# ipv4-forwarding and ipv6-forwarding services.
+
+. /lib/svc/share/smf_include.sh
+
+set_forwarding_flag() {
+ proto="$1"
+ value="$2"
+ ndd_flag="0"
+ if [ "$value" = "enabled" ]; then
+ ndd_flag="1"
+ fi
+ if [ "$proto" = "ipv4" ]; then
+ /usr/sbin/ndd -set /dev/ip ip_forwarding $ndd_flag
+ else
+ /usr/sbin/ndd -set /dev/ip ip6_forwarding $ndd_flag
+ /usr/sbin/ndd -set /dev/ip ip6_send_redirects $ndd_flag
+ fi
+}
+
+usage() {
+ echo "Usage: $0 { start | stop | refresh } { ipv4 | ipv6 }"
+}
+
+numv6ifs=`/usr/sbin/ifconfig -au6 | /usr/bin/grep -c inet6`
+
+method="$1"
+proto="$2"
+
+if [ -z "$proto" ]; then
+ usage
+ exit $SMF_ERROR_FATAL
+fi
+
+case "$1" in
+'start' | 'refresh' )
+ smf_is_globalzone || exit $SMF_EXIT_OK
+ #
+ # Start ip forwarding.
+ #
+ if [ -z "$proto" ]; then
+ usage
+ exit $SMF_ERROR_FATAL
+ fi
+ if [ "$proto" = "ipv6" -a "$numv6ifs" = 0 ]; then
+ echo "Error: no IPv6 interface configured"
+ exit $SMF_EXIT_ERR_CONFIG
+ fi
+ set_forwarding_flag $proto enabled
+ ;;
+'stop')
+ set_forwarding_flag $proto disabled
+ ;;
+*)
+ usage
+ exit $SMF_ERROR_FATAL
+ ;;
+esac
+
+exit "$SMF_EXIT_OK"
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-legacy-routing b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-legacy-routing
new file mode 100644
index 0000000000..dcf8b39f40
--- /dev/null
+++ b/usr/src/cmd/cmd-inet/usr.sbin/routeadm/svc-legacy-routing
@@ -0,0 +1,84 @@
+#!/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+# This script is the shared method script for the legacy ipv4/ipv6
+# routing services.
+
+. /lib/svc/share/smf_include.sh
+
+daemon_prog=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon | \
+ /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
+ /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
+daemon_args=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon-args | \
+ /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
+ /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
+daemon_stop=`/usr/sbin/svccfg -s $SMF_FMRI listprop routeadm/daemon-stop-cmd | \
+ /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }' | \
+ /usr/bin/nawk '{ sub(/^\"/,""); sub(/\"[ \t]*$/,""); print }'`
+
+method="$1"
+proto="$2"
+
+case "$method" in
+'start' )
+ # No legacy daemon specified.
+ if [ -z "$daemon_prog" ]; then
+ echo "${proto}-routing-daemon not specified by routeadm."
+ exit $SMF_EXIT_ERR_CONFIG
+ fi
+ # No legacy stop command specified.
+ if [ -z "$daemon_stop" ]; then
+ echo "${proto}-routing-stop-cmd not specified by routeadm."
+ exit $SMF_EXIT_ERR_CONFIG
+ fi
+ smf_is_globalzone || exit $SMF_EXIT_OK
+
+ # Run daemon - fail if it does not successfully daemonize.
+ eval "$daemon_prog $daemon_args"
+ if [ "$?" != "0" ]; then
+ echo "Error: $daemon $daemon_args failed to daemonize."
+ exit $SMF_EXIT_ERR_FATAL
+ fi
+ # Create pidfile.
+ daemon_name=`/usr/bin/basename $daemon_prog`
+ /usr/bin/pgrep -P 1 -f $daemon_prog > /var/tmp/${daemon_name}.pid
+ ;;
+'stop' )
+ smf_is_globalzone || exit $SMF_EXIT_OK
+
+ # Stop daemon - ignore result.
+ if [ -n "$daemon_stop" ]; then
+ eval "$daemon_stop"
+ fi
+ ;;
+'*' )
+ echo "Usage: $0 { start | stop }"
+ exit $SMF_EXIT_ERR_FATAL
+ ;;
+esac
+
+exit "$SMF_EXIT_OK"
diff --git a/usr/src/cmd/consadm/Makefile b/usr/src/cmd/consadm/Makefile
index 0de3863ade..f42cfb26e1 100644
--- a/usr/src/cmd/consadm/Makefile
+++ b/usr/src/cmd/consadm/Makefile
@@ -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.
@@ -22,7 +21,7 @@
#
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# cmd/consadm/Makefile
@@ -30,13 +29,13 @@
PROG= consadm
MANIFEST= consadm.xml
+SVCMETHOD= svc-consadm
include ../Makefile.cmd
SUBDIRS= $(MACH)
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/svc-consadm
all := TARGET = all
install := TARGET = install
@@ -44,26 +43,17 @@ clean := TARGET = clean
clobber := TARGET = clobber
lint := TARGET = lint
-$(ROOTMANIFEST) := FILEMODE = 444
-
-$(ROOTMETHOD) := OWNER = root
-$(ROOTMETHOD) := GROUP = bin
-$(ROOTMETHOD) := FILEMODE = 0555
-
.KEEP_STATE:
all clean clobber lint: $(SUBDIRS)
-install: $(SUBDIRS) $(ROOTMANIFEST) $(ROOTMETHOD)
+install: $(SUBDIRS) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(CHKMANIFEST)
$(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
-
FRC:
include ../Makefile.targ
diff --git a/usr/src/cmd/coreadm/Makefile b/usr/src/cmd/coreadm/Makefile
index 7c0e3d872f..9ad8b9d5e0 100644
--- a/usr/src/cmd/coreadm/Makefile
+++ b/usr/src/cmd/coreadm/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -32,10 +31,6 @@ MANIFEST= coreadm.xml
include ../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE= 444
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
.KEEP_STATE:
diff --git a/usr/src/cmd/cvcd/Makefile b/usr/src/cmd/cvcd/Makefile
index 007905328c..8fcf5909b8 100644
--- a/usr/src/cmd/cvcd/Makefile
+++ b/usr/src/cmd/cvcd/Makefile
@@ -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.
@@ -22,7 +21,7 @@
#
# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Makefile definitions for Starfire Network Console related items.
@@ -49,8 +48,6 @@ clean := TARGET= clean
clobber := TARGET= clobber
lint := TARGET= lint
-$(ROOTMANIFEST) := FILEMODE = 444
-
.KEEP_STATE:
all lint clean clobber: $(SUBDIRS)
@@ -63,3 +60,5 @@ $(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/dcs/sparc/sun4u/Makefile b/usr/src/cmd/dcs/sparc/sun4u/Makefile
index 7f080d9de8..3025c763c9 100644
--- a/usr/src/cmd/dcs/sparc/sun4u/Makefile
+++ b/usr/src/cmd/dcs/sparc/sun4u/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -74,13 +73,11 @@ LINT_FILES= $(LINT_SRCS:%.c=%.ln)
POFILES= dcs_msg.po
-FILEMODE= 0755
-OWNER= root
-GROUP= bin
+$(ROOTLIBPROG) := FILEMODE= 0755
+$(ROOTLIBPROG) := OWNER= root
+$(ROOTLIBPROG) := GROUP= bin
ROOTMANIFESTDIR= $(ROOTSVCPLATFORMSUN4U)
-$(ROOTMANIFEST) := FILEMODE= 444
-$(ROOTSVCMETHOD) := FILEMODE= 555
#
# FLAGS:
diff --git a/usr/src/cmd/dispadmin/Makefile b/usr/src/cmd/dispadmin/Makefile
index 1d387242ab..883e8c94dc 100644
--- a/usr/src/cmd/dispadmin/Makefile
+++ b/usr/src/cmd/dispadmin/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -57,8 +56,6 @@ ROOTFSS= $(FSS:%=$(ROOTDIR)/FSS/%)
ROOTFX= $(FX:%=$(ROOTDIR)/FX/%)
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE = 0444
-
GROUP = bin
# this would be simpler if we renamed rtdispadmin.c and tsdispadmin.c
diff --git a/usr/src/cmd/dumpadm/Makefile b/usr/src/cmd/dumpadm/Makefile
index 108a0f9fe4..406f5dc3a0 100644
--- a/usr/src/cmd/dumpadm/Makefile
+++ b/usr/src/cmd/dumpadm/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -44,7 +43,6 @@ OWNER = root
GROUP = bin
ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE = 0444
LDLIBS += -ldiskmgt
diff --git a/usr/src/cmd/eeprom/Makefile b/usr/src/cmd/eeprom/Makefile
index 1f870ebe3e..47011aeb75 100644
--- a/usr/src/cmd/eeprom/Makefile
+++ b/usr/src/cmd/eeprom/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -44,8 +43,6 @@ PROG = eeprom
FILEMODE = 555
GROUP = sys
-$(ROOTMANIFEST) := FILEMODE = 444
-
.KEEP_STATE:
all install clean clobber lint : $(SUBDIRS)
diff --git a/usr/src/cmd/fs.d/nfs/svc/Makefile b/usr/src/cmd/fs.d/nfs/svc/Makefile
index f4ca4d63de..5a19370fcf 100644
--- a/usr/src/cmd/fs.d/nfs/svc/Makefile
+++ b/usr/src/cmd/fs.d/nfs/svc/Makefile
@@ -32,18 +32,14 @@ SVCMETHOD= nfs-server nfs-client nlockmgr
include $(SRC)/cmd/Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORKNFS)
-$(ROOTMANIFEST) := FILEMODE= 444
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
+all lint:
install: $(ROOTMANIFEST) $(ROOTSVCMETHOD)
clean:
$(RM) $(OBJS)
-all lint:
-
check: $(CHKMANIFEST)
include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/cmd/gss/gssd/Makefile b/usr/src/cmd/gss/gssd/Makefile
index 84484ffe7a..71283c15bd 100644
--- a/usr/src/cmd/gss/gssd/Makefile
+++ b/usr/src/cmd/gss/gssd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -58,7 +57,6 @@ CLOBBERFILES += $(TESTPROG)
include ../../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
TEXT_DOMAIN = SUNW_OST_NETRPC
POFILE = $(PROG).po
diff --git a/usr/src/cmd/intrd/Makefile b/usr/src/cmd/intrd/Makefile
index 880c8ffd47..69b37d03be 100644
--- a/usr/src/cmd/intrd/Makefile
+++ b/usr/src/cmd/intrd/Makefile
@@ -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.
@@ -21,7 +20,7 @@
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -38,7 +37,6 @@ include ../Makefile.cmd
TARGET= all
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE= 444
# install macros and rule
#
diff --git a/usr/src/cmd/ipf/svc/Makefile b/usr/src/cmd/ipf/svc/Makefile
index 403db5ce4e..c1caf8d2d1 100644
--- a/usr/src/cmd/ipf/svc/Makefile
+++ b/usr/src/cmd/ipf/svc/Makefile
@@ -31,20 +31,11 @@ SVCMETHOD= ipfilter
include $(SRC)/cmd/Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-$(ROOTMANIFEST) := FILEMODE= 444
-include $(SRC)/cmd/Makefile.targ
-
-all: $(OBJS)
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
-
-clean:
- $(RM) $(OBJS)
-
-lint: $(SRCS) lint_SRCS
+all clean lint:
install: $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(CHKMANIFEST)
+
+include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/cmd/kbd/Makefile b/usr/src/cmd/kbd/Makefile
index 2457008098..bcbebe4972 100644
--- a/usr/src/cmd/kbd/Makefile
+++ b/usr/src/cmd/kbd/Makefile
@@ -38,8 +38,6 @@ ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
PROG = kbd
CFLAGS += $(CCVERBOSE)
-$(ROOTMANIFEST) := FILEMODE = 0444
-
all: $(PROG)
install: all $(ROOTETCDEFAULTFILES) $(ROOTPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
diff --git a/usr/src/cmd/keyserv/Makefile b/usr/src/cmd/keyserv/Makefile
index 5dddafd644..f207a96db1 100644
--- a/usr/src/cmd/keyserv/Makefile
+++ b/usr/src/cmd/keyserv/Makefile
@@ -75,8 +75,6 @@ $(ROOTKEYSERVDFLT) := OWNER= root
$(ROOTKEYSERVDFLT) := GROUP= sys
$(ROOTKEYSERVDFLT) := FILEMODE= 444
-$(ROOTMANIFEST) := FILEMODE= 444
-
CPPFLAGS += -I. -I$(SRC)/lib/libnsl/include -I$(SRC)/lib/libsldap/common \
-D_REENTRANT
diff --git a/usr/src/cmd/krb5/kadmin/server/Makefile b/usr/src/cmd/krb5/kadmin/server/Makefile
index 7859e41284..3af7661ba9 100644
--- a/usr/src/cmd/krb5/kadmin/server/Makefile
+++ b/usr/src/cmd/krb5/kadmin/server/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -7,7 +7,7 @@
PROG= kadmind
MANIFEST= kadmin.xml
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/svc-kdc.master
+SVCMETHOD= svc-kdc.master
OBJS = kadm_rpc_svc.o server_stubs.o ovsec_kadmd.o misc.o server_glue_v1.o \
ipropd_svc.o
@@ -69,9 +69,8 @@ iprop_xdr.c: iprop.h $(KRB5IPROPDIR)/iprop.x
$(OBJS): iprop.h
$(KRB5LIBPROG):= FILEMODE = 0500
-$(ROOTMANIFEST):= FILEMODE = 0444
-install: $(KRB5LIBPROG) $(ROOTMETHOD) $(ROOTMANIFEST)
+install: $(KRB5LIBPROG) $(ROOTSVCMETHOD) $(ROOTMANIFEST)
check: $(CHKMANIFEST)
diff --git a/usr/src/cmd/krb5/krb5kdc/Makefile b/usr/src/cmd/krb5/krb5kdc/Makefile
index 6776fe261d..31df506c86 100644
--- a/usr/src/cmd/krb5/krb5kdc/Makefile
+++ b/usr/src/cmd/krb5/krb5kdc/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -7,7 +7,7 @@
PROG= krb5kdc
MANIFEST= krb5kdc.xml
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/svc-kdc
+SVCMETHOD= svc-kdc
OBJS = \
dispatch.o\
@@ -63,9 +63,8 @@ $(PROG): $(OBJS)
$(POST_PROCESS)
$(KRB5LIBPROG):= FILEMODE = 500
-$(ROOTMANIFEST):= FILEMODE = 444
-install: $(KRB5LIBPROG) $(ROOTMETHOD) $(ROOTMANIFEST)
+install: $(KRB5LIBPROG) $(ROOTSVCMETHOD) $(ROOTMANIFEST)
check: $(CHKMANIFEST)
diff --git a/usr/src/cmd/krb5/kwarn/Makefile b/usr/src/cmd/krb5/kwarn/Makefile
index 4503344ab0..e10faa3eaf 100644
--- a/usr/src/cmd/krb5/kwarn/Makefile
+++ b/usr/src/cmd/krb5/kwarn/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -25,7 +25,6 @@ include ../../Makefile.cmd
include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
ROOTMANIFESTDIR= $(ROOTSVCNETWORKSECURITY)
-$(ROOTMANIFEST) := FILEMODE= 444
POFILE = $(PROG).po
POFILES = generic.po
diff --git a/usr/src/cmd/krb5/slave/Makefile b/usr/src/cmd/krb5/slave/Makefile
index cde1437525..b6ec1fee90 100644
--- a/usr/src/cmd/krb5/slave/Makefile
+++ b/usr/src/cmd/krb5/slave/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -10,7 +10,7 @@ PROG2=kpropd
PROG3=kprop_script
PROG=$(PROG1) $(PROG2) $(PROG3)
MANIFEST= krb5_prop.xml
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/svc-kdc.slave
+SVCMETHOD= svc-kdc.slave
OBJS = \
kprop.o\
@@ -44,7 +44,6 @@ include ../../Makefile.cmd
include $(SRC)/lib/gss_mechs/mech_krb5/Makefile.mech_krb5
ROOTMANIFESTDIR= $(ROOTSVCNETWORKSECURITY)
-$(ROOTMANIFEST) := FILEMODE= 444
TEXT_DOMAIN = SUNW_OST_OSCMD
POFILE = kprop.po
@@ -89,7 +88,7 @@ iprop_xdr.c: iprop.h $(KRB5IPROPDIR)/iprop.x
$(KRB5LIB)/$(PROG3): $(PROG3)
$(OBJS): iprop.h
-install: $(KRB5LIBPROG) $(ROOTMETHOD) $(ROOTMANIFEST)
+install: $(KRB5LIBPROG) $(ROOTSVCMETHOD) $(ROOTMANIFEST)
check: $(CHKMANIFEST)
diff --git a/usr/src/cmd/ldapcachemgr/Makefile b/usr/src/cmd/ldapcachemgr/Makefile
index 6b4e86f223..4c72331f71 100644
--- a/usr/src/cmd/ldapcachemgr/Makefile
+++ b/usr/src/cmd/ldapcachemgr/Makefile
@@ -42,7 +42,6 @@ ROOTLDAPLIB= $(ROOT)/usr/lib/ldap
ROOTLDAPPROG= $(PROG:%=$(ROOTLDAPLIB)/%)
ROOTMANIFESTDIR= $(ROOTSVCNETWORKLDAP)
-$(ROOTMANIFEST) := FILEMODE= 444
OBJS= cachemgr.o cachemgr_getldap.o cachemgr_parse.o
diff --git a/usr/src/cmd/lp/cmd/lpsched/Makefile b/usr/src/cmd/lp/cmd/lpsched/Makefile
index 83ccf68d6c..e117393bb2 100644
--- a/usr/src/cmd/lp/cmd/lpsched/Makefile
+++ b/usr/src/cmd/lp/cmd/lpsched/Makefile
@@ -32,10 +32,9 @@ PROG= lpsched
include ../../Makefile.lp
MANIFEST= server.xml
+SVCMETHOD= print-svc
ROOTMANIFESTDIR= $(ROOTSVCAPPLICATIONPRINT)
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/print-svc
-$(ROOTMANIFEST) := FILEMODE= 444
PURIFYOPTS = -logfile=/tmp/errs.%p
PURIFY = purify $(PURIFYOPTS)
@@ -120,7 +119,7 @@ $(PROG).pure: $(OBJS) $(LPLIBS)
$(PURIFY) $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
$(POST_PROCESS)
-install: all $(ROOTLIBLPLOCLPROG) $(ROOTMANIFEST) $(ROOTMETHOD)
+install: all $(ROOTLIBLPLOCLPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(CHKMANIFEST)
@@ -129,15 +128,13 @@ check: $(CHKMANIFEST)
clean:
$(RM) $(OBJS)
-clobber: clean
- -$(RM) $(PROG) $(CLOBBERFILES)
-
strip:
$(STRIP) $(PROG)
-lint:
- $(LINT.c) $(SRCS) $(LDLIBS)
+lint: lint_SRCS
include ../Makefile.msg
FRC:
+
+include ../../../Makefile.targ
diff --git a/usr/src/cmd/lvm/md_monitord/Makefile b/usr/src/cmd/lvm/md_monitord/Makefile
index 5f8b6f6462..743b7db5b4 100644
--- a/usr/src/cmd/lvm/md_monitord/Makefile
+++ b/usr/src/cmd/lvm/md_monitord/Makefile
@@ -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.
@@ -22,7 +21,7 @@
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -34,7 +33,7 @@
PROG= mdmonitord
MANIFEST= mdmonitor.xml
-METHOD= svc-mdmonitor
+SVCMETHOD= svc-mdmonitor
include ../../Makefile.cmd
include ../Makefile.lvm
@@ -43,31 +42,25 @@ SUBDIRS= $(MACH)
SRCS= probedev.c md_monitord.c
-CLOBBERFILES += $(METHOD)
+CLOBBERFILES += $(SVCMETHOD)
#
-# i18n: For catalog we need to put messages from $(SRCS) and $(METHOD).sh into
-# "`basename $PWD`p.po" = md_monitordp.po = $(POFILE) (that's what ../Makefile
-# expects). We'll use $(BUILDPO.pofiles) to build $(POFILE) from $(MDPO) and
-# $(METHODPO), and we'll use $(BUILDPO.msgfiles) to build $(MDPO) from
-# $(SRCS). The catch is that $(BUILDPO.msgfiles) is defined to produce
-# $(POFILE). Fortunately we can conditionally define POFILE = MDPO when
-# building MDPO. make complains when this conditional definition is before we
-# include Makefile.msg.targ, so it must lie at the end.
+# i18n: For catalog we need to put messages from $(SRCS) and $(SVCMETHOD).sh
+# into "`basename $PWD`p.po" = md_monitordp.po = $(POFILE) (that's what
+# ../Makefile expects). We'll use $(BUILDPO.pofiles) to build $(POFILE) from
+# $(MDPO) and $(SVCMETHODPO), and we'll use $(BUILDPO.msgfiles) to build
+# $(MDPO) from $(SRCS). The catch is that $(BUILDPO.msgfiles) is defined to
+# produce $(POFILE). Fortunately we can conditionally define POFILE = MDPO
+# when building MDPO. make complains when this conditional definition is
+# before we include Makefile.msg.targ, so it must lie at the end.
#
MSGFILES= $(SRCS:%.c=%.i)
MDPO= $(PROG:%=%.po)
-METHODPO= $(METHOD:%=%.po)
-POFILES= $(MDPO) $(METHODPO)
+SVCMETHODPO= $(SVCMETHOD:%=%.po)
+POFILES= $(MDPO) $(SVCMETHODPO)
POFILE= md_monitordp.po
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST):= FILEMODE = 444
-
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/$(METHOD)
-$(ROOTMETHOD) := OWNER = root
-$(ROOTMETHOD) := GROUP = bin
-$(ROOTMETHOD) := FILEMODE = 0555
all := TARGET = all
install := TARGET = install
@@ -92,10 +85,7 @@ check: $(CHKMANIFEST)
clean: $(SUBDIRS)
$(RM) $(MSGFILES)
-install: $(SUBDIRS) $(ROOTMANIFEST) $(ROOTMETHOD)
- -$(RM) $(ROOTPROG)
-
-$(ROOTMETHOD): $(METHOD)
+install: $(SUBDIRS) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
$(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
diff --git a/usr/src/cmd/lvm/rpc.mdcommd/Makefile b/usr/src/cmd/lvm/rpc.mdcommd/Makefile
index 706803175e..fdbfe216a1 100644
--- a/usr/src/cmd/lvm/rpc.mdcommd/Makefile
+++ b/usr/src/cmd/lvm/rpc.mdcommd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -32,7 +31,6 @@ include ../../Makefile.cmd
include ../Makefile.lvm
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
SUBDIRS= $(MACH)
@@ -63,7 +61,6 @@ clean: $(SUBDIRS)
lint: $(SUBDIRS)
install: $(SUBDIRS) $(ROOTMANIFEST)
- -$(RM) $(ROOTPROG)
check: $(CHKMANIFEST)
diff --git a/usr/src/cmd/lvm/rpc.metad/Makefile b/usr/src/cmd/lvm/rpc.metad/Makefile
index bc19da2777..e94bd249df 100644
--- a/usr/src/cmd/lvm/rpc.metad/Makefile
+++ b/usr/src/cmd/lvm/rpc.metad/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -36,7 +35,6 @@ include ../../Makefile.cmd
include ../Makefile.lvm
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
SUBDIRS= $(MACH)
@@ -67,7 +65,6 @@ clean: $(SUBDIRS)
lint: $(SUBDIRS)
install: $(SUBDIRS) $(ROOTMANIFEST)
- -$(RM) $(ROOTPROG)
check: $(CHKMANIFEST)
diff --git a/usr/src/cmd/lvm/rpc.metamedd/Makefile b/usr/src/cmd/lvm/rpc.metamedd/Makefile
index e0c0adf003..4dfafbef59 100644
--- a/usr/src/cmd/lvm/rpc.metamedd/Makefile
+++ b/usr/src/cmd/lvm/rpc.metamedd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -30,17 +29,16 @@
#
# cmd/lvm/rpc.metamedd/Makefile
+MANIFEST = metamed.xml
+
include ../../Makefile.cmd
-MANIFEST = metamed.xml
ROOTMANIFESTDIR = $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE = 0444
SUBDIRS= $(MACH)
all := TARGET = all
install := TARGET = install
-check := TARGET = check
clean := TARGET = clean
clobber := TARGET = clobber
lint := TARGET = lint
@@ -57,3 +55,5 @@ $(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
FRC:
+
+include ../../Makefile.targ
diff --git a/usr/src/cmd/lvm/rpc.metamhd/Makefile b/usr/src/cmd/lvm/rpc.metamhd/Makefile
index 88e482a6ed..d67620219c 100644
--- a/usr/src/cmd/lvm/rpc.metamhd/Makefile
+++ b/usr/src/cmd/lvm/rpc.metamhd/Makefile
@@ -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.
@@ -22,7 +21,7 @@
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Makefile for logical volume management
@@ -39,7 +38,6 @@ include ../../Makefile.cmd
include ../Makefile.lvm
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
SUBDIRS= $(MACH)
@@ -59,7 +57,6 @@ clean: $(SUBDIRS)
clobber lint: $(SUBDIRS)
install: $(SUBDIRS) $(ROOTMANIFEST)
- -$(RM) $(ROOTPROG)
check: $(CHKMANIFEST)
diff --git a/usr/src/cmd/lvm/util/Makefile b/usr/src/cmd/lvm/util/Makefile
index 1c92f61356..fbeff3abd0 100644
--- a/usr/src/cmd/lvm/util/Makefile
+++ b/usr/src/cmd/lvm/util/Makefile
@@ -62,7 +62,6 @@ SVCMETHOD= svc-metainit \
svc-metasync
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST):= FILEMODE = 0444
SCRIPTS = \
$(GROWFSSCRIPT)
diff --git a/usr/src/cmd/nscd/Makefile b/usr/src/cmd/nscd/Makefile
index 7947b35380..f33dfac125 100644
--- a/usr/src/cmd/nscd/Makefile
+++ b/usr/src/cmd/nscd/Makefile
@@ -35,10 +35,6 @@ SVCMETHOD= svc-nscd
include ../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE= 444
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
OBJS= server.o getpw.o getgr.o gethost.o getnode.o \
getether.o getrpc.o getproto.o getnet.o \
diff --git a/usr/src/cmd/oplhpd/Makefile b/usr/src/cmd/oplhpd/Makefile
index 95a1ed39e9..c654d8c19f 100644
--- a/usr/src/cmd/oplhpd/Makefile
+++ b/usr/src/cmd/oplhpd/Makefile
@@ -46,16 +46,11 @@ ROOTMANIFESTDIR = $(ROOTSVCPLATFORMSUN4U)
CPPFLAGS += -I$(SRC)/uts/sun4u/opl
LDLIBS64 += -lsysevent -lnvpair -lcfgadm -ldevinfo
-FILEMODE = 0755
-OWNER = root
-GROUP = sys
-
-$(ROOTMANIFEST) := FILEMODE = 0444
-$(ROOTSVCMETHOD) := FILEMODE = 0555
-
PSMPROG = $(USR_PSM_LIB64_DIR)/$(PROG)
-
+$(PSMPROG) := FILEMODE = 0755
+$(PSMPROG) := OWNER = root
+$(PSMPROG) := GROUP = sys
.KEEP_STATE:
@@ -70,7 +65,7 @@ install: all $(PSMPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(CHKMANIFEST)
clean:
- $(RM) $(PROG) $(OBJS)
+ $(RM) $(OBJS)
lint: lint_SRCS
diff --git a/usr/src/cmd/picl/picld/Makefile b/usr/src/cmd/picl/picld/Makefile
index d43bc3d9e7..8790db44e2 100644
--- a/usr/src/cmd/picl/picld/Makefile
+++ b/usr/src/cmd/picl/picld/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,21 +27,11 @@
PROG= picld
-OBJS= picld.o
-
-SRCS= picld.c
-
MANIFEST= picl.xml
include ../../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE= 444
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
-
-TEXT_DOMAIN= SUNW_OST_OSCMD
ROOTLIBPICLD= $(ROOTLIB)/picl
ROOTLIBPICLDDAEMON= $(PROG:%=$(ROOTLIBPICLD)/%)
@@ -67,15 +56,11 @@ all: $(PROG)
install: all $(ROOTLIBPICLD) $(ROOTLIBPICLDDAEMON) $(ROOTMANIFEST)
-clobber:
-
check: $(CHKMANIFEST)
clean:
- $(RM) $(OBJS)
-lint:
- $(LINT.c) $(SRCS) $(LDLIBS)
+lint: lint_PROG
$(ROOTLIBPICLD):
$(INS.dir)
diff --git a/usr/src/cmd/power/Makefile b/usr/src/cmd/power/Makefile
index d1f6534bc7..9dd5337471 100644
--- a/usr/src/cmd/power/Makefile
+++ b/usr/src/cmd/power/Makefile
@@ -42,12 +42,12 @@ ETCFILES = power.conf
POWERPERM = power
DEFAULTFILES = power.dfl
-include ../Makefile.cmd
+MANIFEST= power.xml
+SVCMETHOD= svc-power
-MANIFEST = power.xml
+include ../Makefile.cmd
ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
-ROOTMETHOD = $(ROOTLIBSVCMETHOD)/svc-power
TEXT_DOMAIN= SUNW_OST_OSCMD
@@ -111,17 +111,10 @@ $(PMCFG_OBJS): pmconfig.h
$(PMCFG): $(PMCFG_OBJS)
$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
$(POST_PROCESS)
-$(ROOTSVCSYSTEM)/power.xml := OWNER = root
-$(ROOTSVCSYSTEM)/power.xml := GROUP = sys
-$(ROOTSVCSYSTEM)/power.xml := FILEMODE = 0444
-
-$(ROOTLIBSVCMETHOD)/svc-power := OWNER = root
-$(ROOTLIBSVCMETHOD)/svc-power := GROUP = bin
-$(ROOTLIBSVCMETHOD)/svc-power := FILEMODE = 0555
install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) \
$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
- $(ROOTMANIFEST) $(ROOTMETHOD)
+ $(ROOTMANIFEST) $(ROOTSVCMETHOD)
$(ROOTLIBPOWER):
$(INS.dir)
diff --git a/usr/src/cmd/print/gateway/Makefile b/usr/src/cmd/print/gateway/Makefile
index 59ecd07cae..6f1454ca44 100644
--- a/usr/src/cmd/print/gateway/Makefile
+++ b/usr/src/cmd/print/gateway/Makefile
@@ -27,14 +27,12 @@
# server/gateway/adaptor/Makefile
#
-include ../Makefile.sp
-
MANIFEST= rfc1179.xml cleanup.xml
-ROOTMANIFESTDIR= $(ROOTSVCAPPLICATIONPRINT)
-$(ROOTMANIFEST) := FILEMODE= 444
+SVCMETHOD= print-cleanup
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/print-cleanup
-$(ROOTLIBSVCMETHOD)/print-cleanup := FILEMODE=555
+include ../Makefile.sp
+
+ROOTMANIFESTDIR= $(ROOTSVCAPPLICATIONPRINT)
ROOTLIBPRINT= $(ROOTLIB)/print
$(ROOTLIBPRINT) := OWNER=root
@@ -51,6 +49,8 @@ INLPDSRCS= main.c adaptor.c
INLPDOBJS= $(INLPDSRCS:.c=.o)
$(INLPDPROG) := LDLIBS += -lsocket -lnsl $(LIBNPRT)
+PROG= $(PRINTDPROG) $(INLPDPROG)
+
SUBDIRS= translators
FILEMODE= 0555
@@ -76,7 +76,7 @@ ROOTLIBPRINTPROG= $(PRINTDPROG:%=$(ROOTLIBPRINT)/%) \
$(INLPDPROG:%=$(ROOTLIBPRINT)/%)
install: all $(ROOTLIBPRINTPROG) $(SUBDIRS) $(ROOTMANIFEST) \
- $(ROOTMETHOD) $(ROOTLIBPRINT)
+ $(ROOTSVCMETHOD) $(ROOTLIBPRINT)
check: $(CHKMANIFEST)
@@ -90,9 +90,11 @@ lint:
$(LINT.c) $(PRINTDSRCS) $(LDLIBS)
$(LINT.c) $(INLPDSRCS) $(LDLIBS)
-clean clobber: $(SUBDIRS)
+clean: $(SUBDIRS)
$(RM) $(PRINTDOBJS) $(INLPDOBJS)
+clobber: clean $(SUBDIRS)
+
_msg:
@echo "Messages are made in usr/src/cmd/print"
@@ -101,17 +103,4 @@ $(SUBDIRS): FRC
FRC:
-
-
-#
-# PRINTSYMLINK= $(ROOTLIB)/print/printd
-#
-# FILEMODE= 04511
-# OWNER= root
-#
-# CPPFLAGS += -I$(NPRTINC)
-# LDLIBS += $(LIBNPRT)
-#
-# install: all $(ROOTBIN) $(ROOTLIB)/print $(ROOTBINPROG) \
-# $(ROOTUSRBINSYMLINK) $(ROOTUSRUCBSYMLINK) $(PRINTSYMLINK) \
-# $(ROOTMANIFEST) $(ROOTMETHOD)
+include $(SRC)/cmd/Makefile.targ
diff --git a/usr/src/cmd/rexd/Makefile b/usr/src/cmd/rexd/Makefile
index 1964cfa4bd..a60d269936 100644
--- a/usr/src/cmd/rexd/Makefile
+++ b/usr/src/cmd/rexd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -37,7 +36,6 @@ MANIFEST= rex.xml
include ../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
SRCS= $(PROG:%=%.c)
diff --git a/usr/src/cmd/rpcbind/Makefile b/usr/src/cmd/rpcbind/Makefile
index 800f48d1df..d2540db6ad 100644
--- a/usr/src/cmd/rpcbind/Makefile
+++ b/usr/src/cmd/rpcbind/Makefile
@@ -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.
@@ -22,7 +21,7 @@
#
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# cmd/rpcbind/Makefile
@@ -42,7 +41,6 @@ SRCS= $(SRC1:selfcheck.c=../fs.d/nfs/lib/selfcheck.c)
include ../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST):= FILEMODE= 444
CPPFLAGS= -I. -DPORTMAP $(CPPFLAGS.master)
CPPFLAGS += -I$(ROOTSFWINCLUDE) -D_REENTRANT
@@ -62,10 +60,7 @@ selfcheck.o: ../fs.d/nfs/lib/selfcheck.c
$(COMPILE.c) ../fs.d/nfs/lib/selfcheck.c
$(POST_PROCESS_O)
-install: all $(DIRS) $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
-
-$(DIRS):
- $(INS.dir)
+install: all $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(CHKMANIFEST)
diff --git a/usr/src/cmd/rpcsvc/Makefile b/usr/src/cmd/rpcsvc/Makefile
index 34e3bf375b..02d143ac91 100644
--- a/usr/src/cmd/rpcsvc/Makefile
+++ b/usr/src/cmd/rpcsvc/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -61,7 +60,6 @@ DERIVED_FILES = rstat.x rstat.h rstat_svc.c rstat_v2.h rstat_v2_svc.c \
include ../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
CPPFLAGS= -I. $(CPPFLAGS.master)
LDLIBS += -lnsl
@@ -237,8 +235,7 @@ check: $(CHKMANIFEST)
clean: $(SUBDIRS)
-$(RM) $(OBJS) $(DERIVED_FILES)
-clobber: clean $(SUBDIRS)
- -$(RM) $(PROG) $(CLOBBERFILES)
+clobber: $(SUBDIRS)
lint:
$(LINT.c) $(WCLNTOBJS:%.o=%.c) -lnsl -lrpcsvc
@@ -246,3 +243,5 @@ lint:
$(LINT.c) rusers.c -lnsl -lrpcsvc
FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/rpcsvc/Makefile.rpc b/usr/src/cmd/rpcsvc/Makefile.rpc
index d1244aac94..1a74702e51 100644
--- a/usr/src/cmd/rpcsvc/Makefile.rpc
+++ b/usr/src/cmd/rpcsvc/Makefile.rpc
@@ -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.
@@ -22,7 +21,7 @@
#
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# cmd/rpcsvc/Makefile.rpc
@@ -30,9 +29,6 @@
#
# This Makefile is intended to be included by Makefiles describing
# the build of server daemon services implementing RPC protocols.
-# It initializes the service manifest installation directory macro
-# ROOTMANISERVERRPC to the correct values for such services.
-#
#
include $(SRC)/cmd/Makefile.cmd
@@ -40,12 +36,3 @@ include $(SRC)/cmd/Makefile.cmd
ROOTMANIRPC= $(ROOTSVCNETWORK)/rpc
ROOTMANIFESTDIR= $(ROOTMANIRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
-
-$(ROOTMANIRPC):
- $(INS.dir)
-
-$(ROOTMANIRPC)/%: %
- $(INS.file)
-
-$(ROOTMANIFEST): $(ROOTMANIFESTDIR)
diff --git a/usr/src/cmd/sa/Makefile b/usr/src/cmd/sa/Makefile
index a9670677e6..01fa461908 100644
--- a/usr/src/cmd/sa/Makefile
+++ b/usr/src/cmd/sa/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -28,12 +27,12 @@
# cmd/sa/Makefile
#
-include ../Makefile.cmd
-
MANIFEST = sar.xml
+SVCMETHOD = svc-sar
+
+include ../Makefile.cmd
ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
-ROOTMETHOD = $(ROOTLIBSVCMETHOD)/svc-sar
GREP= grep
@@ -97,7 +96,6 @@ $(ROOTBIN)/$(TIMEX) := GROUP = sys
# $(ROOTUSRSBIN)/$(SADP) := GROUP = sys
$(LIBSAD)/$(SADC) := FILEMODE = 0555
$(LIBSAD)/$(SADC) := GROUP = bin
-$(ROOTMANIFEST) := FILEMODE = 0444
.KEEP_STATE:
@@ -111,20 +109,12 @@ $(SADC): $(SADC_OBJECTS)
$(LINK.c) -o $@ $(SADC_OBJECTS) $(LDLIBS)
$(POST_PROCESS)
-$(ROOTSVCSYSTEM)/perf.xml := OWNER = root
-$(ROOTSVCSYSTEM)/perf.xml := GROUP = sys
-$(ROOTSVCSYSTEM)/perf.xml := FILEMODE = 0444
-
-$(ROOTLIBSVCMETHOD)/svc-perf := OWNER = root
-$(ROOTLIBSVCMETHOD)/svc-perf := GROUP = bin
-$(ROOTLIBSVCMETHOD)/svc-perf := FILEMODE = 0555
-
# The edit of SYSCRONTAB must be done unconditionally because of the
# creation of this file by a different component (Adm) and the possible
# backdating.
install: all $(ROOTPROG) $(ROOTUSBINPROG) \
$(ROOTINITSHELL) $(ROOTLIBSHELL) $(ROOTSYMLINKS) \
- $(ROOTMANIFEST) $(ROOTMETHOD) $(ROOTLIBPROG)
+ $(ROOTMANIFEST) $(ROOTSVCMETHOD) $(ROOTLIBPROG)
@if [ -f $(SYSCRONTAB) ]; \
then \
if $(GREP) "sa1" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
diff --git a/usr/src/cmd/saf/Makefile b/usr/src/cmd/saf/Makefile
index 0e5243a373..90f488bbc9 100644
--- a/usr/src/cmd/saf/Makefile
+++ b/usr/src/cmd/saf/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -28,10 +27,10 @@
PROG= sac sacadm pmadm
-include ../Makefile.cmd
-
MANIFEST = sac.xml
+include ../Makefile.cmd
+
ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
SACOBJ= sac.o readtab.o global.o log.o misc.o
@@ -67,10 +66,6 @@ sac := LDLIBS += -lpam
$(ROOTUSRSBIN)/sacadm := FILEMODE = 04755
-$(ROOTSVCSYSTEM)/sac.xml := OWNER = root
-$(ROOTSVCSYSTEM)/sac.xml := GROUP = sys
-$(ROOTSVCSYSTEM)/sac.xml := FILEMODE = 0444
-
$(LIBSAFD)/% : %
$(INS.file)
diff --git a/usr/src/cmd/sckmd/Makefile b/usr/src/cmd/sckmd/Makefile
index 83c86d6a93..712bb8b141 100644
--- a/usr/src/cmd/sckmd/Makefile
+++ b/usr/src/cmd/sckmd/Makefile
@@ -43,8 +43,6 @@ clean := TARGET= clean
clobber := TARGET= clobber
lint := TARGET= lint
-$(ROOTMANIFEST) := FILEMODE = 444
-
.KEEP_STATE:
all lint clean clobber: $(SUBDIRS)
@@ -57,3 +55,5 @@ $(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/sendmail/lib/Makefile b/usr/src/cmd/sendmail/lib/Makefile
index 3335510bf3..c1bf1e59d9 100644
--- a/usr/src/cmd/sendmail/lib/Makefile
+++ b/usr/src/cmd/sendmail/lib/Makefile
@@ -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,19 +19,20 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
+MANIFEST= smtp-sendmail.xml
+SVCMETHOD= smtp-sendmail
+
include ../../Makefile.cmd
SRCS= aliases helpfile local-host-names trusted-users
-MANIFEST= smtp-sendmail.xml
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/smtp-sendmail
ROOTETCMAIL = $(ROOTETC)/mail
ROOTETCMAILF = $(ROOTETCMAIL)/aliases $(ROOTETCMAIL)/helpfile \
@@ -45,20 +45,12 @@ ROOTETCMAILSYMLINKS = $(ROOTETCMAIL)/sendmail.hf
$(ROOTETCMAILF) := FILEMODE = 644
$(ROOTETCMAILF) := OWNER = root
-$(ROOTSVCNETWORK)/smtp-sendmail.xml := OWNER = root
-$(ROOTSVCNETWORK)/smtp-sendmail.xml := GROUP = sys
-$(ROOTSVCNETWORK)/smtp-sendmail.xml := FILEMODE = 0444
-
-$(ROOT)/lib/svc/method/smtp-sendmail := OWNER = root
-$(ROOT)/lib/svc/method/smtp-sendmail := GROUP = bin
-$(ROOT)/lib/svc/method/smtp-sendmail := FILEMODE = 0555
-
.KEEP_STATE:
all: $(SRCS)
install: all $(ROOTETCMAILF) $(ROOTETCSYMLINKS) \
- $(ROOTETCMAILSYMLINKS) $(ROOTMANIFEST) $(ROOTMETHOD)
+ $(ROOTETCMAILSYMLINKS) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(CHKMANIFEST)
@@ -76,3 +68,5 @@ $(ROOTETCSYMLINKS):
$(ROOTETCMAILSYMLINKS):
$(RM) $@; $(SYMLINK) helpfile $@
+
+include ../../Makefile.targ
diff --git a/usr/src/cmd/sf880drd/Makefile b/usr/src/cmd/sf880drd/Makefile
index 08b98aab46..cec3749477 100644
--- a/usr/src/cmd/sf880drd/Makefile
+++ b/usr/src/cmd/sf880drd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -42,15 +41,12 @@ ROOTMANIFESTDIR = $(ROOTSVCPLATFORMSUN4U)
CPPFLAGS += -I$(ROOT)/usr/platform/sun4u/include
LDLIBS += -lcfgadm
-FILEMODE = 0755
-OWNER = root
-GROUP = sys
-
-$(ROOTMANIFEST) := FILEMODE = 0444
-$(ROOTSVCMETHOD) := FILEMODE = 0555
-
PSMPROG = $(USR_PSM_LIB_DIR)/$(PROG)
+$(PSMPROG) := FILEMODE = 0755
+$(PSMPROG) := OWNER = root
+$(PSMPROG) := GROUP = sys
+
.KEEP_STATE:
all: $(PROG)
diff --git a/usr/src/cmd/smserverd/Makefile b/usr/src/cmd/smserverd/Makefile
index a27ac245bf..34597f4d15 100644
--- a/usr/src/cmd/smserverd/Makefile
+++ b/usr/src/cmd/smserverd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -43,7 +42,6 @@ ROOTLIBSMSERVERD= $(PROG:%=$(ROOTLIBSMSERVERDIR)/%)
include ../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORKRPC)
-$(ROOTMANIFEST) := FILEMODE= 444
LDLIBS += -lnsl -lbsm
diff --git a/usr/src/cmd/ssh/etc/Makefile b/usr/src/cmd/ssh/etc/Makefile
index b155fc6e7b..f163aafb90 100644
--- a/usr/src/cmd/ssh/etc/Makefile
+++ b/usr/src/cmd/ssh/etc/Makefile
@@ -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.
@@ -19,12 +18,15 @@
#
# CDDL HEADER END
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
+MANIFEST = ssh.xml
+SVCMETHOD = sshd
+
include ../../Makefile.cmd
include ../Makefile.ssh-common
@@ -39,11 +41,7 @@ $(ETCSSHFILES) := FILEMODE= 644
$(ETCSSHFILES) := OWNER= root
$(ETCSSHFILES) := GROUP= sys
-MANIFEST = ssh.xml
ROOTMANIFESTDIR = $(ROOTSVCNETWORK)
-SVCMETHOD = sshd
-
-$(ROOTMANIFEST) := FILEMODE = 0444
$(ETCSSHDIR)/% : %
$(INS.file)
@@ -58,3 +56,5 @@ all lint clean clobber _msg:
install: all $(DIRS) $(ETCSSHFILES) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(CHKMANIFEST)
+
+include ../../Makefile.targ
diff --git a/usr/src/cmd/stmsboot/Makefile b/usr/src/cmd/stmsboot/Makefile
index 8c3a04578a..fdb48b5c7d 100644
--- a/usr/src/cmd/stmsboot/Makefile
+++ b/usr/src/cmd/stmsboot/Makefile
@@ -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.
@@ -22,16 +21,18 @@
#
#ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
+MANIFEST = mpxio-upgrade.xml
+SVCMETHOD = mpxio-upgrade
+
include ../Makefile.cmd
SHFILES = stmsboot
SRCS = stmsboot_util.c
STMSBOOT_UTIL = stmsboot_util
-MANIFEST = mpxio-upgrade.xml
POFILES = $(SRCS:.c=.po) $(SHFILES:%=%.po)
POFILE = pstmsboot.po
@@ -39,9 +40,6 @@ CLOBBERFILES = $(SHFILES) $(STMSBOOT_UTIL) $(POFILE)
ROOTFSLIB_MPXIO = $(ROOT)/lib/mpxio
ROOTMANIFESTDIR= $(ROOTSVCPLATFORMSUN4U)
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/mpxio-upgrade
-
-$(ROOTMANIFEST) := FILEMODE = 0444
LDLIBS += -ldevinfo -lgen -ldevid
@@ -53,7 +51,7 @@ install: all \
$(ROOTFSLIB_MPXIO) \
$(ROOTFSLIB_MPXIO)/$(STMSBOOT_UTIL) \
$(ROOTMANIFEST) \
- $(ROOTMETHOD) \
+ $(ROOTSVCMETHOD) \
$(ROOTUSRSBIN)/stmsboot
check:
diff --git a/usr/src/cmd/svc/milestone/Makefile b/usr/src/cmd/svc/milestone/Makefile
index be0440da40..0b421f1825 100644
--- a/usr/src/cmd/svc/milestone/Makefile
+++ b/usr/src/cmd/svc/milestone/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -46,6 +45,7 @@ NETSVCS= \
network-initial.xml \
network-loopback.xml \
network-physical.xml \
+ network-routing-setup.xml \
network-service.xml
NETMANIFESTS= $(NETSVCS:%=$(ROOTSVCNETWORK)/%)
@@ -104,6 +104,7 @@ SVCMETHOD=\
net-loopback \
net-init \
net-physical \
+ net-routing-setup \
net-svc \
rmtmpfiles
diff --git a/usr/src/cmd/svc/milestone/fs-root b/usr/src/cmd/svc/milestone/fs-root
index 1672188383..cfbe472eb3 100644
--- a/usr/src/cmd/svc/milestone/fs-root
+++ b/usr/src/cmd/svc/milestone/fs-root
@@ -257,8 +257,6 @@ fi
#
/usr/sbin/devfsadm -I -P
-[ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing
-
libc_mount
libc_psr_mount
diff --git a/usr/src/cmd/svc/milestone/net-init b/usr/src/cmd/svc/milestone/net-init
index 7cbcb48089..5862c4edf6 100644
--- a/usr/src/cmd/svc/milestone/net-init
+++ b/usr/src/cmd/svc/milestone/net-init
@@ -26,79 +26,30 @@
# ident "%Z%%M% %I% %E% SMI"
#
# This is the second phase of TCP/IP configuration. The first part is
-# run by the /lib/svc/method/net-physical script (the svc:/network/physical
-# service) and includes configuring the interfaces and setting the machine's
-# hostname. This script (the svc:/network/initial service), does all
-# configuration that can be done before name services are started. This
-# includes configuring IP routing, and setting any tunable parameters.
-# The third part, run by the /lib/svc/method/net-svc script (the
-# svc:/network/service service), does all configuration that may require
-# name services. This includes a final re-configuration of the interfaces.
+# run by the svc:/network/physical service and includes configuring the
+# interfaces and setting the machine's hostname. The svc:/network/initial
+# service does all configuration that can be done before name services are
+# started, bar configuring IP routing (this is carried out by the
+# svc:/network/routing-setup service). The final part, run by the
+# svc:/network/service service, does all configuration that may require
+# name services. This includes a final re-configuration of the
+# interfaces.
#
. /lib/svc/share/smf_include.sh
-case "$1" in
-'start')
- #
- # In a zone we need this service to be up, but all of the work
- # it tries to do is irrelevant (and will actually lead to the service
- # failing if we try to do it), so just bail out.
- #
- smf_is_globalzone || exit $SMF_EXIT_OK
-
- ;; # Fall through -- rest of script is the initialization code
-
-'stop')
- smf_is_globalzone || exit $SMF_EXIT_OK
-
- #
- # If we were routing dynamically, we will note this with
- # the .dynamic_routing file, so that we can leave the routes
- # in place without thinking they're static route entries
- # when we come back into states 2 or 3.
- #
- if /usr/bin/pgrep -x -u 0 'in.routed|in.rdisc' >/dev/null 2>&1; then
- /usr/bin/pkill -z global -x -u 0 'in.routed|in.rdisc'
- > /etc/.dynamic_routing
- fi
- /usr/bin/pkill -z global -x -u 0 'in.ndpd|in.ripngd'
- exit $SMF_EXIT_OK
- ;;
-
-*)
- echo "Usage: $0 { start | stop }"
- exit 1
- ;;
-esac
+#
+# In a zone we need this service to be up, but all of the work
+# it tries to do is irrelevant (and will actually lead to the service
+# failing if we try to do it), so just bail out.
+#
+smf_is_globalzone || exit $SMF_EXIT_OK
# Configure IPv6 Default Address Selection.
if [ -f /etc/inet/ipaddrsel.conf ]; then
/usr/sbin/ipaddrsel -f /etc/inet/ipaddrsel.conf
fi
-/usr/sbin/ifconfig -a6u >/etc/svc/volatile/ifconfig.$$
-numv6ifs=`/usr/bin/grep -c inet6 /etc/svc/volatile/ifconfig.$$`
-if [ $numv6ifs -gt 1 ]; then
- #
- # Add a static route for multicast packets out of a link-local
- # interface, although would like to specify multicast interface using
- # an interface name!
- #
- set -- `/usr/bin/awk '
- /inet6 fe80:/ {
- print substr($2, 1, index($2, "/") - 1)
- }' /etc/svc/volatile/ifconfig.$$`
-
- if [ -n "$1" ]; then
- echo "Setting default IPv6 interface for multicast:" \
- "add net ff00::/8: gateway $1"
- /usr/sbin/route -n add -interface -inet6 "ff00::/8" "$1" \
- >/dev/null
- fi
-fi
-/usr/bin/rm -f /etc/svc/volatile/ifconfig.$$
-
#
# Now that /usr is mounted, see if in.mpathd needs to be started by firing it
# up in "adopt" mode; if there are no interfaces it needs to manage, it will
@@ -148,105 +99,6 @@ if [ $TCP_STRONG_ISS ]; then
fi
#
-# Configure default IPv4 routers using the local "/etc/defaultrouter"
-# configuration file. The file can contain the hostnames or IP
-# addresses of one or more default routers. If hostnames are used,
-# each hostname must also be listed in the local "/etc/hosts" file
-# because NIS and NIS+ are not running at the time that this script is
-# run. Each router name or address is listed on a single line by
-# itself in the file. Anything else on that line after the router's
-# name or address is ignored. Lines that begin with "#" are
-# considered comments and ignored.
-#
-# The default routes listed in the "/etc/defaultrouter" file will
-# replace those added by the kernel during diskless booting. An
-# empty "/etc/defaultrouter" file will cause the default route
-# added by the kernel to be deleted.
-#
-# Note that the default router file is ignored if we received routes
-# from a DHCP server. Our policy is to always trust DHCP over local
-# administration.
-#
-smf_netstrategy
-
-if [ "$_INIT_NET_STRATEGY" = "dhcp" ] && [ -n "`/sbin/dhcpinfo Router`" ]; then
- defrouters=`/sbin/dhcpinfo Router`
-elif [ -f /etc/defaultrouter ]; then
- defrouters=`/usr/bin/grep -v \^\# /etc/defaultrouter | \
- /usr/bin/awk '{print $1}'`
- if [ -n "$defrouters" ]; then
- #
- # We want the default router(s) listed in /etc/defaultrouter
- # to replace the one added from the BOOTPARAMS WHOAMI response
- # but we must avoid flushing the last route between the running
- # system and its /usr file system.
- #
-
- # First, remember the original route.
- shift $#
- set -- `/usr/bin/netstat -rn -f inet | /usr/bin/grep '^default'`
- route_IP="$2"
-
- #
- # Next, add those from /etc/defaultrouter. While doing this,
- # if one of the routes we add is for the route previously
- # added as a result of the BOOTPARAMS response, we will see
- # a message of the form:
- # "add net default: gateway a.b.c.d: entry exists"
- #
- do_delete=yes
- for router in $defrouters; do
- set -- `/usr/sbin/route -n add default -gateway $router`
- [ $? -ne 0 -a "x$5" = "x$route_IP:" ] && do_delete=no
- done
-
- #
- # Finally, delete the original default route unless it was
- # also listed in the defaultrouter file.
- #
- if [ -n "$route_IP" -a $do_delete = yes ]; then
- /usr/sbin/route -n delete default -gateway $route_IP \
- >/dev/null
- fi
- else
- /usr/sbin/route -fn > /dev/null
- fi
-else
- defrouters=
-fi
-
-#
-# Use routeadm(1M) to configure forwarding and launch routing daemons for
-# IPv4 and IPv6 based on preset values. These settings only apply to the
-# global zone. For IPv4 dynamic routing, the system will default to
-# disabled if a default route was previously added via BOOTP, DHCP, or
-# the /etc/defaultrouter file. routeadm also starts in.ndpd.
-#
-if [ ! -f /etc/.dynamic_routing ] && [ -z "$defrouters" ]; then
- #
- # No default routes were setup by "route" command above.
- # Check the kernel routing table for any other default
- # routes.
- #
- /usr/bin/netstat -rn -f inet | \
- /usr/bin/grep default >/dev/null 2>&1 && defrouters=yes
-fi
-[ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing
-if [ -z "$defrouters" ]; then
- routeadmstr="-e ipv4-routing"
-else
- routeadmstr="-d ipv4-routing"
-fi
-#
-# The -b option used here tells routeadm that the ipv4-routing
-# option in $routeadmstr is the boot-time default. The
-# boot-time default is used if the administrator has not
-# explicitly enabled or disabled ipv4-routing using the -e or
-# -d routeadm option.
-#
-/usr/sbin/routeadm -u -b $routeadmstr
-
-#
# In spite of global policy, there may be a need for IPsec because of
# per-socket policy or tunnelled policy. With that in mind, check for manual
# keys in /etc/inet/secret/ipseckeys, or check for IKE configuration in
@@ -338,31 +190,5 @@ if [ -n "$interface_names" ]; then
)
fi
-#
-# Set 6to4 Relay Router communication support policy and, if applicable,
-# the destination Relay Router IPv4 address. See /etc/default/inetinit for
-# setting and further info on ACCEPT6TO4RELAY and RELAY6TO4ADDR.
-# If ACCEPT6TO4RELAY=NO, the default value in the kernel will
-# be used.
-#
-ACCEPT6TO4RELAY=`echo "$ACCEPT6TO4RELAY" | /usr/bin/tr '[A-Z]' '[a-z]'`
-if [ "$ACCEPT6TO4RELAY" = yes ]; then
- if [ "$RELAY6TO4ADDR" ]; then
- /usr/sbin/6to4relay -e -a $RELAY6TO4ADDR
- else
- /usr/sbin/6to4relay -e
- fi
-fi
-
-#
-# Read /etc/inet/static_routes and add each route.
-#
-if [ -f /etc/inet/static_routes ]; then
- echo "Adding persistent routes:"
- /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes | while read line; do
- /usr/sbin/route add $line
- done
-fi
-
# Clear exit status.
exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/svc/milestone/net-loopback b/usr/src/cmd/svc/milestone/net-loopback
index 6275b8ebdf..9a23eb27b6 100644
--- a/usr/src/cmd/svc/milestone/net-loopback
+++ b/usr/src/cmd/svc/milestone/net-loopback
@@ -47,14 +47,12 @@ SUNW_NO_MPATHD=; export SUNW_NO_MPATHD
# default IP forwarding behavior. This will be the setting for
# interfaces that don't modify the per-interface setting with the
# router or -router ifconfig command in their /etc/hostname.<intf>
-# files. The -F option tells routeadm to only update the forwarding
-# configuration for the system, and not dynamic routing. We don't
-# want routing daemons started until later in the boot process (see
-# the net-init method for that).
+# files. Due to their dependency on this service, the IP forwarding services
+# will run at this point (though routing daemons will not run until later
+# in the boot process) and set forwarding flags.
#
-/sbin/routeadm -u -F
-# IPv4 loopback
+# ipV4 loopback
/sbin/ifconfig lo0 plumb 127.0.0.1 up
# Configure the v6 loopback if any IPv6 interfaces are configured.
diff --git a/usr/src/cmd/svc/milestone/net-routing-setup b/usr/src/cmd/svc/milestone/net-routing-setup
new file mode 100644
index 0000000000..9b1987fe05
--- /dev/null
+++ b/usr/src/cmd/svc/milestone/net-routing-setup
@@ -0,0 +1,237 @@
+#!/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+# This script configures IP routing.
+
+. /lib/svc/share/smf_include.sh
+
+#
+# In a zone we need this service to be up, but all of the work
+# it tries to do is irrelevant (and will actually lead to the service
+# failing if we try to do it), so just bail out.
+#
+smf_is_globalzone || exit $SMF_EXIT_OK
+
+#
+# If routing.conf file is in place, and has not already been read in
+# by previous invokation of routeadm, we run routeadm -u here to get
+# and apply legacy configuration. We also run "routeadm -u" when
+# a /var/svc/profile/upgrade file is found, as it may contain routeadm commands
+# which need to be applied. It would be nice if we could do this in
+# network/loopback, but since the SMF backend is read-only at that
+# point in boot, we cannot.
+#
+
+upgrade_routing_conf=""
+routing_conf_read=`/usr/bin/svcprop -p routeadm/routing-conf-read $SMF_FMRI`
+if [ -f /etc/inet/routing.conf -a "$routing_conf_read" = "false" ]; then
+ upgrade_routing_conf="true"
+fi
+if [ "$upgrade_routing_conf" = "true" -o -f /var/svc/profile/upgrade ]; then
+ /sbin/routeadm -u
+fi
+
+#
+# Are we routing dynamically? routeadm(1M) reports this in the
+# "current" values of ipv4/6-routing - if either are true, we are running
+# routing daemons (or at least they are enabled to run).
+#
+dynamic_routing_test=`/sbin/routeadm -p | \
+nawk '/^ipv[46]-routing [.]*/ { print $2 }' | /usr/bin/grep "current=enabled"`
+if [ -n "$dynamic_routing_test" ]; then
+ dynamic_routing="true"
+fi
+
+/usr/sbin/ifconfig -a6u >/etc/svc/volatile/ifconfig.$$
+numv6ifs=`/usr/bin/grep -c inet6 /etc/svc/volatile/ifconfig.$$`
+if [ $numv6ifs -gt 1 ]; then
+ #
+ # Add a static route for multicast packets out of a link-local
+ # interface, although would like to specify multicast interface using
+ # an interface name!
+ #
+ set -- `/usr/bin/awk '
+ /inet6 fe80:/ {
+ print substr($2, 1, index($2, "/") - 1)
+ }' /etc/svc/volatile/ifconfig.$$`
+
+ if [ -n "$1" ]; then
+ echo "Setting default IPv6 interface for multicast:" \
+ "add net ff00::/8: gateway $1"
+ /usr/sbin/route -n add -interface -inet6 "ff00::/8" "$1" \
+ >/dev/null
+ fi
+fi
+/usr/bin/rm -f /etc/svc/volatile/ifconfig.$$
+
+#
+# Configure default IPv4 routers using the local "/etc/defaultrouter"
+# configuration file. The file can contain the hostnames or IP
+# addresses of one or more default routers. If hostnames are used,
+# each hostname must also be listed in the local "/etc/hosts" file
+# because NIS and NIS+ are not running at the time that this script is
+# run. Each router name or address is listed on a single line by
+# itself in the file. Anything else on that line after the router's
+# name or address is ignored. Lines that begin with "#" are
+# considered comments and ignored.
+#
+# The default routes listed in the "/etc/defaultrouter" file will
+# replace those added by the kernel during diskless booting. An
+# empty "/etc/defaultrouter" file will cause the default route
+# added by the kernel to be deleted.
+#
+# Note that the default router file is ignored if we received routes
+# from a DHCP server. Our policy is to always trust DHCP over local
+# administration.
+#
+smf_netstrategy
+
+if [ "$_INIT_NET_STRATEGY" = "dhcp" ] && \
+ [ -n "`/sbin/dhcpinfo Router`" ]; then
+ defrouters=`/sbin/dhcpinfo Router`
+elif [ -f /etc/defaultrouter ]; then
+ defrouters=`/usr/bin/grep -v \^\# /etc/defaultrouter | \
+ /usr/bin/awk '{print $1}'`
+ if [ -n "$defrouters" ]; then
+ #
+ # We want the default router(s) listed in
+ # /etc/defaultrouter to replace the one added from the
+ # BOOTPARAMS WHOAMI response but we must avoid flushing
+ # the last route between the running system and its
+ # /usr file system.
+ #
+
+ # First, remember the original route.
+ shift $#
+ set -- `/usr/bin/netstat -rn -f inet | \
+ /usr/bin/grep '^default'`
+ route_IP="$2"
+
+ #
+ # Next, add those from /etc/defaultrouter. While doing
+ # this, if one of the routes we add is for the route
+ # previously added as a result of the BOOTPARAMS
+ # response, we will see a message of the form:
+ # "add net default: gateway a.b.c.d: entry exists"
+ #
+ do_delete=yes
+ for router in $defrouters; do
+ set -- `/usr/sbin/route -n add default \
+ -gateway $router`
+ [ $? -ne 0 -a "x$5" = "x$route_IP:" ] \
+ && do_delete=no
+ done
+
+ #
+ # Finally, delete the original default route unless it
+ # was also listed in the defaultrouter file.
+ #
+ if [ -n "$route_IP" -a $do_delete = yes ]; then
+ /usr/sbin/route -n delete default \
+ -gateway $route_IP >/dev/null
+ fi
+ else
+ /usr/sbin/route -fn > /dev/null
+ fi
+else
+ defrouters=
+fi
+
+#
+# Use routeadm(1M) to configure forwarding and launch routing daemons
+# for IPv4 and IPv6 based on preset values. These settings only apply
+# to the global zone. For IPv4 dynamic routing, the system will default
+# to disabled if a default route was previously added via BOOTP, DHCP,
+# or the /etc/defaultrouter file. routeadm also starts in.ndpd.
+#
+if [ "$dynamic_routing" != "true" ] && [ -z "$defrouters" ]; then
+ #
+ # No default routes were setup by "route" command above.
+ # Check the kernel routing table for any other default
+ # routes.
+ #
+ /usr/bin/netstat -rn -f inet | \
+ /usr/bin/grep default >/dev/null 2>&1 && defrouters=yes
+fi
+
+#
+# The routeadm/ipv4-routing-set property is true if the administrator
+# has run "routeadm -e/-d ipv4-routing". If not, we revert to the
+# appropriate defaults. We no longer run "routeadm -u" on every boot
+# however, as persistent daemon state is now controlled by SMF.
+#
+ipv4_routing_set=`/usr/bin/svcprop -p routeadm/ipv4-routing-set $SMF_FMRI`
+if [ -z "$defrouters" ]; then
+ #
+ # Set default value for ipv4-routing to enabled. If routeadm -e/-d
+ # has not yet been run by the administrator, we apply this default.
+ #
+ /usr/sbin/svccfg -s $SMF_FMRI \
+ setprop routeadm/default-ipv4-routing = true
+ if [ "$ipv4_routing_set" = "false" ]; then
+ /sbin/routeadm -e ipv4-routing -u
+ fi
+else
+ #
+ # Default router(s) have been found, so ipv4-routing default value
+ # should be disabled. If routaedm -e/d has not yet been run by
+ # the administrator, we apply this default.
+ /usr/sbin/svccfg -s $SMF_FMRI \
+ setprop routeadm/default-ipv4-routing = false
+ if [ "$ipv4_routing_set" = "false" ]; then
+ /sbin/routeadm -d ipv4-routing -u
+ fi
+fi
+
+#
+# Set 6to4 Relay Router communication support policy and, if applicable,
+# the destination Relay Router IPv4 address. See /etc/default/inetinit for
+# setting and further info on ACCEPT6TO4RELAY and RELAY6TO4ADDR.
+# If ACCEPT6TO4RELAY=NO, the default value in the kernel will
+# be used.
+#
+ACCEPT6TO4RELAY=`echo "$ACCEPT6TO4RELAY" | /usr/bin/tr '[A-Z]' '[a-z]'`
+if [ "$ACCEPT6TO4RELAY" = yes ]; then
+ if [ "$RELAY6TO4ADDR" ]; then
+ /usr/sbin/6to4relay -e -a $RELAY6TO4ADDR
+ else
+ /usr/sbin/6to4relay -e
+ fi
+fi
+
+#
+# Read /etc/inet/static_routes and add each route.
+#
+if [ -f /etc/inet/static_routes ]; then
+ echo "Adding persistent routes:"
+ /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes | while read line; do
+ /usr/sbin/route add $line
+ done
+fi
+
+# Clear exit status.
+exit $SMF_EXIT_OK
diff --git a/usr/src/cmd/svc/milestone/network-initial.xml b/usr/src/cmd/svc/milestone/network-initial.xml
index 5f106155f3..52c2c3cde3 100644
--- a/usr/src/cmd/svc/milestone/network-initial.xml
+++ b/usr/src/cmd/svc/milestone/network-initial.xml
@@ -1,15 +1,14 @@
<?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.
+ Copyright 2006 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.
@@ -57,19 +56,6 @@
<service_fmri value='svc:/system/filesystem/usr' />
</dependency>
- <!--
- This dependency was added to make sure soconfig runs in
- devices-local method, before routeadm invocation in net-init.
- This is because routeadm commands depend on sockets.
- -->
- <dependency
- name='devices'
- grouping='require_all'
- restart_on='none'
- type='service'>
- <service_fmri value='svc:/milestone/devices' />
- </dependency>
-
<dependency
name='cryptoframework'
grouping='optional_all'
@@ -81,13 +67,13 @@
<exec_method
type='method'
name='start'
- exec='/lib/svc/method/net-init start'
+ exec='/lib/svc/method/net-init'
timeout_seconds='600' />
<exec_method
type='method'
name='stop'
- exec='/lib/svc/method/net-init stop'
+ exec=':true'
timeout_seconds='3' />
<property_group name='startd' type='framework'>
@@ -105,8 +91,7 @@ initial network services
<description>
<loctext xml:lang='C'>
Initial network services includes
- configuring IP routing and setting any
- tunable parameters.
+ setting any tunable parameters.
</loctext>
</description>
<documentation>
diff --git a/usr/src/cmd/svc/milestone/network-physical.xml b/usr/src/cmd/svc/milestone/network-physical.xml
index e0a8eda24b..c491b04420 100644
--- a/usr/src/cmd/svc/milestone/network-physical.xml
+++ b/usr/src/cmd/svc/milestone/network-physical.xml
@@ -1,15 +1,14 @@
<?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.
+ Copyright 2006 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.
@@ -39,6 +38,15 @@
type='service'
version='1'>
+ <!-- ifconfig needs loopback for IPC with dhcpagent -->
+ <dependency
+ name='loopback'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/network/loopback' />
+ </dependency>
+
<instance name='default' enabled='true'>
<exec_method
diff --git a/usr/src/cmd/svc/milestone/network-routing-setup.xml b/usr/src/cmd/svc/milestone/network-routing-setup.xml
new file mode 100644
index 0000000000..daba3ca9b9
--- /dev/null
+++ b/usr/src/cmd/svc/milestone/network-routing-setup.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+ Copyright 2006 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 (the "License").
+ You may not use this file except in compliance with the License.
+
+ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ or http://www.opensolaris.org/os/licensing.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+
+ When distributing Covered Code, include this CDDL HEADER in each
+ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ If applicable, add the following below this CDDL HEADER, with the
+ fields enclosed by brackets "[]" replaced with your own identifying
+ information: Portions Copyright [yyyy] [name of copyright owner]
+
+ CDDL HEADER END
+
+ ident "%Z%%M% %I% %E% SMI"
+
+ NOTE: This service manifest is not editable; its contents will
+ be overwritten by package or patch operations, including
+ operating system upgrade. Make customizations in a different
+ file.
+-->
+
+<service_bundle type='manifest' name='SUNWcsr:routing-setup'>
+
+<service
+ name='network/routing-setup'
+ type='service'
+ version='1'>
+
+ <!-- loopback/physical network configuration is required -->
+ <dependency
+ name='network'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/network' />
+ </dependency>
+
+ <!-- usr filesystem required to run routing-related commands -->
+ <dependency
+ name='filesystem'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/usr' />
+ </dependency>
+
+ <!--
+ This dependency was added to make sure soconfig runs in
+ devices-local method, before routeadm invocation in
+ network/routing-setup. This is because routeadm commands
+ depend on sockets.
+ -->
+ <dependency
+ name='devices'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/devices' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/lib/svc/method/net-routing-setup'
+ timeout_seconds='600'>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':true'
+ timeout_seconds='3'>
+ </exec_method>
+
+ <property_group name='startd' type='framework'>
+ <propval name='duration' type='astring' value='transient' />
+ </property_group>
+
+ <instance name='default' enabled='true' >
+
+ <!-- Properties in this group are used by routeadm (1M) -->
+ <property_group name='routeadm' type='framework'>
+ <stability value='Evolving' />
+ <!-- set if routeadm -e/d ipv4-routing is explicitly invoked -->
+ <propval name='ipv4-routing-set' type='boolean'
+ value='false' />
+ <!-- set if routeadm -e/d ipv6-routing is explicitly invoked -->
+ <propval name='ipv6-routing-set' type='boolean'
+ value='false' />
+ <!-- set if legacy routing.conf configuration has been read -->
+ <propval name='routing-conf-read' type='boolean'
+ value='false' />
+ <!-- default for ipv4-routing to revert to via routeadm -r -->
+ <propval name='default-ipv4-routing' type='boolean'
+ value='false' />
+ <propval name='default-ipv6-routing' type='boolean'
+ value='false' />
+ <!-- routing-svcs values, current and default -->
+ <propval name='routing-svcs' type='astring'
+ value='route:default ripng:default' />
+ <propval name='default-routing-svcs' type='astring'
+ value='route:default ripng:default' />
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.value.routing' />
+ </property_group>
+
+ </instance>
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ Initial routing-related configuration.
+ </loctext>
+ </common_name>
+ <documentation>
+ <manpage title='routeadm' section='1M'
+ manpath='/usr/share/man' />
+ </documentation>
+ </template>
+</service>
+
+</service_bundle>
diff --git a/usr/src/cmd/svc/shell/routing_include.sh b/usr/src/cmd/svc/shell/routing_include.sh
new file mode 100644
index 0000000000..bccba88d11
--- /dev/null
+++ b/usr/src/cmd/svc/shell/routing_include.sh
@@ -0,0 +1,287 @@
+#!/bin/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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+#
+# These functions are used to help map daemon arguments to appropriate
+# routing properties and back, allowing legacy specifications of daemon
+# arguments to be reflected in SMF property values for daemon services.
+#
+
+#
+# set_routeadm_property inst_fmri propname propvalue
+#
+# Functions sets appropriate property value in routeadm property group
+# (via routeadm -m) for inst_fmri to propvalue.
+#
+set_routeadm_property()
+{
+ /sbin/routeadm -m $1 ${2}="${3}"
+}
+
+#
+# The functions below are used to map from daemon arguments to appropriate
+# routeadm properties (properties that the service user can manipulate
+# to control daemon functionality. getopts is used extensively to
+# retrieve options/values from argument list, and these option values
+# are used to set properties appropriately.
+#
+
+#
+# set_daemon_value_property inst_fmri optstring options option prop
+# default_value
+#
+# Function looks for option/value in argument string, and sets associated
+# property if found. If a default is specified, and the option is not
+# in the argument string, it will be used.
+#
+set_daemon_value_property()
+{
+ OPTIND=1
+ value_set=""
+ while getopts $3 opt $2; do
+ case $opt in
+ "$4" ) set_routeadm_property $1 $5 $OPTARG
+ value_set="true"
+ ;;
+ ? )
+ esac
+ done
+ # No value set - use default if specified.
+ if [ -z "$value_set" -a -n "$6" ]; then
+ set_routeadm_property $1 $5 $6
+ fi
+}
+
+#
+# set_daemon_ordered_multivalue_property inst_fmri optstring options option prop
+# default_value
+#
+# Function looks for option/values in argument string, and sets associated
+# property if found. If a default is specified, and the option is not
+# in the argument string, it will be used. Use ";" as delimiter for
+# multiple values.
+#
+set_daemon_ordered_multivalue_property()
+{
+ OPTIND=1
+ value_set=""
+ while getopts $3 opt $2; do
+ case $opt in
+ "$4" ) if [ -z "$value_set" ]; then
+ value_set="${OPTARG}"
+ else
+ value_set="$value_set;${OPTARG}"
+ fi
+ ;;
+ ? )
+ esac
+ done
+ if [ -n "$value_set" ]; then
+ set_routeadm_property $1 $5 "$value_set"
+ fi
+ # No value set - use default if specified.
+ if [ -z "$value_set" -a -n "$6" ]; then
+ set_routeadm_property $1 $5 $6
+ fi
+}
+
+#
+# set_daemon_boolean_property inst_fmri optstring options option
+# prop value_if_found default
+#
+# Function looks for option in argument string, and sets associated
+# property, if found, to value_if_found. If a default is specified, and
+# the option is not found, it will be used.
+#
+set_daemon_boolean_property()
+{
+ OPTIND=1
+ value_set=""
+ while getopts $3 opt $2; do
+ case $opt in
+ "$4" ) set_routeadm_property $1 $5 $6
+ value_set="true"
+ ;;
+ ? )
+ esac
+ done
+ # No value set - use default if specified.
+ if [ -z "$value_set" -a -n "$7" ]; then
+ set_routeadm_property $1 $5 $7
+ fi
+}
+
+#
+# set_daemon_nonoption_properties inst_fmri optstring options propnames
+# default
+#
+# Function looks past option list for addition values, and sets properties
+# specified in propnames to additional positional values. If no value
+# is found for additional property, default is used.
+#
+set_daemon_nonoption_properties()
+{
+ OPTIND=1
+ # Skip options
+ while getopts $3 opt $2; do
+ case $opt in
+ ? )
+ esac
+ done
+ pos=$OPTIND
+ for prop in $4
+ do
+ val=`/usr/bin/echo $2 | /usr/bin/nawk -v POS=$pos \
+ '{ print $POS }'`
+ if [ -z "$val" ]; then
+ val="$5"
+ fi
+ set_routeadm_property $1 $prop $val
+ pos=`expr $pos + 1`
+ done
+}
+
+#
+# get_daemon_args $inst_fmri
+#
+# Retrieves routeadm/daemon-args property values, if any. Removes
+# quotes around values including spaces.
+#
+get_daemon_args()
+{
+ args=`/usr/sbin/svccfg -s $1 listprop routeadm/daemon-args | \
+ /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf "%s ", $i }' | \
+ /usr/bin/nawk '{sub(/^\"/, ""); sub(/\"[ \t]*$/,""); print}'`
+ echo "$args"
+}
+
+#
+# clear_daemon_args $inst_fmri
+#
+# Blanks routeadm/daemon-args property used in upgrade.
+#
+clear_daemon_args()
+{
+ /usr/sbin/svccfg -s $1 delprop routeadm/daemon-args 2>/dev/null
+}
+
+#
+# The functions below are used to map back from property settings to
+# commandline arguments to launch daemons.
+#
+
+get_routeadm_property()
+{
+ propval=`/sbin/routeadm -l $1 | /usr/bin/nawk -v PROP=$2 \
+ '($1 == PROP) { for (i = 3; i < NF; i++) printf $i" "; \
+ if (NF >= 3) {printf $NF}}'`
+ echo "$propval"
+}
+
+#
+# get_daemon_option_from_boolean_property inst_fmri prop option value_set
+#
+# Returns appropriate daemon option for boolean property prop - if current
+# value matches value_set.
+#
+get_daemon_option_from_boolean_property()
+{
+ propval=`get_routeadm_property $1 $2`
+ if [ "$propval" = "$4" ]; then
+ echo "${3}"
+ fi
+}
+
+#
+# get_daemon_option_from_property inst_fmri prop option ignore_value
+#
+# Returns appropriate daemon option and associated value (unless value
+# matches ignore_value, in which case nothing is returned).
+#
+get_daemon_option_from_property()
+{
+ propval=`get_routeadm_property $1 $2`
+ if [ "$propval" != "$4" ]; then
+ echo "-${3} \"$propval\""
+ fi
+}
+
+#
+# get_daemon_ordered_multivalue_option_from_property_quoted inst_fmri prop
+# option
+#
+# Returns appropriate daemon option and associated values. Values are
+# quoted, i.e. -A "value1 has spaces" -A "value2 has spaces"
+#
+get_daemon_ordered_multivalue_option_from_property_quoted()
+{
+ # get property values, removing trailing delimiter.
+ propvals=`get_routeadm_property $1 $2 | \
+ /usr/bin/nawk '{sub(/;[ \t]*$/, ""); print }'`
+ # Substitute switch for internal delimiters, quoting values.
+ fixed_propvals=`/usr/bin/echo $propvals | \
+ /usr/bin/nawk -v SWITCH="\" -${3} \"" \
+ '{sub(/;/, SWITCH); print }'`
+ if [ -n "$fixed_propvals" ]; then
+ echo "-${3} \"$fixed_propvals\""
+ fi
+}
+
+#
+# get_daemon_ordered_multivalue_option_from_property inst_fmri prop
+# option
+#
+# Returns appropriate daemon option and associated values. Values are
+# unquoted, i.e. -A value1 -A value2
+#
+get_daemon_ordered_multivalue_option_from_property()
+{
+ # get property values, removing trailing delimiter.
+ propvals=`get_routeadm_property $1 $2 | \
+ /usr/bin/nawk '{sub(/;[ \t]*$/, ""); print }'`
+ # Substitute switch for internal delimiters.
+ fixed_propvals=`/usr/bin/echo $propvals | \
+ /usr/bin/nawk -v SWITCH=" -${3} " \
+ '{sub(/;/, SWITCH); print }'`
+ if [ -n "$fixed_propvals" ]; then
+ echo "-${3} $fixed_propvals"
+ fi
+}
+
+#
+# get_nonoption_property inst_fmri prop ignore_value
+#
+# Returns appropriate non-option property (at end of option list), unless
+# value matches ignore value, in which case nothing is returned.
+#
+get_daemon_nonoption_property()
+{
+ propval=`get_routeadm_property $1 $2`
+ if [ -n "$propval" -a "$propval" != "$3" ]; then
+ echo "$propval"
+ fi
+}
diff --git a/usr/src/cmd/syslogd/Makefile b/usr/src/cmd/syslogd/Makefile
index fc546d477e..14d5e44e60 100644
--- a/usr/src/cmd/syslogd/Makefile
+++ b/usr/src/cmd/syslogd/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -45,8 +44,6 @@ lint := TARGET = lint
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE = 0444
-
.KEEP_STATE:
all clean clobber lint: $(SUBDIRS)
@@ -61,4 +58,3 @@ $(SUBDIRS): FRC
FRC:
include ../Makefile.targ
-
diff --git a/usr/src/cmd/utmpd/Makefile b/usr/src/cmd/utmpd/Makefile
index 4b256151bb..1c623e6d50 100644
--- a/usr/src/cmd/utmpd/Makefile
+++ b/usr/src/cmd/utmpd/Makefile
@@ -27,20 +27,17 @@
PROG= utmpd
DEFAULTFILES= utmpd.dfl
+MANIFEST= utmp.xml
+SVCMETHOD= svc-utmpd
include ../Makefile.cmd
-MANIFEST = utmp.xml
ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
-SVCMETHOD = svc-utmpd
FILEMODE = 555
OWNER = root
GROUP = bin
-$(ROOTMANIFEST) := FILEMODE = 444
-$(ROOTMANIFEST) := GROUP = sys
-
.KEEP_STATE:
all: $(PROG)
diff --git a/usr/src/cmd/vntsd/Makefile b/usr/src/cmd/vntsd/Makefile
index 9cbd356516..efdc2d2bb9 100644
--- a/usr/src/cmd/vntsd/Makefile
+++ b/usr/src/cmd/vntsd/Makefile
@@ -30,22 +30,20 @@ SRCS = cmd.c common.c console.c listen.c queue.c read.c vntsd.c vntsdvcc.c \
write.c
OBJS = $(SRCS:.c=.o)
+MANIFEST = vntsd.xml
+SVCMETHOD = svc-vntsd
+
include ../Makefile.cmd
POFILES = $(SRCS:.c=.po)
POFILE = $(PROG)_msg.po
-MANIFEST = vntsd.xml
-SVCMETHOD = svc-vntsd
-
CFLAGS += $(CCVERBOSE)
LDLIBS += -lsocket -lnsl
ROOTCMDDIR = $(ROOTLIB)/ldoms
ROOTMANIFESTDIR = $(ROOTSVCPLATFORMSUN4V)
-$(ROOTMANIFEST) := FILEMODE = 0444
-
.KEEP_STATE:
diff --git a/usr/src/cmd/volmgt/etc/Makefile b/usr/src/cmd/volmgt/etc/Makefile
new file mode 100644
index 0000000000..69049abec0
--- /dev/null
+++ b/usr/src/cmd/volmgt/etc/Makefile
@@ -0,0 +1,66 @@
+#
+# 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 2006 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# Makefile for volume management files that go in /etc and /var/svc
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# cmd/volmgt/etc/Makefile
+
+MANIFEST = volfs.xml
+SVCMETHOD = svc-volfs
+
+include ../../Makefile.cmd
+
+ETCFILES= vold.conf rmmount.conf
+
+ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%)
+
+#
+# For some reason I have to set these modes explicitly otherwise
+# they end up executable.
+#
+$(ROOTETC)/vold.conf := FILEMODE = 0444
+$(ROOTETC)/rmmount.conf := FILEMODE = 0444
+$(ROOTETC)/vold.conf := OWNER = root
+$(ROOTETC)/rmmount.conf := OWNER = root
+
+ROOTMANIFESTDIR = $(ROOTSVCSYSTEMFILESYSTEM)
+
+.KEEP_STATE:
+
+all: $(ETCFILES)
+
+lint:
+
+cstyle:
+
+install: all $(ROOTETCFILES) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
+
+check: $(CHKMANIFEST)
+
+clean:
+
+clobber: clean
+
+include ../../Makefile.targ
diff --git a/usr/src/cmd/xntpd/xntpd/Makefile b/usr/src/cmd/xntpd/xntpd/Makefile
index c268435cb4..5aafa0f361 100644
--- a/usr/src/cmd/xntpd/xntpd/Makefile
+++ b/usr/src/cmd/xntpd/xntpd/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -7,17 +7,11 @@
PROG= xntpd
MANIFEST= ntp.xml
-
-all: $(PROG)
+SVCMETHOD= xntp
include ../../Makefile.cmd
ROOTMANIFESTDIR= $(ROOTSVCNETWORK)
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/xntp
-$(ROOTMANIFEST) := FILEMODE= 444
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
include ../Makefile.cmd
@@ -27,9 +21,11 @@ include ../Makefile.cmd
CLOBBERFILES = $(ROOTINETLIBPROG)
+all: $(PROG)
+
check: $(CHKMANIFEST)
-install: all $(ROOTINETLIBPROG) $(ROOTMANIFEST) $(ROOTMETHOD)
+install: all $(ROOTINETLIBPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
lint:
# lint: lint_PROG
diff --git a/usr/src/cmd/ypcmd/Makefile b/usr/src/cmd/ypcmd/Makefile
index 27206581a8..7c8ff59622 100644
--- a/usr/src/cmd/ypcmd/Makefile
+++ b/usr/src/cmd/ypcmd/Makefile
@@ -32,7 +32,7 @@ NETYPPROG = ypbind ypxfr yppush udpublickey mkalias \
ypxfr_1perday ypxfr_1perhour ypxfr_2perday \
ypstart ypstop
NIS2LDAPPROG = ypxfrd ypserv ypxfr
-METHOD = yp
+SVCMETHOD = yp
PROG= $(BINPROG) $(SBINPROG) $(NETYPPROG) $(NIS2LDAPPROG) $(METHOD)
MANIFEST = server.xml client.xml xfr.xml
@@ -40,7 +40,6 @@ MANIFEST = server.xml client.xml xfr.xml
include ../Makefile.cmd
ROOTMANIFESTDIR = $(ROOTSVCNETWORKNIS)
-ROOTMETHOD = $(ROOTLIBSVCMETHOD)/$(METHOD)
# installed directories
NETSVC = $(ROOTLIB)/netsvc
@@ -61,7 +60,6 @@ ypset := LDLIBS += -lnsl
$(ROOTVAR_YP)/aliases := GROUP=bin
$(ROOTVAR_YP)/aliases := FILEMODE=555
-$(ROOTMANIFEST) := FILEMODE = 0444
YPFILES = Makefile aliases nicknames updaters
ETCFILES = publickey
@@ -256,7 +254,7 @@ stdhosts: $(STDHOSTSOBJ)
install: all $(PROG) $(ROOTDIRS) $(ROOTETCFILE) $(ROOTYPFILES) $(IBINPROG) \
$(ISBINPROG) $(INETYPPROG) $(INIS2LDAPPROG) $(SUBDIRS) $(ROOTMANIFEST) \
- $(ROOTMETHOD)
+ $(ROOTSVCMETHOD)
$(ROOTDIRS):
$(INS.dir)
@@ -299,6 +297,7 @@ clean: $(SUBDIRS)
$(RM) $(OBJS) $(CLEANFILES)
clobber: clean $(SUBDIRS)
- $(RM) $(PROG)
FRC:
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/ypcmd/yppasswd/Makefile b/usr/src/cmd/ypcmd/yppasswd/Makefile
index caa961d575..50a54bc1f6 100644
--- a/usr/src/cmd/ypcmd/yppasswd/Makefile
+++ b/usr/src/cmd/ypcmd/yppasswd/Makefile
@@ -77,8 +77,6 @@ $(INETSVC) := FILEMODE=555
$(ETCDFLTFILE) := GROUP=sys
$(ETCDFLTFILE) := FILEMODE=0444
-$(ROOTMANIFEST) := FILEMODE = 0444
-
#install rules
.KEEP_STATE:
diff --git a/usr/src/cmd/ypcmd/ypupdated/Makefile b/usr/src/cmd/ypcmd/ypupdated/Makefile
index a6dcc0afa2..ad3c3513d3 100644
--- a/usr/src/cmd/ypcmd/ypupdated/Makefile
+++ b/usr/src/cmd/ypcmd/ypupdated/Makefile
@@ -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,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -59,8 +58,6 @@ SRCS = $(OBJS:%.o=%.c)
$(INETSVC) := GROUP=bin
$(INETSVC) := FILEMODE=555
-$(ROOTMANIFEST) := FILEMODE = 0444
-
#install rules
.KEEP_STATE:
diff --git a/usr/src/cmd/zoneadm/Makefile b/usr/src/cmd/zoneadm/Makefile
index 1fc67e678a..4d0f91a6f3 100644
--- a/usr/src/cmd/zoneadm/Makefile
+++ b/usr/src/cmd/zoneadm/Makefile
@@ -28,15 +28,11 @@
PROG= zoneadm
MANIFEST= zones.xml
+SVCMETHOD= svc-zones
include ../Makefile.cmd
-ROOTMETHOD= $(ROOTLIBSVCMETHOD)/svc-zones
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)
-$(ROOTMANIFEST) := FILEMODE= 444
-
-$(ROOTMANIFESTDIR)/%: %
- $(INS.file)
OBJS= zoneadm.o sw_cmp.o zfs.o
SRCS = $(OBJS:.o=.c)
@@ -53,7 +49,7 @@ $(PROG): $(OBJS)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
-install: all $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTMETHOD)
+install: all $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
check: $(PROG).c $(CHKMANIFEST)
$(CSTYLE) -pP $(SRCS:%=%)
@@ -63,6 +59,7 @@ $(POFILE): $(POFILES)
$(CAT) $(POFILES) > $@
clean:
+ $(RM) $(OBJS) $(POFILES)
lint: lint_SRCS
diff --git a/usr/src/lib/libdscp/svc/Makefile b/usr/src/lib/libdscp/svc/Makefile
index 8a34b10cca..8e995fa692 100644
--- a/usr/src/lib/libdscp/svc/Makefile
+++ b/usr/src/lib/libdscp/svc/Makefile
@@ -36,7 +36,6 @@ include ../../../cmd/Makefile.cmd
# definitions for installing the manifest
ROOTMANIFESTDIR = $(ROOTSVCPLATFORMSUN4U)
-$(ROOTMANIFEST) := FILEMODE = 0444
# definitions for installing the PPP options
OPTIONS = dscp.ppp.options
@@ -54,3 +53,5 @@ all clean clobber lint:
install: $(ROOTMANIFEST) $(ROOTSVCMETHOD) $(ROOTOPTIONS)
check: $(CHKMANIFEST)
+
+include ../../../cmd/Makefile.targ
diff --git a/usr/src/lib/libsecdb/auth_attr.txt b/usr/src/lib/libsecdb/auth_attr.txt
index 5a2ec0e67f..085d3eb463 100644
--- a/usr/src/lib/libsecdb/auth_attr.txt
+++ b/usr/src/lib/libsecdb/auth_attr.txt
@@ -90,12 +90,14 @@ solaris.smf.manage.cron:::Manage Cron Service States::help=SmfCronStates.html
solaris.smf.manage.hal:::Manage HAL Service States::help=SmfHALStates.html
solaris.smf.manage.name-service-cache:::Manage Name Service Cache Daemon Service States::help=SmfNscdStates.html
solaris.smf.manage.power:::Manage Power Management Service States::help=SmfPowerStates.html
+solaris.smf.manage.routing:::Manage Routing Service States::help=SmfRoutingStates.html
solaris.smf.manage.rmvolmgr:::Manage Rmvolmgr Service States::help=SmfRmvolmgrStates.html
solaris.smf.manage.rpc.bind:::Manage RPC Program number mapper::help=SmfRPCBind.html
solaris.smf.manage.sendmail:::Manage Sendmail Service States::help=SmfSendmailStates.html
solaris.smf.manage.ssh:::Manage Secure Shell Service States::help=SmfSshStates.html
solaris.smf.manage.system-log:::Manage Syslog Service States::help=SmfSyslogStates.html
solaris.smf.value.:::Change Values of SMF Service Properties::help=SmfValueHeader.html
+solaris.smf.value.routing:::Change Values of SMF Routing Properties::help=SmfValueRouting.html
#
solaris.system.:::Machine Administration::help=SysHeader.html
solaris.system.date:::Set Date & Time::help=SysDate.html
diff --git a/usr/src/lib/libsecdb/help/auths/Makefile b/usr/src/lib/libsecdb/help/auths/Makefile
index 13136a8691..70e85c8426 100644
--- a/usr/src/lib/libsecdb/help/auths/Makefile
+++ b/usr/src/lib/libsecdb/help/auths/Makefile
@@ -76,10 +76,12 @@ HTMLENTS = \
SmfModifyMethod.html \
SmfNscdStates.html \
SmfPowerStates.html \
+ SmfRoutingStates.html \
SmfSendmailStates.html \
SmfSshStates.html \
SmfSyslogStates.html \
SmfValueHeader.html \
+ SmfValueRouting.html \
NetworkHeader.html \
WifiConfig.html \
WifiWep.html
diff --git a/usr/src/lib/libsecdb/help/auths/SmfRoutingStates.html b/usr/src/lib/libsecdb/help/auths/SmfRoutingStates.html
new file mode 100644
index 0000000000..7c4d590dac
--- /dev/null
+++ b/usr/src/lib/libsecdb/help/auths/SmfRoutingStates.html
@@ -0,0 +1,40 @@
+<HTML>
+<!--
+ 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 2006 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+-->
+<!-- SCCS keyword
+#ident "%Z%%M% %I% %E% SMI"
+-->
+<!--
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+-->
+<BODY>
+When Manage Routing Service States is in the Authorizations Include
+column, it grants the authorization to enable, disable, or restart routing
+services.
+<p>
+If Manage Routing Service States is grayed, then you are not entitled
+to Add or Remove this authorization.
+<BR>&nbsp;
+</BODY>
+</HTML>
diff --git a/usr/src/lib/libsecdb/help/auths/SmfValueRouting.html b/usr/src/lib/libsecdb/help/auths/SmfValueRouting.html
new file mode 100644
index 0000000000..efb1e6d55f
--- /dev/null
+++ b/usr/src/lib/libsecdb/help/auths/SmfValueRouting.html
@@ -0,0 +1,40 @@
+<HTML>
+<!--
+ 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 2006 Sun Microsystems, Inc. All rights reserved.
+Use is subject to license terms.
+-->
+<!-- SCCS keyword
+#ident "%Z%%M% %I% %E% SMI"
+-->
+<!--
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+-->
+<BODY>
+When Value Routing Properties is in the Authorizations Include
+column, it grants the the authorization to change routing service property
+values.
+<P>
+If Value Routing Properties is grayed, then you are not entitled to
+Add or Remove this authorization.
+<BR>&nbsp;
+</BODY>
+</HTML>
diff --git a/usr/src/lib/libsecdb/prof_attr.txt b/usr/src/lib/libsecdb/prof_attr.txt
index cae7588282..70016e8cd2 100644
--- a/usr/src/lib/libsecdb/prof_attr.txt
+++ b/usr/src/lib/libsecdb/prof_attr.txt
@@ -49,7 +49,7 @@ Mail Management:::Manage sendmail & queues:auths=solaris.smf.manage.sendmail;hel
Maintenance and Repair:::Maintain and repair a system:auths=solaris.smf.manage.system-log;help=RtMaintAndRepair.html
Media Backup:::Backup files and file systems:help=RtMediaBkup.html
Media Restore:::Restore files and file systems from backups:help=RtMediaRestore.html
-Network Management:::Manage the host and network configuration:auths=solaris.smf.manage.name-service-cache,solaris.smf.manage.bind;profiles=Network Wifi Management;help=RtNetMngmnt.html
+Network Management:::Manage the host and network configuration:auths=solaris.smf.manage.name-service-cache,solaris.smf.manage.bind,solaris.smf.value.routing,solaris.smf.manage.routing;profiles=Network Wifi Management;help=RtNetMngmnt.html
Network Security:::Manage network and host security:auths=solaris.smf.manage.ssh;profiles=Network Wifi Security;help=RtNetSecure.html
Network Wifi Management:::Manage wifi network configuration:auths=solaris.network.wifi.config;help=RtNetWifiMngmnt.html
Network Wifi Security:::Manage wifi network security:auths=solaris.network.wifi.wep;help=RtNetWifiSecure.html
diff --git a/usr/src/pkgdefs/SUNW0on/prototype_com b/usr/src/pkgdefs/SUNW0on/prototype_com
index 18adeb0ff5..f79a1039c7 100644
--- a/usr/src/pkgdefs/SUNW0on/prototype_com
+++ b/usr/src/pkgdefs/SUNW0on/prototype_com
@@ -236,10 +236,12 @@ f none usr/lib/help/auths/locale/SmfModifyHeader.html 444 root bin
f none usr/lib/help/auths/locale/SmfModifyMethod.html 444 root bin
f none usr/lib/help/auths/locale/SmfNscdStates.html 444 root bin
f none usr/lib/help/auths/locale/SmfPowerStates.html 444 root bin
+f none usr/lib/help/auths/locale/SmfRoutingStates.html 444 root bin
f none usr/lib/help/auths/locale/SmfSendmailStates.html 444 root bin
f none usr/lib/help/auths/locale/SmfSshStates.html 444 root bin
f none usr/lib/help/auths/locale/SmfSyslogStates.html 444 root bin
f none usr/lib/help/auths/locale/SmfValueHeader.html 444 root bin
+f none usr/lib/help/auths/locale/SmfValueRouting.html 444 root bin
f none usr/lib/help/auths/locale/NetworkHeader.html 444 root bin
f none usr/lib/help/auths/locale/WifiConfig.html 444 root bin
f none usr/lib/help/auths/locale/WifiWep.html 444 root bin
diff --git a/usr/src/pkgdefs/SUNWcsr/prototype_com b/usr/src/pkgdefs/SUNWcsr/prototype_com
index eef2ff5e0b..be5acf70a4 100644
--- a/usr/src/pkgdefs/SUNWcsr/prototype_com
+++ b/usr/src/pkgdefs/SUNWcsr/prototype_com
@@ -348,12 +348,15 @@ f none lib/svc/method/manifest-import 0555 root bin
f none lib/svc/method/net-init 0555 root bin
f none lib/svc/method/net-loopback 0555 root bin
f none lib/svc/method/net-physical 0555 root bin
+f none lib/svc/method/net-routing-setup 0555 root bin
f none lib/svc/method/net-svc 0555 root bin
f none lib/svc/method/rmtmpfiles 0555 root bin
f none lib/svc/method/rpc-bind 0555 root bin
f none lib/svc/method/svc-auditd 0555 root bin
f none lib/svc/method/svc-consadm 0555 root bin
f none lib/svc/method/svc-cron 0555 root bin
+f none lib/svc/method/svc-forwarding 0555 root bin
+f none lib/svc/method/svc-legacy-routing 0555 root bin
f none lib/svc/method/svc-nscd 0555 root bin
f none lib/svc/method/svc-utmpd 0555 root bin
f none lib/svc/method/system-log 0555 root bin
@@ -366,6 +369,7 @@ d none lib/svc/share 0755 root bin
f none lib/svc/share/README 0444 root bin
f none lib/svc/share/fs_include.sh 0444 root bin
f none lib/svc/share/net_include.sh 0444 root bin
+f none lib/svc/share/routing_include.sh 0444 root bin
f none lib/svc/share/smf_include.sh 0444 root bin
d none mnt 755 root sys
d none opt 755 root sys
@@ -465,12 +469,16 @@ f manifest var/svc/manifest/milestone/network.xml 0444 root sys
f manifest var/svc/manifest/milestone/single-user.xml 0444 root sys
f manifest var/svc/manifest/milestone/sysconfig.xml 0444 root sys
d none var/svc/manifest/network 755 root sys
+f manifest var/svc/manifest/network/forwarding.xml 0444 root sys
f manifest var/svc/manifest/network/inetd.xml 0444 root sys
f manifest var/svc/manifest/network/inetd-upgrade.xml 0444 root sys
f manifest var/svc/manifest/network/network-initial.xml 0444 root sys
f manifest var/svc/manifest/network/network-loopback.xml 0444 root sys
f manifest var/svc/manifest/network/network-physical.xml 0444 root sys
+f manifest var/svc/manifest/network/network-routing-setup.xml 0444 root sys
f manifest var/svc/manifest/network/network-service.xml 0444 root sys
+d none var/svc/manifest/network/routing 755 root sys
+f manifest var/svc/manifest/network/routing/legacy-routing.xml 0444 root sys
d none var/svc/manifest/network/rpc 755 root sys
f manifest var/svc/manifest/network/rpc/bind.xml 0444 root sys
f manifest var/svc/manifest/network/rpc/keyserv.xml 0444 root sys
diff --git a/usr/src/pkgdefs/SUNWcsu/prototype_com b/usr/src/pkgdefs/SUNWcsu/prototype_com
index 28a4274825..65a9eac914 100644
--- a/usr/src/pkgdefs/SUNWcsu/prototype_com
+++ b/usr/src/pkgdefs/SUNWcsu/prototype_com
@@ -477,10 +477,12 @@ f none usr/lib/help/auths/locale/C/SmfModifyHeader.html 444 root bin
f none usr/lib/help/auths/locale/C/SmfModifyMethod.html 444 root bin
f none usr/lib/help/auths/locale/C/SmfNscdStates.html 444 root bin
f none usr/lib/help/auths/locale/C/SmfPowerStates.html 444 root bin
+f none usr/lib/help/auths/locale/C/SmfRoutingStates.html 444 root bin
f none usr/lib/help/auths/locale/C/SmfSendmailStates.html 444 root bin
f none usr/lib/help/auths/locale/C/SmfSshStates.html 444 root bin
f none usr/lib/help/auths/locale/C/SmfSyslogStates.html 444 root bin
f none usr/lib/help/auths/locale/C/SmfValueHeader.html 444 root bin
+f none usr/lib/help/auths/locale/C/SmfValueRouting.html 444 root bin
f none usr/lib/help/auths/locale/C/SysDate.html 444 root bin
f none usr/lib/help/auths/locale/C/SysHeader.html 444 root bin
f none usr/lib/help/auths/locale/C/SysShutdown.html 444 root bin
diff --git a/usr/src/pkgdefs/SUNWroute/Makefile b/usr/src/pkgdefs/SUNWroute/Makefile
index 2548812795..6aa73fd0c0 100644
--- a/usr/src/pkgdefs/SUNWroute/Makefile
+++ b/usr/src/pkgdefs/SUNWroute/Makefile
@@ -1,13 +1,15 @@
#
# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2000,2003 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
include ../Makefile.com
-DATAFILES= depend
+DATAFILES= i.manifest \
+ r.manifest \
+ depend
.KEEP_STATE:
@@ -16,4 +18,3 @@ all: $(FILES) copyright
install: all pkg
include ../Makefile.targ
-
diff --git a/usr/src/pkgdefs/SUNWroute/pkginfo.tmpl b/usr/src/pkgdefs/SUNWroute/pkginfo.tmpl
index 5f5a9dc23f..cc3d1848b1 100644
--- a/usr/src/pkgdefs/SUNWroute/pkginfo.tmpl
+++ b/usr/src/pkgdefs/SUNWroute/pkginfo.tmpl
@@ -23,7 +23,7 @@ DESC="Network Routing daemons/commands (Usr)"
VENDOR="Sun Microsystems, Inc."
HOTLINE="Please contact your local service provider"
EMAIL=""
-CLASSES="none"
+CLASSES="none manifest"
BASEDIR=/
SUNW_PKGVERS="1.0"
SUNW_PKG_ALLZONES="true"
diff --git a/usr/src/pkgdefs/SUNWroute/prototype_com b/usr/src/pkgdefs/SUNWroute/prototype_com
index cc6922a583..84604cafa6 100644
--- a/usr/src/pkgdefs/SUNWroute/prototype_com
+++ b/usr/src/pkgdefs/SUNWroute/prototype_com
@@ -1,5 +1,5 @@
#
-# Copyright 2000-2002 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -18,6 +18,8 @@
i pkginfo
i copyright
i depend
+i i.manifest
+i r.manifest
#
# source locations relative to the prototype file
#
@@ -32,3 +34,19 @@ d none usr/sbin 755 root bin
f none usr/sbin/in.rdisc 555 root bin
f none usr/sbin/in.routed 555 root bin
f none usr/sbin/rtquery 555 root bin
+d none lib 755 root bin
+d none lib/svc 0755 root bin
+d none lib/svc/method 0755 root bin
+f none lib/svc/method/svc-route 0555 root bin
+f none lib/svc/method/svc-ripng 0555 root bin
+f none lib/svc/method/svc-rdisc 0555 root bin
+f none lib/svc/method/svc-ndp 0555 root bin
+d none var 755 root sys
+d none var/svc 755 root sys
+d none var/svc/manifest 755 root sys
+d none var/svc/manifest/network 755 root sys
+d none var/svc/manifest/network/routing 755 root sys
+f manifest var/svc/manifest/network/routing/route.xml 0444 root sys
+f manifest var/svc/manifest/network/routing/ripng.xml 0444 root sys
+f manifest var/svc/manifest/network/routing/rdisc.xml 0444 root sys
+f manifest var/svc/manifest/network/routing/ndp.xml 0444 root sys