SPECS/open-vm-tools/IPv6Support.patch
8abc50ea
 diff -ru gosc-scripts/imc-shell/imgcust-scripts/CustomizationUtils.sh gosc-scripts-modified/imc-shell/imgcust-scripts/CustomizationUtils.sh
 --- gosc-scripts/imc-shell/imgcust-scripts/CustomizationUtils.sh	2016-04-29 15:41:27.000000000 -0700
 +++ gosc-scripts-modified/imc-shell/imgcust-scripts/CustomizationUtils.sh	2016-06-14 16:09:45.513745070 -0700
 @@ -931,9 +931,8 @@
    local i=
    for i in $(seq 1 $nicsCnt); do
      local nic=$(ConfigFile_GetNicByIndex $i)
 -    local bootProto=$(ConfigFile_GetBootProto $nic)
      local mac=$(ConfigFile_GetMacAddress $nic)
 -
 +    local ipv4Addr=$(ConfigFile_GetFirstIpV4Addr $nic)
      local ifCfg=
      ${addrShowVar} ${mac} "" ifCfg
      Debug "ifCfg: $ifCfg"
 @@ -951,56 +950,60 @@
          [Network]
  EOF
  )
 -
 -    if [[ $bootProto == "dhcp" ]]; then
 +    # Configure the DHCP IP settings
 +    if [ -z "$ipv4Addr" ]; then
        export formatResult=$formatResult$(${CAT} <<EOF
  
          DHCP=yes
  EOF
  )
 -    else # static
 -      ipv4Addr=$(ConfigFile_GetFirstIpV4Addr $nic)
 +    else
 +      export formatResult=$formatResult$(${CAT} <<EOF
 +
 +        DHCP=ipv6
 +EOF
 +)
 +    fi
 +    # Configure Static IP setting
 +    if [ -n "$ipv4Addr" ]; then
        ipv4Mask=$(ConfigFile_GetFirstIpV4Mask $nic)
        ipv4Gw=$(ConfigFile_GetFirstIpV4Gw $nic)
        local gatewayStr="Gateway=$ipv4Gw"
        if [ "$ipv4Gw" = "0.0.0.0" ]
        then
 -         Debug "Found an empty gateway"
 -         gatewayStr=""
 +        Debug "Found an empty gateway"
 +        gatewayStr=""
        fi
        ipv4AddrPrefix=$(MaskStrToBits "$ipv4Addr $ipv4Mask")
 -
        export formatResult=$formatResult$(${CAT} <<EOF
  
          Address=$ipv4AddrPrefix
          $gatewayStr
  EOF
  )
 -      ipv6Cnt=$(ConfigFile_GetIpV6Cnt $nic)
 -      local j=
 -      for j in $(seq 1 $ipv6Cnt); do
 -        ipv6Addr=$(ConfigFile_GetIpV6AddrByInd $nic $j)
 -        ipv6Pref=$(ConfigFile_GetIpV6PrefixByInd $nic $j)
 -
 -        export formatResult=$formatResult$(${CAT} <<EOF
 +    fi
 +    local ipv6Cnt=$(ConfigFile_GetIpV6Cnt $nic)
 +    local j=
 +    for j in $(seq 1 $ipv6Cnt); do
 +      ipv6Addr=$(ConfigFile_GetIpV6AddrByInd $nic $j)
 +      ipv6Pref=$(ConfigFile_GetIpV6PrefixByInd $nic $j)
 +      export formatResult=$formatResult$(${CAT} <<EOF
  
          Address=$ipv6Addr/$ipv6Pref
  EOF
  )
 -      done
 +    done
  
 -      ipv6GwCnt=$(ConfigFile_GetIpV6GwCnt $nic)
 -      local j=
 -      for j in $(seq 1 $ipv6GwCnt); do
 -        ipv6Gw=$(ConfigFile_GetIpV6GwByInd $nic $j)
 -
 -        export formatResult=$formatResult$(${CAT} <<EOF
 +    ipv6GwCnt=$(ConfigFile_GetIpV6GwCnt $nic)
 +    local j=
 +    for j in $(seq 1 $ipv6GwCnt); do
 +      ipv6Gw=$(ConfigFile_GetIpV6GwByInd $nic $j)
 +      export formatResult=$formatResult$(${CAT} <<EOF
  
          Gateway=$ipv6Gw
  EOF
  )
 -      done
 -    fi # boot proto
 +    done
  
      local dnsCnt=$(ConfigFile_GetNameServersCnt)
      for j in $(seq 1 $dnsCnt); do