Skip to content

QEMU create_tap_device won't reconfigure device if it already exists #4966

Description

@xmkg

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions