Fix some bugs relating to tap on non unix platforms
This commit is contained in:
@@ -658,9 +658,9 @@ load_network(void)
|
||||
nc->net_type = NET_TYPE_PCAP;
|
||||
else if (!strcmp(p, "slirp") || !strcmp(p, "2"))
|
||||
nc->net_type = NET_TYPE_SLIRP;
|
||||
else if (!strcmp(p, "vde") || !strcmp(p, "2"))
|
||||
else if (!strcmp(p, "vde") || !strcmp(p, "3"))
|
||||
nc->net_type = NET_TYPE_VDE;
|
||||
else if (!strcmp(p, "tap") || !strcmp(p, "3"))
|
||||
else if (!strcmp(p, "tap") || !strcmp(p, "4"))
|
||||
nc->net_type = NET_TYPE_TAP;
|
||||
else
|
||||
nc->net_type = NET_TYPE_NONE;
|
||||
@@ -706,9 +706,9 @@ load_network(void)
|
||||
nc->net_type = NET_TYPE_PCAP;
|
||||
else if (!strcmp(p, "slirp") || !strcmp(p, "2"))
|
||||
nc->net_type = NET_TYPE_SLIRP;
|
||||
else if (!strcmp(p, "vde") || !strcmp(p, "2"))
|
||||
else if (!strcmp(p, "vde") || !strcmp(p, "3"))
|
||||
nc->net_type = NET_TYPE_VDE;
|
||||
else if (!strcmp(p, "tap") || !strcmp(p, "3"))
|
||||
else if (!strcmp(p, "tap") || !strcmp(p, "4"))
|
||||
nc->net_type = NET_TYPE_TAP;
|
||||
else
|
||||
nc->net_type = NET_TYPE_NONE;
|
||||
|
||||
@@ -94,6 +94,7 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
|
||||
intf_label->setVisible(true);
|
||||
break;
|
||||
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
case NET_TYPE_TAP:
|
||||
// option_list_label->setText("TAP Options");
|
||||
option_list_label->setVisible(true);
|
||||
@@ -101,6 +102,8 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
|
||||
|
||||
bridge_label->setVisible(true);
|
||||
bridge_line->setVisible(true);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case NET_TYPE_SLIRP:
|
||||
default:
|
||||
@@ -149,8 +152,10 @@ SettingsNetwork::save()
|
||||
strncpy(net_cards_conf[i].host_dev_name, network_devs[cbox->currentData().toInt()].device, sizeof(net_cards_conf[i].host_dev_name) - 1);
|
||||
else if (net_cards_conf[i].net_type == NET_TYPE_VDE)
|
||||
strncpy(net_cards_conf[i].host_dev_name, socket_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name));
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
else if (net_cards_conf[i].net_type == NET_TYPE_TAP)
|
||||
strncpy(net_cards_conf[i].host_dev_name, bridge_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +222,9 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
|
||||
if (network_devmap.has_vde)
|
||||
Models::AddEntry(model, "VDE", NET_TYPE_VDE);
|
||||
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
Models::AddEntry(model, "TAP", NET_TYPE_TAP);
|
||||
#endif
|
||||
|
||||
model->removeRows(0, removeRows);
|
||||
cbox->setCurrentIndex(cbox->findData(net_cards_conf[i].net_type));
|
||||
@@ -243,10 +250,12 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
|
||||
QString currentVdeSocket = net_cards_conf[i].host_dev_name;
|
||||
auto editline = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i+1));
|
||||
editline->setText(currentVdeSocket);
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
} else if (net_cards_conf[i].net_type == NET_TYPE_TAP) {
|
||||
QString currentTapDevice = net_cards_conf[i].host_dev_name;
|
||||
auto editline = findChild<QLineEdit *>(QString("bridgeTAPNIC%1").arg(i+1));
|
||||
editline->setText(currentTapDevice);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user