Print this page
NEX-15896 net-routing-setup should not enable in.routed
Contributed by: Alexander Pyhalov <alp@rsu.ru>
Reviewed by: Alexander Eremin <alexander.eremin@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
@@ -1,9 +1,7 @@
#!/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
@@ -15,14 +13,15 @@
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
-# CDDL HEADER END
+
#
-#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 Nexenta Systems, Inc.
+#
# This script configures IP routing.
. /lib/svc/share/smf_include.sh
@@ -46,21 +45,10 @@
# point in boot, we cannot.
#
/sbin/routeadm -u
#
-# 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
-
-#
# 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 is not running at the time that this script is
@@ -126,63 +114,37 @@
-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.
+# to disabled.
#
-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.
- # The -b option is project-private and informs routeadm not
- # to treat the enable as administrator-driven.
- #
- /usr/sbin/svccfg -s $SMF_FMRI \
- setprop routeadm/default-ipv4-routing = true
- if [ "$ipv4_routing_set" = "false" ]; then
- /sbin/routeadm -b -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. The -b option is
- # project-private and informs routeadm not to treat the disable as
- # administrator-driven.
- #
- /usr/sbin/svccfg -s $SMF_FMRI \
+
+#
+# Set default value for ipv4-routing to disabled. If routeadm -e/-d
+# has not yet been run by the administrator, we apply this default.
+# The -b option is project-private and informs routeadm not
+# to treat the enable as administrator-driven.
+#
+/usr/sbin/svccfg -s $SMF_FMRI \
setprop routeadm/default-ipv4-routing = false
- if [ "$ipv4_routing_set" = "false" ]; then
+if [ "$ipv4_routing_set" = "false" ]; then
/sbin/routeadm -b -d ipv4-routing -u
- fi
fi
#
# See if static routes were created by install. If so, they were created
# under /etc/svc/volatile. Copy them into their proper place.
@@ -195,11 +157,10 @@
else
cp /etc/svc/volatile/etc/inet/static_routes \
/etc/inet/static_routes
fi
/usr/bin/rm /etc/svc/volatile/etc/inet/static_routes
-
fi
#
# Read /etc/inet/static_routes and add each route.
#