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>
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 dc369b4..aa384ad 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 @@
     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() {