diff --git a/src/config.c b/src/config.c index 182b6bdf0..edd713755 100644 --- a/src/config.c +++ b/src/config.c @@ -910,11 +910,6 @@ load_network(void) nc->slirp_net[0] = '\0'; } - sprintf(temp, "net_%02i_switch_group", c + 1); - nc->switch_group = ini_section_get_int(cat, temp, NET_SWITCH_GRP_MIN); - if (nc->switch_group < NET_SWITCH_GRP_MIN) - nc->switch_group = NET_SWITCH_GRP_MIN; - sprintf(temp, "net_%02i_secret", c + 1); p = ini_section_get_string(cat, temp, NULL); strncpy(nc->secret, p ? p : "", sizeof(nc->secret) - 1); @@ -3024,12 +3019,6 @@ save_network(void) ini_section_delete_var(cat, temp); } - sprintf(temp, "net_%02i_switch_group", c + 1); - if (nc->switch_group == NET_SWITCH_GRP_MIN) - ini_section_delete_var(cat, temp); - else - ini_section_set_int(cat, temp, nc->switch_group); - sprintf(temp, "net_%02i_secret", c + 1); if (nc->secret[0] == '\0') ini_section_delete_var(cat, temp); diff --git a/src/include/86box/network.h b/src/include/86box/network.h index 78b03e439..d208cd345 100644 --- a/src/include/86box/network.h +++ b/src/include/86box/network.h @@ -60,8 +60,6 @@ #define NET_QUEUE_COUNT 4 #define NET_CARD_MAX 4 #define NET_HOST_INTF_MAX 64 -#define NET_SWITCH_GRP_MIN 1 -#define NET_SWITCH_GRP_MAX 10 #define NET_PERIOD_10M 0.8 #define NET_PERIOD_100M 0.08 @@ -97,7 +95,6 @@ typedef struct netcard_conf_t { int net_type; char host_dev_name[128]; uint32_t link_state; - uint8_t switch_group; char secret[256]; uint8_t promisc_mode; char slirp_net[16]; diff --git a/src/network/net_switch.c b/src/network/net_switch.c index 0f0d4b509..938443997 100644 --- a/src/network/net_switch.c +++ b/src/network/net_switch.c @@ -53,7 +53,7 @@ #define SWITCH_PKT_BATCH NET_QUEUE_LEN -#define SWITCH_MULTICAST_GROUP 0xefff5656 /* 239.255.86.86 */ +#define SWITCH_MULTICAST_GROUP 0xefff5056 /* 239.255.80.86 */ #define SWITCH_MULTICAST_PORT 8086 enum { @@ -478,8 +478,6 @@ net_switch_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char { netcard_conf_t *netcard = (netcard_conf_t *) priv; - netswitch_log("Network Switch: initializing with group %d...\n", netcard->switch_group); - net_switch_t *netswitch = calloc(1, sizeof(net_switch_t)); memcpy(netswitch->mac_addr, mac_addr, sizeof(netswitch->mac_addr)); netswitch->card = (netcard_t *) card; @@ -514,7 +512,7 @@ net_switch_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char val = 0; setsockopt(netswitch->socket_rx, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &val, sizeof(val)); - netswitch->port_out = htons(SWITCH_MULTICAST_PORT - NET_SWITCH_GRP_MIN + netcard->switch_group); + netswitch->port_out = htons(SWITCH_MULTICAST_PORT); struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr = { .s_addr = htonl(INADDR_ANY) }, diff --git a/src/qt/qt_settingsnetwork.cpp b/src/qt/qt_settingsnetwork.cpp index 878944e60..ff933fceb 100644 --- a/src/qt/qt_settingsnetwork.cpp +++ b/src/qt/qt_settingsnetwork.cpp @@ -49,13 +49,9 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) auto *option_list_label = findChild(QString("labelOptionList%1").arg(i + 1)); auto *option_list_line = findChild(QString("lineOptionList%1").arg(i + 1)); - // Switch group - auto *switch_group_label = findChild(QString("labelSwitch%1").arg(i + 1)); - // auto *switch_group_hlayout = findChild(QString("HLayoutSwitch%1").arg(i + 1)); - // auto *switch_group_hspacer = findChild(QString("horizontalSpacerSwitch%1").arg(i + 1)); - auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); - switch_group_value->setMinimum(NET_SWITCH_GRP_MIN); - switch_group_value->setMaximum(NET_SWITCH_GRP_MAX); + // Shared secret + auto *secret_label = findChild(QString("labelSecret%1").arg(i + 1)); + auto *secret_value = findChild(QString("secretSwitch%1").arg(i + 1)); // Promiscuous option auto *promisc_label = findChild(QString("labelPromisc%1").arg(i + 1)); @@ -73,10 +69,8 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) // NEW STUFF // Make all options invisible by default - // Switch group - switch_group_label->setVisible(false); - switch_group_value->setVisible(false); - // switch_group_hspacer->setVisible(false); + secret_label->setVisible(false); + secret_value->setVisible(false); // Promiscuous options promisc_label->setVisible(false); @@ -142,10 +136,9 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) option_list_label->setVisible(true); option_list_line->setVisible(true); - // Switch group - switch_group_label->setVisible(true); - switch_group_value->setVisible(true); - // switch_group_hspacer->setVisible(false); + // Shared secret + secret_label->setVisible(true); + secret_value->setVisible(true); // Promiscuous options promisc_label->setVisible(true); @@ -157,10 +150,9 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) option_list_label->setVisible(true); option_list_line->setVisible(true); - // Switch group - switch_group_label->setVisible(true); - switch_group_value->setVisible(true); - // switch_group_hspacer->setVisible(false); + // Shared secret + secret_label->setVisible(true); + secret_value->setVisible(true); // Hostname hostname_label->setVisible(true); @@ -215,7 +207,7 @@ SettingsNetwork::save() cbox = findChild(QString("comboBoxIntf%1").arg(i + 1)); auto *hostname_value = findChild(QString("hostnameSwitch%1").arg(i + 1)); auto *promisc_value = findChild(QString("boxPromisc%1").arg(i + 1)); - auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); + auto *secret_value = findChild(QString("secretSwitch%1").arg(i + 1)); memset(net_cards_conf[i].host_dev_name, '\0', sizeof(net_cards_conf[i].host_dev_name)); if (net_cards_conf[i].net_type == NET_TYPE_PCAP) strncpy(net_cards_conf[i].host_dev_name, network_devs[cbox->currentData().toInt()].device, sizeof(net_cards_conf[i].host_dev_name) - 1); @@ -230,10 +222,12 @@ SettingsNetwork::save() else if (net_cards_conf[i].net_type == NET_TYPE_NRSWITCH) { memset(net_cards_conf[i].nrs_hostname, '\0', sizeof(net_cards_conf[i].nrs_hostname)); strncpy(net_cards_conf[i].nrs_hostname, hostname_value->text().toUtf8().constData(), sizeof(net_cards_conf[i].nrs_hostname) - 1); - net_cards_conf[i].switch_group = switch_group_value->value(); + memset(net_cards_conf[i].secret, '\0', sizeof(net_cards_conf[i].secret)); + strncpy(net_cards_conf[i].secret, secret_value->text().toUtf8().constData(), sizeof(net_cards_conf[i].secret) - 1); } else if (net_cards_conf[i].net_type == NET_TYPE_NLSWITCH) { net_cards_conf[i].promisc_mode = promisc_value->isChecked(); - net_cards_conf[i].switch_group = switch_group_value->value(); + memset(net_cards_conf[i].secret, '\0', sizeof(net_cards_conf[i].secret)); + strncpy(net_cards_conf[i].secret, secret_value->text().toUtf8().constData(), sizeof(net_cards_conf[i].secret) - 1); } } } @@ -349,13 +343,13 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) } else if (net_cards_conf[i].net_type == NET_TYPE_NLSWITCH) { auto *promisc_value = findChild(QString("boxPromisc%1").arg(i + 1)); promisc_value->setCheckState(net_cards_conf[i].promisc_mode == 1 ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); - auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); - switch_group_value->setValue(net_cards_conf[i].switch_group); + auto *secret_value = findChild(QString("secretSwitch%1").arg(i + 1)); + secret_value->setText(net_cards_conf[i].secret); } else if (net_cards_conf[i].net_type == NET_TYPE_NRSWITCH) { auto *hostname_value = findChild(QString("hostnameSwitch%1").arg(i + 1)); hostname_value->setText(net_cards_conf[i].nrs_hostname); - auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); - switch_group_value->setValue(net_cards_conf[i].switch_group); + auto *secret_value = findChild(QString("secretSwitch%1").arg(i + 1)); + secret_value->setText(net_cards_conf[i].secret); } } } diff --git a/src/qt/qt_settingsnetwork.ui b/src/qt/qt_settingsnetwork.ui index 12b74004f..5f7bd316a 100644 --- a/src/qt/qt_settingsnetwork.ui +++ b/src/qt/qt_settingsnetwork.ui @@ -170,38 +170,18 @@ - + - Switch: + Shared secret: - - - - - 1 - - - 10 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + 256 + + @@ -385,38 +365,18 @@ - + - Switch: + Shared secret: - - - - - 1 - - - 10 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + 256 + + @@ -600,38 +560,18 @@ - + - Switch: + Shared secret: - - - - - 1 - - - 10 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + 256 + + @@ -815,38 +755,18 @@ - + - Switch: + Shared secret: - - - - - 1 - - - 10 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + 256 + +