diff options
author | Jason King <jason.king@joyent.com> | 2019-08-26 21:00:35 +0000 |
---|---|---|
committer | Jason King <jason.king@joyent.com> | 2019-09-10 19:35:13 +0000 |
commit | fa49197bae58cc9833edfa12d6b7ba60b1cd1d94 (patch) | |
tree | a8538ab68f8859371fb6729aee1e3e9e0cba4b18 | |
parent | 4e7ed5ff5aed7830c00a00fde7205951f49b4f05 (diff) | |
download | illumos-joyent-fa49197bae58cc9833edfa12d6b7ba60b1cd1d94.tar.gz |
OS-7972 Early network admin service may not set the datalink MTU to the correct value
Reviewed by: Dan McDonald <danmcd@joyent.com>
Approved by: Brian Bennett <brian.bennett@joyent.com>
-rw-r--r-- | usr/src/cmd/svc/milestone/net-early-admin | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/usr/src/cmd/svc/milestone/net-early-admin b/usr/src/cmd/svc/milestone/net-early-admin index abfd5fbdd7..cda730f81e 100644 --- a/usr/src/cmd/svc/milestone/net-early-admin +++ b/usr/src/cmd/svc/milestone/net-early-admin @@ -126,8 +126,8 @@ typeset -A mac_to_link out=$(dladm show-phys -mpo link,address) (( $? == 0 )) || fatal "dladm show-phys failed" while IFS=: read link addr; do - mac=$(normalize_mac $addr) - mac_to_link["$mac"]="$link" + macaddr=$(normalize_mac $addr) + mac_to_link["$macaddr"]="$link" done <<< "$out" ADMIN_NIC_TAG=${CONFIG_admin_tag:-"admin"} @@ -147,11 +147,6 @@ if [[ -n "${aggr_links[$nic]}" ]]; then echo "Creating aggr: $nic (mode=$mode, links=${links})" dladm create-aggr -l ${links// / -l } -L $mode $nic - - if [[ -n "${mtu[$nic]}" ]]; then - dladm set-linkprop -p mtu=${mtu[$nic]} $nic || \ - fatal "ERROR: Failed to set mtu on aggr $nic to ${mtu[$nic]}" - fi elif valid_mac "$nic"; then [[ -n "${mac_to_link[$nic]}" ]] || \ fatal "ERROR: admin mac address $nic not found on system" @@ -160,6 +155,34 @@ else fatal "ERROR: Invalid value of ${ADMIN_NIC_TAG}_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]}" + + # If the 'mac' for the nic tag is actually an aggr, the + # tag will appear in $aggr_links (and we want to use that as + # the link name). If it is not an aggr, we need to map the + # MAC address to the link name so we can check if $tag + # resides on the same link as the admin interface + if [[ -n "${aggr_links[$tagmac]}" ]]; then + link="$tagmac" + else + link="${mac_to_link[$tagmac]}" + fi + + if [[ "$link" == "$nic" && $dlmtu -lt ${mtu[$tag]} ]]; then + dlmtu=${mtu[$tag]} + fi +done + +if [[ -n "$dlmtu" ]]; then + dladm set-linkprop -p mtu=$dlmtu $nic || \ + fatal "ERROR: Failed to set mtu on aggr $nic to $dlmtu" +fi + driver=${nic%%[0-9]*} get_link_state $nic if [[ "$link_state" == "down" ]]; then |