The code skips reconfiguring a tap device if it already exists:
void create_tap_device(const QString& tap_name, const QString& bridge_name)
{
if (!MP_UTILS.run_cmd_for_status("ip", {"addr", "show", tap_name}))
{
MP_UTILS.run_cmd_for_status("ip", {"tuntap", "add", tap_name, "mode", "tap"});
MP_UTILS.run_cmd_for_status("ip", {"link", "set", tap_name, "master", bridge_name});
MP_UTILS.run_cmd_for_status("ip", {"link", "set", tap_name, "up"});
}
}
Meaning, it will skip the necessary configuration if the device exists and is in a broken state (e.g., not linked to the bridge). It would be better to ensure that the device is linked and up regardless of its prior existence.
The code skips reconfiguring a tap device if it already exists:
Meaning, it will skip the necessary configuration if the device exists and is in a broken state (e.g., not linked to the bridge). It would be better to ensure that the device is linked and up regardless of its prior existence.