Skip to content
Permalink
Browse files

ipv6 changes

accept CIDR as well as Netmask in error check

reversed logic

revamped ipv6 patch.

inet6 ip can go directly in ip field, and both ipv4 and 6 can use cidr
notation instead of netmask. all checks are updated to account for these
new rules.

Statechange has been reverted to a must less invasive form, and
net-physical now handles dhcp6 and auto6 properly.

the ip6 field doesn't work anymore. It is recommended if you were
using my old ip6 patch, update the xml files under /etc/zones
to change the ip6 field to ip, and remove the mask bits from
the cidr notation in that field (or destroy and recreate
the zones)
  • Loading branch information
joshie authored and nshalman committed Mar 11, 2013
1 parent 0408390 commit 8bb45d136d9f94eb4d91fbe506e9c5ab5ec5aaad
@@ -337,47 +337,46 @@ IPNAT
fi
else
# Non-global zones

# Bring up statically assigned interfaces, and find the primary DHCP
# interface, if it exists
while IFS=: read -r iface addrtype; do
if [[ -f /etc/hostname.${iface} ]]; then
/sbin/ifconfig ${iface} plumb
# vrrp interfaces can't be brought up with ifconfig: vrrpadm
# handles that instead
if [[ "${addrtype}" =~ "^vrrp" ]]; then
/sbin/ifconfig ${iface} inet `cat /etc/hostname.${iface} \
| sed -e 's/ up//'`
else
/sbin/ifconfig ${iface} inet `cat /etc/hostname.${iface}` up
fi
else
if [[ -z "${first_iface}" ]]; then
first_iface=${iface}
fi
if [[ -z "${primary}" && -f /etc/dhcp.${iface} ]]; then
primary=${iface}
for i in hostname dhcp hostname6 dhcp6 auto6; do
if [[ -f /etc/${i}.${iface} ]]; then
[[ "${i}" =~ '6' ]] && add=' inet6' || add=''
/sbin/ifconfig ${iface}${add} plumb
if [[ "${i}" == 'hostname6' ]]; then
add=":1 ${add}"
/sbin/ifconfig ${iface}${add} plumb
fi
case $i in
hostname*)
add="${add} "`cat /etc/${i}.${iface}`" up"
[[ "${addrtype}" =~ "^vrrp" ]] && add=${add%% up}
/sbin/ifconfig ${iface}${add}
;;
dhcp)
dhcp_list=${dhcp_list}\ ${iface}
;;
dhcp6)
dhcp6_list=${dhcp6_list}\ ${iface}
;;
auto6)
/sbin/ifconfig ${iface} inet6 up
;;
esac
break;
fi
fi
done
done < <(/usr/sbin/dladm show-vnic -p -o link,macaddrtype 2>/dev/null)

if [[ -z "${primary}" && -n "${first_iface}" ]]; then
primary=${first_iface}
fi

if [[ -n "${primary}" ]]; then
/sbin/ifconfig ${primary} plumb
/sbin/ifconfig ${primary} auto-dhcp primary
fi

for iface in `/usr/sbin/dladm show-vnic -p -o link`; do
if [[ "${iface}" == "${primary}" ]]; then
continue
fi
/sbin/ifconfig ${iface} plumb
if [[ ! -f /etc/hostname.${iface} ]]; then
/sbin/ifconfig ${iface} dhcp start wait 0
fi
add='dhcp primary'
for i in $dhcp_list; do
/sbin/ifconfig ${i} ${add}
add='dhcp start wait 0'
done
add='dhcp primary'
for i in $dhcp6_list; do
/sbin/ifconfig ${i} inet6 ${add}
add='dhcp start wait 0'
done
fi

@@ -293,7 +293,6 @@ setup_net()
fi
fi


# Get the static IP for the vnic from the zone config file, but only
# if there's not an IP from the zone properties
hostname_file="$ZONEPATH/root/etc/hostname.$nic"
@@ -311,7 +310,8 @@ setup_net()
fi

if [[ -n "${zone_ip}" ]] && [[ $allow_ip_spoof != "true" ]] && \
[[ "${zone_ip}" != "dhcp" ]]; then
[[ "${zone_ip}" != "dhcp" ]] && [[ "${zone_ip}" != "dhcp6" ]] && \
[[ "${zone_ip}" != "auto6" ]]; then
allowed_ips="${zone_ip}"
[[ -n $vrrp_primary_ip ]] && \
allowed_ips="${allowed_ips},${vrrp_primary_ip}"
@@ -294,7 +294,6 @@ setup_net()
fi
fi


# Get the static IP for the vnic from the zone config file, but only
# if there's not an IP from the zone properties
hostname_file="$ZONEPATH/root/etc/hostname.$nic"
@@ -312,7 +311,8 @@ setup_net()
fi

if [[ -n "${zone_ip}" ]] && [[ $allow_ip_spoof != "true" ]] && \
[[ "${zone_ip}" != "dhcp" ]]; then
[[ "${zone_ip}" != "dhcp" ]] && [[ "${zone_ip}" != "dhcp6" ]] && \
[[ "${zone_ip}" != "auto6" ]]; then
allowed_ips="${zone_ip}"
[[ -n $vrrp_primary_ip ]] && \
allowed_ips="${allowed_ips},${vrrp_primary_ip}"
@@ -257,16 +257,19 @@ setup_net()
fi
fi



if [[ -n "${zone_ip}" ]] && [[ $allow_ip_spoof != "true" ]] && \
[[ "${zone_ip}" != "dhcp" ]]; then
[[ "${zone_ip}" != "dhcp" ]] && [[ "${zone_ip}" != "dhcp6" ]] && \
[[ "${zone_ip}" != "auto6" ]]; then
dladm set-linkprop -t -z $ZONENAME \
-p "allowed-ips=${zone_ip}" ${nic}
if (( $? != 0 )); then
echo "error setting VNIC allowed-ip " \
"$nic $zone_ip"
"$nic $allowed_ips"
logger -p daemon.err "zone $ZONENAME " \
"error setting VNIC allowed-ip " \
"$nic $zone_ip"
"$nic $allowed_ips"
exit 1
fi
fi

Some generated files are not rendered by default. Learn more.

0 comments on commit 8bb45d1

Please sign in to comment.
You can’t perform that action at this time.