Print this page
NEX-7823 ipmgmtd can't properly remove interface from the old ipadm.conf format
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/milestone/net-physical
          +++ new/usr/src/cmd/svc/milestone/net-physical
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12  # and limitations under the License.
  13   13  #
  14   14  # When distributing Covered Code, include this CDDL HEADER in each
  15   15  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16  # If applicable, add the following below this CDDL HEADER, with the
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
       22 +
  22   23  #
       24 +# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
       25 +# All rights reserved.
  23   26  # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24   27  # Copyright 2012 Milan Jurik. All rights reserved.
       28 +# Copyright 2016 Nexenta Systems, Inc.
  25   29  #
  26      -# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
  27      -# All rights reserved.
  28      -#
  29   30  
  30   31  . /lib/svc/share/smf_include.sh
  31   32  . /lib/svc/share/net_include.sh
  32   33  
  33   34  #
  34   35  # In a shared-IP zone we need this service to be up, but all of the work
  35   36  # it tries to do is irrelevant (and will actually lead to the service 
  36   37  # failing if we try to do it), so just bail out. 
  37   38  # In the global zone and exclusive-IP zones we proceed.
  38   39  #
↓ open down ↓ 261 lines elided ↑ open up ↑
 300  301                          ipmp6_created="$ipmp6_created $1"
 301  302                  else
 302  303                          ipmp6_failed="$ipmp6_failed $1"
 303  304                  fi
 304  305                  shift
 305  306          done
 306  307          [ -n "$ipmp6_failed" ] && warn_failed_ifs "create IPv6 IPMP" \
 307  308              "$ipmp6_failed"
 308  309  fi
 309  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 +
 310  326  #
 311  327  # Finally configure interfaces set up with ipadm. Any /etc/hostname*.intf
 312  328  # files take precedence over ipadm defined configurations except when
 313  329  # we are in a non-global zone and Layer-3 protection of IP addresses is
 314  330  # enforced on the interface by the global zone.
 315  331  #
 316  332  for showif_output in `/sbin/ipadm show-if -p -o ifname,state,current`; do
 317  333          intf=`echo $showif_output | /usr/bin/cut -f1 -d:`
 318  334          state=`echo $showif_output | /usr/bin/cut -f2 -d:`
 319  335          current=`echo $showif_output | /usr/bin/cut -f3 -d:`
↓ open down ↓ 226 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX