Skip to content

Commit

Permalink
Fixes flow in fma::flow::linux::fake_mac_address().
Browse files Browse the repository at this point in the history
  • Loading branch information
Hologos committed Jun 21, 2022
1 parent 2691b5b commit cf43ba2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
7 changes: 5 additions & 2 deletions libs/flow.linux
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ function fma::flow::linux::preflight_checks() {
}

function fma::flow::linux::fake_mac_address() {
echo "› stpping interface ${affected_interface}"
fma::network::stop_affected_interface "${affected_interface}"

echo "› fake mac address ${fake_mac_address}"
fma::network::fake_mac_address "${affected_interface}" "${fake_mac_address}"

echo "restarting interface ${affected_interface}"
fma::network::restart_affected_interface "${affected_interface}"
echo "starting interface ${affected_interface}"
fma::network::start_affected_interface "${affected_interface}"
}


24 changes: 18 additions & 6 deletions libs/network
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,30 @@ function fma::network::get_current_mac_address() {
CURRENT_MAC_ADDRESS="$(ifconfig "${interface_to_check}" | grep "ether" | grep -i --only-matching -E "([0-9a-f]{2}:){5}[0-9a-f]{2}")"
}

function fma::network::restart_affected_interface() {
local interface_to_restart="${1}"
function fma::network::start_affected_interface() {
local interface_to_start="${1}"

sudo ifconfig "${interface_to_start}" up

fma::utils::report_status "starting interface ${interface_to_restart}"
}

function fma::network::stop_affected_interface() {
local interface_to_stop="${1}"

sudo ifconfig "${interface_to_restart}" down
sudo ifconfig "${interface_to_stop}" down

fma::utils::report_status "stopping interface ${interface_to_restart}"
}

sleep 2
function fma::network::restart_affected_interface() {
local interface_to_restart="${1}"

sudo ifconfig "${interface_to_restart}" up
fma::network::stop_affected_interface "${interface_to_restart}"

fma::utils::report_status "starting interface ${interface_to_restart}"
sleep 2

fma::network::start_affected_interface "${interface_to_restart}"

sleep 2
}

0 comments on commit cf43ba2

Please sign in to comment.