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>
        
*** 17,33 ****
  # 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 2012 Milan Jurik. All rights reserved.
  #
- # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
- # All rights reserved.
- #
  
  . /lib/svc/share/smf_include.sh
  . /lib/svc/share/net_include.sh
  
  #
--- 17,34 ----
  # fields enclosed by brackets "[]" replaced with your own identifying
  # information: Portions Copyright [yyyy] [name of copyright owner]
  #
  # CDDL HEADER END
  #
+ 
  #
+ # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
+ # All rights reserved.
  # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  # Copyright 2012 Milan Jurik. All rights reserved.
+ # Copyright 2016 Nexenta Systems, Inc.
  #
  
  . /lib/svc/share/smf_include.sh
  . /lib/svc/share/net_include.sh
  
  #
*** 305,314 ****
--- 306,330 ----
          done
          [ -n "$ipmp6_failed" ] && warn_failed_ifs "create IPv6 IPMP" \
              "$ipmp6_failed"
  fi
  
+ #
+ # Upgrade ipadm.conf.
+ #
+ if /usr/bin/grep -q _family /etc/ipadm/ipadm.conf; then
+         oldifs=$(/usr/bin/sed -En \
+             's/^_ifname=([a-z0-9]+);_family=[0-9]+;$/\1/p' \
+             /etc/ipadm/ipadm.conf | /usr/bin/sort -u)
+         /usr/bin/sed -i '/_family/d' /etc/ipadm/ipadm.conf
+         for oldif in $oldifs; do
+                 /usr/bin/printf \
+                     "_ifname=%s;_ifclass=0;_families=2,26;\n" \
+                     $oldif >> /etc/ipadm/ipadm.conf
+         done
+ fi
+ 
  #
  # Finally configure interfaces set up with ipadm. Any /etc/hostname*.intf
  # files take precedence over ipadm defined configurations except when
  # we are in a non-global zone and Layer-3 protection of IP addresses is
  # enforced on the interface by the global zone.