Commit 9042c417 authored by Tails developers's avatar Tails developers

Fail safe by entering panic mode if macchanger exits with an error.

If macchanger fails we have to treat the situation as undefined. We
can't trust that get_current_mac_of_nic() returns the actual state of
the hardware; perhaps it instead reports the driver's state that was
successfully spoofed but not applied in the hardware?
parent 1b46b5b1
......@@ -95,7 +95,12 @@ OLD_MAC="$(get_current_mac_of_nic "${NIC}")"
# real MAC address at each occasion but actually leaking the real MAC
# address will be more serious in practice.
for i in 1 2 3; do
spoof_mac "${NIC}" || :
if ! spoof_mac "${NIC}"; then
# If our MAC spoofing primitive fails, we fail safe by forcing
# us to enter into panic mode.
unset NEW_MAC
break
fi
NEW_MAC="$(get_current_mac_of_nic "${NIC}")"
if [ "${OLD_MAC}" != "${NEW_MAC}" ]; then
break
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment