2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22 #
23 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2012 Milan Jurik. All rights reserved.
25 #
26 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
27 # All rights reserved.
28 #
29
30 . /lib/svc/share/smf_include.sh
31 . /lib/svc/share/net_include.sh
32
33 #
34 # In a shared-IP zone we need this service to be up, but all of the work
35 # it tries to do is irrelevant (and will actually lead to the service
36 # failing if we try to do it), so just bail out.
37 # In the global zone and exclusive-IP zones we proceed.
38 #
39 smf_configure_ip || exit $SMF_EXIT_OK
40
41
42 # Make sure that the libraries essential to this stage of booting can be found.
43 LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
44
45 smf_netstrategy
46
47 if smf_is_globalzone; then
48 net_reconfigure || exit $SMF_EXIT_ERR_CONFIG
290 [ -n "$inet6_failed" ] && warn_failed_ifs "plumb IPv6" "$inet6_failed"
291 fi
292
293 #
294 # Create all of the IPv6 IPMP interfaces.
295 #
296 if [ -n "$ipmp6_list" ]; then
297 set -- $ipmp6_list
298 while [ $# -gt 0 ]; do
299 if /sbin/ifconfig $1 inet6 ipmp; then
300 ipmp6_created="$ipmp6_created $1"
301 else
302 ipmp6_failed="$ipmp6_failed $1"
303 fi
304 shift
305 done
306 [ -n "$ipmp6_failed" ] && warn_failed_ifs "create IPv6 IPMP" \
307 "$ipmp6_failed"
308 fi
309
310 #
311 # Finally configure interfaces set up with ipadm. Any /etc/hostname*.intf
312 # files take precedence over ipadm defined configurations except when
313 # we are in a non-global zone and Layer-3 protection of IP addresses is
314 # enforced on the interface by the global zone.
315 #
316 for showif_output in `/sbin/ipadm show-if -p -o ifname,state,current`; do
317 intf=`echo $showif_output | /usr/bin/cut -f1 -d:`
318 state=`echo $showif_output | /usr/bin/cut -f2 -d:`
319 current=`echo $showif_output | /usr/bin/cut -f3 -d:`
320 if [[ "$state" != "disabled" && $current != *Z* ]]; then
321 #
322 # skip if not a persistent interface, or if it should get IP
323 # configuration from the global zone ('Z' flag is set)
324 #
325 continue;
326 elif is_iptun $intf; then
327 # skip IP tunnel interfaces plumbed by net-iptun
328 continue;
329 elif [ -f /etc/hostname.$intf ] || [ -f /etc/hostname6.$intf ]; then
|
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
25 # All rights reserved.
26 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
27 # Copyright 2012 Milan Jurik. All rights reserved.
28 # Copyright 2016 Nexenta Systems, Inc.
29 #
30
31 . /lib/svc/share/smf_include.sh
32 . /lib/svc/share/net_include.sh
33
34 #
35 # In a shared-IP zone we need this service to be up, but all of the work
36 # it tries to do is irrelevant (and will actually lead to the service
37 # failing if we try to do it), so just bail out.
38 # In the global zone and exclusive-IP zones we proceed.
39 #
40 smf_configure_ip || exit $SMF_EXIT_OK
41
42
43 # Make sure that the libraries essential to this stage of booting can be found.
44 LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
45
46 smf_netstrategy
47
48 if smf_is_globalzone; then
49 net_reconfigure || exit $SMF_EXIT_ERR_CONFIG
291 [ -n "$inet6_failed" ] && warn_failed_ifs "plumb IPv6" "$inet6_failed"
292 fi
293
294 #
295 # Create all of the IPv6 IPMP interfaces.
296 #
297 if [ -n "$ipmp6_list" ]; then
298 set -- $ipmp6_list
299 while [ $# -gt 0 ]; do
300 if /sbin/ifconfig $1 inet6 ipmp; then
301 ipmp6_created="$ipmp6_created $1"
302 else
303 ipmp6_failed="$ipmp6_failed $1"
304 fi
305 shift
306 done
307 [ -n "$ipmp6_failed" ] && warn_failed_ifs "create IPv6 IPMP" \
308 "$ipmp6_failed"
309 fi
310
311 #
312 # Upgrade ipadm.conf.
313 #
314 if /usr/bin/grep -q _family /etc/ipadm/ipadm.conf; then
315 oldifs=$(/usr/bin/sed -En \
316 's/^_ifname=([a-z0-9]+);_family=[0-9]+;$/\1/p' \
317 /etc/ipadm/ipadm.conf | /usr/bin/sort -u)
318 /usr/bin/sed -i '/_family/d' /etc/ipadm/ipadm.conf
319 for oldif in $oldifs; do
320 /usr/bin/printf \
321 "_ifname=%s;_ifclass=0;_families=2,26;\n" \
322 $oldif >> /etc/ipadm/ipadm.conf
323 done
324 fi
325
326 #
327 # Finally configure interfaces set up with ipadm. Any /etc/hostname*.intf
328 # files take precedence over ipadm defined configurations except when
329 # we are in a non-global zone and Layer-3 protection of IP addresses is
330 # enforced on the interface by the global zone.
331 #
332 for showif_output in `/sbin/ipadm show-if -p -o ifname,state,current`; do
333 intf=`echo $showif_output | /usr/bin/cut -f1 -d:`
334 state=`echo $showif_output | /usr/bin/cut -f2 -d:`
335 current=`echo $showif_output | /usr/bin/cut -f3 -d:`
336 if [[ "$state" != "disabled" && $current != *Z* ]]; then
337 #
338 # skip if not a persistent interface, or if it should get IP
339 # configuration from the global zone ('Z' flag is set)
340 #
341 continue;
342 elif is_iptun $intf; then
343 # skip IP tunnel interfaces plumbed by net-iptun
344 continue;
345 elif [ -f /etc/hostname.$intf ] || [ -f /etc/hostname6.$intf ]; then
|