diff options
Diffstat (limited to 'usr/src/cmd/svc/milestone/net-routing-setup')
-rw-r--r-- | usr/src/cmd/svc/milestone/net-routing-setup | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/usr/src/cmd/svc/milestone/net-routing-setup b/usr/src/cmd/svc/milestone/net-routing-setup index 5b65f90d91..3ac6a3f7aa 100644 --- a/usr/src/cmd/svc/milestone/net-routing-setup +++ b/usr/src/cmd/svc/milestone/net-routing-setup @@ -21,12 +21,16 @@ # # # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. +# +# Copyright (c) 2012 Joyent, Inc. All rights reserved. # Copyright (c) 2021 H. William Welliver # This script configures IP routing. . /lib/svc/share/smf_include.sh +set -o xtrace + # # In a shared-IP 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 @@ -82,6 +86,17 @@ fi smf_netstrategy # +# Read /etc/inet/static_routes.vmadm and add each link-local route. +# +if [ -f /etc/inet/static_routes.vmadm ]; then + echo "Adding vmadm persistent link-local routes:" + /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes.vmadm | + /usr/bin/grep -- "-interface " | while read line; do + /usr/sbin/route add $line + done +fi + +# # See if static routes were created by install. If so, they were created # under /etc/svc/volatile. Copy them into their proper place. # @@ -185,7 +200,8 @@ fi # 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 +smartos_param=`/usr/bin/bootparams | grep "^smartos"` +if [ -z "$defrouters" ] && [ "$smartos_param" != "" ]; 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. @@ -223,5 +239,22 @@ if [ -f /etc/inet/static_routes ]; then done fi +# +# Read /etc/inet/static_routes.vmadm and add each non-link-local route. +# +if [ -f /etc/inet/static_routes.vmadm ]; then + echo "Adding vmadm persistent routes:" + /usr/bin/egrep -v "^(#|$)" /etc/inet/static_routes.vmadm | + /usr/bin/grep -v -- "-interface " | while read line; do + /usr/sbin/route add $line + done +fi + +# +# Log the result +# +echo "Routing setup complete:" +/usr/bin/netstat -rn + # Clear exit status. exit $SMF_EXIT_OK |