Selaa lähdekoodia

fix bonding and eth0 hw addr

Alfonso Gamboa 3 vuotta sitten
vanhempi
sitoutus
bb0fb39253

+ 4 - 0
SD_ROOT/wz_mini/etc/init.d/S01bind

@@ -18,3 +18,7 @@ if [ -d /lib/modules ]; then
         echo "Mount kernel modules in /lib"
         mount --bind /opt/wz_mini/lib/modules /lib/modules
 fi
+
+echo "Replace hostname"
+echo $CUSTOM_HOSTNAME > /opt/wz_mini/etc/hostname
+mount --bind /opt/wz_mini/etc/hostname /etc/hostname

+ 1 - 1
SD_ROOT/wz_mini/etc/network/S14storemac

@@ -2,7 +2,7 @@
 
 source /opt/wz_mini/etc/rc.common
 
-wait_for_wlan_ip
+wait_for_wlan_wpa
 
 cat /sys/class/net/wlan0/address | tr '[:lower:]' '[:upper:]' > /opt/wz_mini/tmp/wlan0_mac
 echo "store original mac"

+ 15 - 11
SD_ROOT/wz_mini/etc/rc.common

@@ -4,21 +4,15 @@ source /opt/wz_mini/wz_mini.conf
 
 #Set module dir depending on platform
 if [ -f /opt/wz_mini/tmp/.T20 ]; then
-	KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14"
+        KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14"
 else
-	KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__"
+        KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__"
 fi
 
 if [[ "$ENABLE_USB_ETH" == "true" ]]; then
         ALT_IFACE=eth0
 elif [[ "$ENABLE_USB_DIRECT" == "true" ]] || [[ "$ENABLE_USB_RNDIS" == "true" ]]; then
-	ALT_IFACE=usb0
-fi
-
-if [[ "$ENABLE_USB_ETH_ORIGINAL_MAC" == "true" ]]; then
-	CONFIG="inet addr"
-else
-	CONFIG="HWaddr"
+        ALT_IFACE=usb0
 fi
 
 #Set the correct GPIO for the audio driver (T31 only)
@@ -30,10 +24,20 @@ fi
 
 wait_for_wlan() {
 while true; do
-        if ifconfig wlan0 | grep "$CONFIG"; then
+        if ifconfig wlan0 | grep "HWaddr"; then
+            break
+        fi
+        echo "Network HW not ready yet, try again in 5 seconds"
+        sleep 5
+done
+}
+
+wait_for_wlan_wpa() {
+while true; do
+        if [ -e /tmp/wpa_supplicant.conf ]; then
             break
         fi
-        echo "Network not ready yet, try again in 5 seconds"
+        echo "wpa_supplicant not initialized yet, try again in 5 seconds"
         sleep 5
 done
 }

+ 7 - 10
SD_ROOT/wz_mini/etc/rc.d/S06networkalt

@@ -5,24 +5,19 @@ source /opt/wz_mini/wz_mini.conf
 
 alternate_iface() {
 
-wait_for_wlan
-
-if ! [[ "$BONDING_ENABLED" == "true" ]]; then
-    
 	if [[ "$ENABLE_USB_ETH" == "true" ]] || [[ "$ENABLE_USB_DIRECT" == "true" ]] || [[ "$ENABLE_USB_RNDIS" == "true" ]]; then
 
+	wait_for_wlan_wpa
+
 	##Fool iCamera by renaming the hardline interface to wlan0
         echo "Renaming interfaces"
         ifconfig $ALT_IFACE down
+
         ifconfig wlan0 down
         /opt/wz_mini/bin/busybox ip link set wlan0 name wlanold
         /opt/wz_mini/bin/busybox ip addr flush dev wlanold
         /opt/wz_mini/bin/busybox ip link set $ALT_IFACE name wlan0
 
-        ifconfig wlan0 up
-        pkill udhcpc
-        udhcpc -i wlan0 -x hostname:$CUSTOM_HOSTNAME -p /var/run/udhcpc.pid -b
-
         if [ -f /opt/wz_mini/tmp/.T20 ]; then
 	        mount -o bind /opt/wz_mini/bin/wpa_cli.sh /system/bin/wpa_cli
         else
@@ -32,7 +27,9 @@ if ! [[ "$BONDING_ENABLED" == "true" ]]; then
 	else
 		echo "No alternate iface enabled"
 	fi
-fi
+
 }
 
-alternate_iface &
+if ! [[ "$BONDING_ENABLED" == "true" ]]; then
+    alternate_iface &
+fi

+ 6 - 6
SD_ROOT/wz_mini/etc/rc.d/S07bonding

@@ -7,8 +7,8 @@ set -x
 
 bonding_setup() {
 
-	#we need to wait until wlan0 is up
-	wait_for_wlan
+	#we need to wait until wlan0 is up with the modified HWaddr
+	wait_for_wlan_wpa
 
 	##Fool iCamera by renaming the hardline interface to wlan0
 
@@ -27,7 +27,7 @@ bonding_setup() {
         if [[ "$BONDING_PRIMARY_INTERFACE" == "wlan0" ]]; then
                 /opt/wz_mini/bin/busybox ip link set $BONDING_PRIMARY_INTERFACE name wlanold
                 /opt/wz_mini/bin/busybox ip addr flush dev wlanold
-                primary_interface="wlanold"
+                BONDING_PRIMARY_INTERFACE="wlanold"
                 # Because we just changed the name of the primary interface, we need to
                 # tell the bonding driver about the name change as well.
                 echo "$BONDING_PRIMARY_INTERFACE" > /sys/devices/virtual/net/bond0/bonding/primary
@@ -35,7 +35,7 @@ bonding_setup() {
         if [[ "$BONDING_SECONDARY_INTERFACE" == "wlan0" ]]; then
                 /opt/wz_mini/bin/busybox ip link set $BONDING_SECONDARY_INTERFACE name wlanold
                 /opt/wz_mini/bin/busybox ip addr flush dev wlanold
-                secondary_interface="wlanold"
+                BONDING_SECONDARY_INTERFACE="wlanold"
         fi
 
         # Enslave the Ethernet and Original Wifi interfaces
@@ -68,9 +68,9 @@ bonding_setup() {
         else
 	        mount -o bind /opt/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
         fi
-        
+
 }
 
 if [[ "$BONDING_ENABLED" == "true" ]]; then
 	bonding_setup &
-fi      
+fi