From cdc6119fac8f6fc3c259a6ad8ae4045a6b7fb8cd Mon Sep 17 00:00:00 2001 From: Scott Kilau Date: Thu, 16 Jun 2022 10:14:49 -0500 Subject: [PATCH] If we change the primary interface name, ensure we tell the bonding driver about it. --- SD_ROOT/wz_mini/etc/init.d/wz_user.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SD_ROOT/wz_mini/etc/init.d/wz_user.sh b/SD_ROOT/wz_mini/etc/init.d/wz_user.sh index 7612ebb..5478d15 100755 --- a/SD_ROOT/wz_mini/etc/init.d/wz_user.sh +++ b/SD_ROOT/wz_mini/etc/init.d/wz_user.sh @@ -89,16 +89,19 @@ rename_interface_and_setup_bonding() { /opt/wz_mini/bin/busybox ip link set $bonding_interface up # Rename the real wlan0 interface if needed/used - if [[ "$primary_interface" == "wlan0" ]]; then + if [[ "$primary_interface" == "wlan0" ]]; then /opt/wz_mini/bin/busybox ip link set $primary_interface name wlanold /opt/wz_mini/bin/busybox ip addr flush dev wlanold primary_interface="wlanold" - fi - if [[ "$secondary_interface" == "wlan0" ]]; then + # Because we just changed the name of the primary interface, we need to + # tell the bonding driver about the name change as well. + echo "$primary_interface" > /sys/devices/virtual/net/$bonding_interface/bonding/primary + fi + if [[ "$secondary_interface" == "wlan0" ]]; then /opt/wz_mini/bin/busybox ip link set $secondary_interface name wlanold /opt/wz_mini/bin/busybox ip addr flush dev wlanold secondary_interface="wlanold" - fi + fi # Enslave the Ethernet and Original Wifi interfaces # under the bonding interface.