network: Add null network driver and make it the default mode

This commit is contained in:
cold-brewed
2023-05-08 13:05:01 -04:00
parent 13974b216b
commit efedd983eb
8 changed files with 277 additions and 24 deletions

View File

@@ -849,7 +849,7 @@ MediaMenu::nicUpdateMenu(int i)
if (!netMenus.contains(i))
return;
QString netType = tr("None");
QString netType = tr("Null Driver");
switch (net_cards_conf[i].net_type) {
case NET_TYPE_SLIRP:
netType = "SLiRP";

View File

@@ -40,9 +40,10 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
auto *socket_line = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i + 1));
int netType = net_type_cbox->currentData().toInt();
bool adaptersEnabled = netType == NET_TYPE_SLIRP
|| NET_TYPE_VDE
|| (netType == NET_TYPE_PCAP && intf_cbox->currentData().toInt() > 0);
bool adaptersEnabled = netType == NET_TYPE_NONE
|| netType == NET_TYPE_SLIRP
|| netType == NET_TYPE_VDE
|| (netType == NET_TYPE_PCAP && intf_cbox->currentData().toInt() > 0);
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
nic_cbox->setEnabled(adaptersEnabled);
@@ -133,7 +134,7 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
cbox = findChild<QComboBox *>(QString("comboBoxNet%1").arg(i + 1));
model = cbox->model();
removeRows = model->rowCount();
Models::AddEntry(model, tr("None"), NET_TYPE_NONE);
Models::AddEntry(model, tr("Null Driver"), NET_TYPE_NONE);
Models::AddEntry(model, "SLiRP", NET_TYPE_SLIRP);
if (network_ndev > 1) {