summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason King <jasonbking@users.noreply.github.com>2020-12-28 19:44:13 -0600
committerGitHub <noreply@github.com>2020-12-28 19:44:13 -0600
commit585b1602a53a03f5a0ca8e68c7d9c9fd12951688 (patch)
treeeab95284d96548ce77b36141d1988aa34a276fd7
parent8da15b249773fc4ae4d24feff011a40b5f488b3a (diff)
downloadillumos-joyent-585b1602a53a03f5a0ca8e68c7d9c9fd12951688.tar.gz
OS-8257 Regression setting admin link MTU without aggrs (#348)
Reviewed by: Brian Bennett <brian.bennett@joyent.com> Approved by: Brian Bennett <brian.bennett@joyent.com
-rw-r--r--usr/src/cmd/svc/milestone/net-early-admin28
1 files changed, 20 insertions, 8 deletions
diff --git a/usr/src/cmd/svc/milestone/net-early-admin b/usr/src/cmd/svc/milestone/net-early-admin
index f0456f62d3..c966d32890 100644
--- a/usr/src/cmd/svc/milestone/net-early-admin
+++ b/usr/src/cmd/svc/milestone/net-early-admin
@@ -12,7 +12,7 @@
#
#
-# Copyright 2019 Joyent, Inc.
+# Copyright 2020 Joyent, Inc.
#
# Traditionally, when a Triton compute node boots, the network is not
@@ -134,12 +134,30 @@ ADMIN_NIC_TAG=${CONFIG_admin_tag:-"admin"}
[[ -n "${tagv[$ADMIN_NIC_TAG]}" ]] || \
fatal "ERROR: admin nic tag '$ADMIN_NIC_TAG' not present"
+# Set $nic to the link that has the admin nic tag. For unfortunate
+# historic reasons, for aggrs, the MAC address and link name of an aggr
+# are the same value by net-boot-config (and the source of many errors).
+# If ${aggr_links[$nic]} is non-empty, it means $nic isn't a MAC address
+# but an aggr name (and we're done). Otherwise we must map the MAC address
+# from $tagv back to the link.
nic="${tagv[$ADMIN_NIC_TAG]}"
+if [[ -z "${aggr_links[$nic]}" ]]; then
+ if !valid_mac "$nic"; then
+ fatal "ERROR: admin mac address $nic not found on system"
+ fi
+
+ _nic=${mac_to_link[$nic]}
+ if [[ -z "$_nic" ]]; then
+ fatal "ERROR: Invalid value of ${ADMIN_NIC_TAG}_nic ($nic)"
+ fi
+ nic=$_nic
+fi
# If there are other nic tags configured on the same link as
# the admin tag, find the largest MTU to use to set the
# datalink MTU
dlmtu="${mtu[$ADMIN_NIC_TAG]}"
+
for tag in ${tags[@]}; do
tagmac="${tagv[$tag]}"
@@ -176,12 +194,6 @@ if [[ -n "${aggr_links[$nic]}" ]]; then
echo "Creating aggr: $nic (mode=$mode, links=${links})"
dladm create-aggr -l ${links// / -l } -L $mode $nic
-elif valid_mac "$nic"; then
- [[ -n "${mac_to_link[$nic]}" ]] || \
- fatal "ERROR: admin mac address $nic not found on system"
- nic=${mac_to_link[$nic]}
-else
- fatal "ERROR: Invalid value of ${ADMIN_NIC_TAG}_nic ($nic)"
fi
if [[ -n "$dlmtu" ]]; then
@@ -189,7 +201,7 @@ if [[ -n "$dlmtu" ]]; then
fatal "ERROR: Failed to set mtu on aggr $nic to $dlmtu"
fi
-driver=${nic%%[0-9]*}
+driver=${nic%%+([0-9])}
get_link_state $nic
if [[ "$link_state" == "down" ]]; then
echo "admin nic '${nic}' is down: unplumbing"