Fixed a bug affecting interface driver reloading.

The interface setup procedure wasn't waiting for the interface to be ready.
This commit is contained in:
Matias Barcenas 2017-08-20 16:54:06 -05:00
parent 9d708bc84e
commit 5876569de8
1 changed files with 23 additions and 17 deletions

View File

@ -527,8 +527,8 @@ function set_interface() {
wiSelectedState="${IOQueryFormatFields[2]}" wiSelectedState="${IOQueryFormatFields[2]}"
fi fi
if [ "$wiSelected" = "$FLUXIONGeneralRepeatOption" ]; then if [ "$wiSelected" = "$FLUXIONGeneralRepeatOption" ]
unset_interface; return 1 then unset_interface; return 1
fi fi
if [ ! "$FLUXIONDropNet" -a "$wiSelectedState" = "-" ]; then if [ ! "$FLUXIONDropNet" -a "$wiSelectedState" = "-" ]; then
@ -540,38 +540,44 @@ function set_interface() {
if [ $FLUXIONDropNet ]; then if [ $FLUXIONDropNet ]; then
# Get selected interface's driver details/info-descriptor. # Get selected interface's driver details/info-descriptor.
echo -e "$FLUXIONVLine $FLUXIONGatheringWIInfoNotice" echo -e "$FLUXIONVLine $FLUXIONGatheringWIInfoNotice"
interface_driver "$wiSelected"
WIDriver="$InterfaceDriver" if ! interface_driver "$wiSelected"
then echo -e "$FLUXIONVLine$CRed Unable to determine interface driver!"; sleep 3; return 1
fi
local wiDriver="$InterfaceDriver"
# I'm not really sure about this conditional here. # I'm not really sure about this conditional here.
# FLUXION 2 had the conditional so I kept it there. # FLUXION 2 had the conditional so I kept it there.
if [ ! "$(echo $WIDriver | egrep 'rt2800|rt73')" ]; then if [ ! "$(echo $wiDriver | egrep 'rt2800|rt73')" ]
rmmod -f $WIDriver &> $FLUXIONOutputDevice 2>&1 then rmmod -f $wiDriver &> $FLUXIONOutputDevice 2>&1
fi fi
# Get list of potentially troublesome programs. # Get list of potentially troublesome programs.
echo -e "$FLUXIONVLine $FLUXIONFindingConflictingProcessesNotice" echo -e "$FLUXIONVLine $FLUXIONFindingConflictingProcessesNotice"
# This shit has to go reeeeeal soon (airmon-ng)... # This shit has to go reeeeeal soon (airmon-ng)...
ConflictPrograms=($(airmon-ng check | awk 'NR>6{print $2}')) local conflictPrograms=($(airmon-ng check | awk 'NR>6{print $2}'))
# Kill potentially troublesome programs. # Kill potentially troublesome programs.
echo -e "$FLUXIONVLine $FLUXIONKillingConflictingProcessesNotice" echo -e "$FLUXIONVLine $FLUXIONKillingConflictingProcessesNotice"
for program in "${ConflictPrograms[@]}"; do for program in "${conflictPrograms[@]}"
killall "$program" &> $FLUXIONOutputDevice do killall "$program" &> $FLUXIONOutputDevice
done done
sleep 0.5
# I'm not really sure about this conditional here. # I'm not really sure about this conditional here.
# FLUXION 2 had the conditional so I kept it there. # FLUXION 2 had the conditional so I kept it there.
if [ ! "$(echo $WIDriver | egrep 'rt2800|rt73')" ]; then if [ ! "$(echo $wiDriver | egrep 'rt2800|rt73')" ]
modprobe "$WIDriver" &> $FLUXIONOutputDevice 2>&1 then modprobe "$wiDriver" &> $FLUXIONOutputDevice 2>&1
sleep 0.5 fi
fi
echo -e "$FLUXIONVLine Waiting for interface \"$wiSelected\"..."
while ! interface_physical "$wiSelected"
do sleep 1
done
fi fi
if ! run_interface "$wiSelected" if ! run_interface "$wiSelected"
then return 1 then return 1
fi fi
} }