diff options
author | William A. Kennington III <wak@google.com> | 2022-04-05 03:30:54 +0300 |
---|---|---|
committer | Willy Tu <wltu@google.com> | 2022-04-05 19:20:09 +0300 |
commit | 8d0f906f39cbcfd591809306ba5034309e3949da (patch) | |
tree | 682a0d8d5d5e27ffaa59de3d22776680401bc81c | |
parent | e1c8b8761b094e46b8de574c1ab8d59c677490bd (diff) | |
download | openbmc-8d0f906f39cbcfd591809306ba5034309e3949da.tar.xz |
meta-google: google-usb-network: Only rename link if required
Otherwise it will remain down since the first command sets it
administratively down.
Change-Id: I203d145ffe9815426c2803b11a4313544d812cf5
Signed-off-by: William A. Kennington III <wak@google.com>
-rwxr-xr-x | meta-google/recipes-google/networking/google-usb-network/usb_network.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/meta-google/recipes-google/networking/google-usb-network/usb_network.sh b/meta-google/recipes-google/networking/google-usb-network/usb_network.sh index dc369b4d58..aa384ad086 100755 --- a/meta-google/recipes-google/networking/google-usb-network/usb_network.sh +++ b/meta-google/recipes-google/networking/google-usb-network/usb_network.sh @@ -90,9 +90,13 @@ EOF ln -s "${func_dir}" "${config_dir}" || return echo "${BIND_DEVICE}" >${gadget_dir}/UDC || return - # We don't care if downing the interface fails, only the rename - ip link set dev "$(<"${func_dir}"/ifname)" down || true - ip link set dev "$(<"${func_dir}"/ifname)" name "${IFACE_NAME}" || return + local ifname + ifname="$(<"${func_dir}"/ifname)" || return + if [ "${IFACE_NAME}" != "$ifname" ]; then + # We don't care if downing the interface fails, only the rename + ip link set dev "$ifname" down || true + ip link set dev "$ifname" name "${IFACE_NAME}" || return + fi } gadget_stop() { |