Testing changes to support wireless network adapters configuration.

All network setup GUI related code now part of gui/network_setup.cpp,
old code in setting_helpers.cpp commented.
Removed recursive menu call in network setup gui.
When compiled with -DDEBUG, ifup/ifdown not executed, only printed.


git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1305 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2011-03-16 12:57:09 +00:00
parent c49b09e7c9
commit 18f85cd9cd
5 changed files with 482 additions and 83 deletions

View File

@@ -32,6 +32,7 @@
#include <config.h> #include <config.h>
#endif #endif
#include <dirent.h>
#include "gui/network_setup.h" #include "gui/network_setup.h"
#include "gui/proxyserver_setup.h" #include "gui/proxyserver_setup.h"
@@ -50,17 +51,20 @@
#include <system/debug.h> #include <system/debug.h>
#include <libnet.h>
extern "C" int pinghost( const char *hostname );
CNetworkSetup::CNetworkSetup(bool wizard_mode) CNetworkSetup::CNetworkSetup(bool wizard_mode)
{ {
networkConfig = CNetworkConfig::getInstance(); networkConfig = CNetworkConfig::getInstance();
is_wizard = wizard_mode; is_wizard = wizard_mode;
width = w_max (40, 10); width = w_max (40, 10);
selected = -1; selected = -1;
readNetworkSettings(); //readNetworkSettings();
} }
CNetworkSetup::~CNetworkSetup() CNetworkSetup::~CNetworkSetup()
@@ -68,33 +72,32 @@ CNetworkSetup::~CNetworkSetup()
//delete networkConfig; //delete networkConfig;
} }
int CNetworkSetup::exec(CMenuTarget* parent, const std::string &actionKey) int CNetworkSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{ {
int res = menu_return::RETURN_REPAINT; int res = menu_return::RETURN_REPAINT;
if (parent) if (parent)
{
parent->hide(); parent->hide();
}
if(actionKey=="networkapply") if(actionKey=="networkapply")
{ {
applyNetworkSettings(); applyNetworkSettings();
readNetworkSettings(); readNetworkSettings();
showNetworkSetup(); backupNetworkSettings();
return menu_return::RETURN_EXIT; return res;
} }
else if(actionKey=="networktest") else if(actionKey=="networktest")
{ {
printf("[network setup] doing network test...\n"); printf("[network setup] doing network test...\n");
#if 0
testNetworkSettings( networkConfig->address.c_str(), testNetworkSettings( networkConfig->address.c_str(),
networkConfig->netmask.c_str(), networkConfig->netmask.c_str(),
networkConfig->broadcast.c_str(), networkConfig->broadcast.c_str(),
networkConfig->gateway.c_str(), networkConfig->gateway.c_str(),
networkConfig->nameserver.c_str(), networkConfig->nameserver.c_str(),
networkConfig->inet_static); networkConfig->inet_static);
#endif
testNetworkSettings();
return res; return res;
} }
else if(actionKey=="networkshow") else if(actionKey=="networkshow")
@@ -111,10 +114,11 @@ int CNetworkSetup::exec(CMenuTarget* parent, const std::string &actionKey)
NEUTRINO_ICON_QUESTION, NEUTRINO_ICON_QUESTION,
width); width);
if (result == 0) //yes if (result == CMessageBox::mbrYes) {
restoreNetworkSettings(); restoreNetworkSettings();
}
return res;
} }
printf("[neutrino] init network setup...\n"); printf("[neutrino] init network setup...\n");
showNetworkSetup(); showNetworkSetup();
@@ -122,7 +126,6 @@ int CNetworkSetup::exec(CMenuTarget* parent, const std::string &actionKey)
return res; return res;
} }
void CNetworkSetup::readNetworkSettings() void CNetworkSetup::readNetworkSettings()
{ {
network_automatic_start = networkConfig->automatic_start; network_automatic_start = networkConfig->automatic_start;
@@ -134,16 +137,26 @@ void CNetworkSetup::readNetworkSettings()
network_nameserver = networkConfig->nameserver; network_nameserver = networkConfig->nameserver;
network_gateway = networkConfig->gateway; network_gateway = networkConfig->gateway;
network_hostname = networkConfig->hostname; network_hostname = networkConfig->hostname;
mac_addr = networkConfig->mac_addr;
network_ssid = networkConfig->ssid;
network_key = networkConfig->key;
}
void CNetworkSetup::backupNetworkSettings()
{
old_network_automatic_start = networkConfig->automatic_start; old_network_automatic_start = networkConfig->automatic_start;
old_network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON; old_network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON;
old_network_address = networkConfig->address; old_network_address = networkConfig->address;
old_network_netmask = networkConfig->netmask; old_network_netmask = networkConfig->netmask;
old_network_broadcast = networkConfig->broadcast; old_network_broadcast = networkConfig->broadcast;
old_network_nameserver = networkConfig->nameserver; old_network_nameserver = networkConfig->nameserver;
old_network_gateway = networkConfig->gateway; old_network_gateway = networkConfig->gateway;
old_network_hostname = networkConfig->hostname; old_network_hostname = networkConfig->hostname;
old_network_ssid = networkConfig->ssid;
old_network_key = networkConfig->key;
old_ifname = g_settings.ifname;
old_mac_addr = mac_addr;
} }
#define OPTIONS_NTPENABLE_OPTION_COUNT 2 #define OPTIONS_NTPENABLE_OPTION_COUNT 2
@@ -153,10 +166,19 @@ const CMenuOptionChooser::keyval OPTIONS_NTPENABLE_OPTIONS[OPTIONS_NTPENABLE_OPT
{ CNetworkSetup::NETWORK_NTP_ON, LOCALE_OPTIONS_NTP_ON } { CNetworkSetup::NETWORK_NTP_ON, LOCALE_OPTIONS_NTP_ON }
}; };
static int my_filter(const struct dirent * dent)
{
if(dent->d_name[0] == 'l' && dent->d_name[1] == 'o')
return 0;
if(dent->d_name[0] == '.')
return 0;
return 1;
}
void CNetworkSetup::showNetworkSetup() void CNetworkSetup::showNetworkSetup()
{ {
struct dirent **namelist;
//menue init //menue init
CMenuWidget* networkSettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width); CMenuWidget* networkSettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width);
networkSettings->setWizardMode(is_wizard); networkSettings->setWizardMode(is_wizard);
@@ -164,11 +186,13 @@ void CNetworkSetup::showNetworkSetup()
//apply button //apply button
CMenuForwarder *m0 = new CMenuForwarder(LOCALE_NETWORKMENU_SETUPNOW, true, NULL, this, "networkapply", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); CMenuForwarder *m0 = new CMenuForwarder(LOCALE_NETWORKMENU_SETUPNOW, true, NULL, this, "networkapply", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED);
networkConfig->readConfig(g_settings.ifname);
readNetworkSettings();
backupNetworkSettings();
//eth id //eth id
static CNetAdapter netadapter; CMenuForwarder *mac = new CMenuForwarderNonLocalized("MAC", false, mac_addr);
std::string eth_id = netadapter.getMacAddr();
CMenuForwarder *mac = new CMenuForwarderNonLocalized("MAC", false, eth_id.c_str());
//prepare input entries //prepare input entries
CIPInput * networkSettings_NetworkIP = new CIPInput(LOCALE_NETWORKMENU_IPADDRESS , network_address , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, this); CIPInput * networkSettings_NetworkIP = new CIPInput(LOCALE_NETWORKMENU_IPADDRESS , network_address , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, this);
@@ -180,9 +204,22 @@ void CNetworkSetup::showNetworkSetup()
//hostname //hostname
CStringInputSMS * networkSettings_Hostname = new CStringInputSMS(LOCALE_NETWORKMENU_HOSTNAME, &network_hostname, 30, LOCALE_NETWORKMENU_NTPSERVER_HINT1, LOCALE_NETWORKMENU_NTPSERVER_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-. "); CStringInputSMS * networkSettings_Hostname = new CStringInputSMS(LOCALE_NETWORKMENU_HOSTNAME, &network_hostname, 30, LOCALE_NETWORKMENU_NTPSERVER_HINT1, LOCALE_NETWORKMENU_NTPSERVER_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-. ");
//if select
int ifcount = scandir("/sys/class/net", &namelist, my_filter, alphasort);
CMenuOptionStringChooser * ifSelect = new CMenuOptionStringChooser(LOCALE_NETWORKMENU_SELECT_IF, g_settings.ifname, ifcount > 1, this, CRCInput::RC_nokey, "", true);
for(int i = 0; i < ifcount; i++) {
ifSelect->addOption(namelist[i]->d_name);
free(namelist[i]);
}
if (ifcount >= 0)
free(namelist);
//auto start //auto start
CMenuOptionChooser* o1 = new CMenuOptionChooser(LOCALE_NETWORKMENU_SETUPONSTARTUP, &network_automatic_start, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); CMenuOptionChooser* o1 = new CMenuOptionChooser(LOCALE_NETWORKMENU_SETUPONSTARTUP, &network_automatic_start, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
CStringInputSMS * networkSettings_ssid = new CStringInputSMS(LOCALE_NETWORKMENU_SSID, &network_ssid, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-. ");
CStringInputSMS * networkSettings_key = new CStringInputSMS(LOCALE_NETWORKMENU_PASSWORD, &network_key, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-. ");
//dhcp //dhcp
network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON; network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON;
@@ -192,10 +229,22 @@ void CNetworkSetup::showNetworkSetup()
CMenuForwarder *m4 = new CMenuForwarder(LOCALE_NETWORKMENU_GATEWAY , networkConfig->inet_static, network_gateway , networkSettings_Gateway ); CMenuForwarder *m4 = new CMenuForwarder(LOCALE_NETWORKMENU_GATEWAY , networkConfig->inet_static, network_gateway , networkSettings_Gateway );
CMenuForwarder *m5 = new CMenuForwarder(LOCALE_NETWORKMENU_NAMESERVER, networkConfig->inet_static, network_nameserver, networkSettings_NameServer); CMenuForwarder *m5 = new CMenuForwarder(LOCALE_NETWORKMENU_NAMESERVER, networkConfig->inet_static, network_nameserver, networkSettings_NameServer);
CMenuForwarder *m8 = new CMenuForwarder(LOCALE_NETWORKMENU_HOSTNAME , !networkConfig->inet_static, network_hostname , networkSettings_Hostname ); CMenuForwarder *m8 = new CMenuForwarder(LOCALE_NETWORKMENU_HOSTNAME , !networkConfig->inet_static, network_hostname , networkSettings_Hostname );
CDHCPNotifier* dhcpNotifier = new CDHCPNotifier(m1,m2,m3,m4,m5,m8); dhcpDisable[0] = m1;
CMenuOptionChooser* o2 = new CMenuOptionChooser(LOCALE_NETWORKMENU_DHCP, &network_dhcp, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, dhcpNotifier); dhcpDisable[1] = m2;
dhcpDisable[2] = m3;
dhcpDisable[3] = m4;
dhcpDisable[4] = m5;
dhcpEnable[0] = m8;
CMenuForwarder *m9 = new CMenuForwarder(LOCALE_NETWORKMENU_SSID , networkConfig->wireless, network_ssid , networkSettings_ssid );
CMenuForwarder *m10 = new CMenuForwarder(LOCALE_NETWORKMENU_PASSWORD , networkConfig->wireless, network_key , networkSettings_key );
wlanEnable[0] = m9;
wlanEnable[1] = m10;
CMenuOptionChooser* o2 = new CMenuOptionChooser(LOCALE_NETWORKMENU_DHCP, &network_dhcp, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
//paint menu items //paint menu items
networkSettings->addIntroItems(LOCALE_MAINSETTINGS_NETWORK); //intros networkSettings->addIntroItems(LOCALE_MAINSETTINGS_NETWORK); //intros
//------------------------------------------------- //-------------------------------------------------
@@ -203,7 +252,9 @@ void CNetworkSetup::showNetworkSetup()
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_TEST, true, NULL, this, "networktest", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); //test networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_TEST, true, NULL, this, "networktest", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); //test
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_SHOW, true, NULL, this, "networkshow", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP)); //show settings networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_SHOW, true, NULL, this, "networkshow", CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP)); //show settings
networkSettings->addItem(GenericMenuSeparatorLine); networkSettings->addItem(GenericMenuSeparatorLine);
//------------------------------------------------- //------------------------------------------------
if(ifcount)
networkSettings->addItem(ifSelect); //if select
networkSettings->addItem(o1); //set on start networkSettings->addItem(o1); //set on start
networkSettings->addItem(GenericMenuSeparatorLine); networkSettings->addItem(GenericMenuSeparatorLine);
//------------------------------------------------ //------------------------------------------------
@@ -223,6 +274,12 @@ void CNetworkSetup::showNetworkSetup()
networkSettings->addItem( m5); //nameserver networkSettings->addItem( m5); //nameserver
networkSettings->addItem(GenericMenuSeparatorLine); networkSettings->addItem(GenericMenuSeparatorLine);
//------------------------------------------------ //------------------------------------------------
if(ifcount > 1) { // if there is only one, its probably wired
networkSettings->addItem( m9); //ssid
networkSettings->addItem( m10); //key
networkSettings->addItem(GenericMenuSeparatorLine);
}
//------------------------------------------------
//ntp submenu //ntp submenu
CMenuWidget* ntp = new CMenuWidget(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width); CMenuWidget* ntp = new CMenuWidget(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width);
networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_NTPTITLE, true, NULL, ntp, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); networkSettings->addItem(new CMenuForwarder(LOCALE_NETWORKMENU_NTPTITLE, true, NULL, ntp, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
@@ -236,16 +293,18 @@ void CNetworkSetup::showNetworkSetup()
//proxyserver submenu //proxyserver submenu
networkSettings->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_PROXYSERVER_SEP, true, NULL, new CProxySetup(LOCALE_MAINSETTINGS_NETWORK), NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0)); networkSettings->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_PROXYSERVER_SEP, true, NULL, new CProxySetup(LOCALE_MAINSETTINGS_NETWORK), NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0));
while(true) {
networkSettings->exec(NULL, ""); int res = menu_return::RETURN_EXIT;
networkSettings->hide(); networkSettings->exec(NULL, "");
networkSettings->hide();
if (settingsChanged())
res = saveChangesDialog();
if(res == menu_return::RETURN_EXIT)
break;
}
selected = networkSettings->getSelected(); selected = networkSettings->getSelected();
delete networkSettings; delete networkSettings;
// Check for changes
if (settingsChanged())
saveChangesDialog();
} }
void CNetworkSetup::showNetworkNTPSetup(CMenuWidget *menu_ntp) void CNetworkSetup::showNetworkNTPSetup(CMenuWidget *menu_ntp)
@@ -273,7 +332,6 @@ void CNetworkSetup::showNetworkNFSMounts(CMenuWidget *menu_nfs)
menu_nfs->addItem(new CMenuForwarder(LOCALE_NFS_UMOUNT, true, NULL, new CNFSUmountGui(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); menu_nfs->addItem(new CMenuForwarder(LOCALE_NFS_UMOUNT, true, NULL, new CNFSUmountGui(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
} }
typedef struct n_isettings_t typedef struct n_isettings_t
{ {
int old_network_setting; int old_network_setting;
@@ -289,13 +347,16 @@ bool CNetworkSetup::checkIntSettings()
{old_network_dhcp, network_dhcp } {old_network_dhcp, network_dhcp }
}; };
for (uint i = 0; i < (sizeof(n_isettings) / sizeof(n_isettings[0])); i++) for (uint i = 0; i < (sizeof(n_isettings) / sizeof(n_isettings[0])); i++)
if (n_isettings[i].old_network_setting != n_isettings[i].network_setting) if (n_isettings[i].old_network_setting != n_isettings[i].network_setting) {
#ifdef DEBUG
printf("CNetworkSetup::checkIntSettings: %d %d -> %d\n", i, n_isettings[i].old_network_setting, n_isettings[i].network_setting);
#endif
return true; return true;
}
return false; return false;
} }
typedef struct n_ssettings_t typedef struct n_ssettings_t
{ {
std::string old_network_setting; std::string old_network_setting;
@@ -312,12 +373,21 @@ bool CNetworkSetup::checkStringSettings()
{old_network_broadcast, network_broadcast }, {old_network_broadcast, network_broadcast },
{old_network_gateway, network_gateway }, {old_network_gateway, network_gateway },
{old_network_nameserver, network_nameserver }, {old_network_nameserver, network_nameserver },
{old_network_hostname, network_hostname } {old_network_hostname, network_hostname },
{old_ifname, g_settings.ifname }
}; };
for (uint i = 0; i < (sizeof(n_ssettings) / sizeof(n_ssettings[0])); i++) for (uint i = 0; i < (sizeof(n_ssettings) / sizeof(n_ssettings[0])); i++)
if (n_ssettings[i].old_network_setting != n_ssettings[i].network_setting) if (n_ssettings[i].old_network_setting != n_ssettings[i].network_setting) {
return true; #ifdef DEBUG
printf("CNetworkSetup::checkStringSettings: %d: %s -> %s\n", i, n_ssettings[i].old_network_setting.c_str(), n_ssettings[i].network_setting.c_str());
#endif
return true;
}
if(CNetworkConfig::getInstance()->wireless) {
if((old_network_ssid != network_ssid) || (old_network_key != network_key))
return true;
}
return false; return false;
} }
@@ -340,8 +410,12 @@ void CNetworkSetup::prepareSettings()
networkConfig->broadcast = network_broadcast; networkConfig->broadcast = network_broadcast;
networkConfig->gateway = network_gateway; networkConfig->gateway = network_gateway;
networkConfig->nameserver = network_nameserver; networkConfig->nameserver = network_nameserver;
networkConfig->hostname = network_hostname;
networkConfig->ssid = network_ssid;
networkConfig->key = network_key;
readNetworkSettings(); readNetworkSettings();
backupNetworkSettings();
} }
typedef struct n_settings_t typedef struct n_settings_t
@@ -368,10 +442,9 @@ bool CNetworkSetup::checkForIP()
{ {
if (n_settings[i].network_settings.empty()) //no definied setting if (n_settings[i].network_settings.empty()) //no definied setting
{ {
printf("[network setup] empty address ...\n"); printf("[network setup] empty address %s\n", g_Locale->getText(n_settings[i].addr_name));
char msg[64]; char msg[64];
snprintf(msg, 64, g_Locale->getText(LOCALE_NETWORKMENU_ERROR_NO_ADDRESS), g_Locale->getText(n_settings[i].addr_name)); snprintf(msg, 64, g_Locale->getText(LOCALE_NETWORKMENU_ERROR_NO_ADDRESS), g_Locale->getText(n_settings[i].addr_name));
ShowMsgUTF(LOCALE_MAINSETTINGS_NETWORK, msg, CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_ERROR, width); ShowMsgUTF(LOCALE_MAINSETTINGS_NETWORK, msg, CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_ERROR, width);
return false; return false;
} }
@@ -411,8 +484,8 @@ void CNetworkSetup::applyNetworkSettings()
//open a message dialog with buttons, //open a message dialog with buttons,
//yes: applies networksettings and exit network setup //yes: applies networksettings and exit network setup
//no: saves networksettings and exit network setup //no: ask to restore networksettings, and return to menu
void CNetworkSetup::saveChangesDialog() int CNetworkSetup::saveChangesDialog()
{ {
// Save the settings after changes, if user wants to! // Save the settings after changes, if user wants to!
int result = ShowMsgUTF(LOCALE_MAINSETTINGS_NETWORK, g_Locale->getText(LOCALE_NETWORKMENU_APPLY_SETTINGS_NOW), CMessageBox::mbrYes, int result = ShowMsgUTF(LOCALE_MAINSETTINGS_NETWORK, g_Locale->getText(LOCALE_NETWORKMENU_APPLY_SETTINGS_NOW), CMessageBox::mbrYes,
@@ -420,26 +493,30 @@ void CNetworkSetup::saveChangesDialog()
CMessageBox::mbNo , CMessageBox::mbNo ,
NEUTRINO_ICON_QUESTION, NEUTRINO_ICON_QUESTION,
width); width);
//check for missing ip settings
if (!checkForIP())
result = CMessageBox::mbrNo; //restore
switch(result) switch(result)
{ {
case CMessageBox::mbrYes: case CMessageBox::mbrYes:
exec(NULL, "networkapply"); if (!checkForIP())
return menu_return::RETURN_REPAINT;
return exec(NULL, "networkapply");
break; break;
case CMessageBox::mbrNo: //no case CMessageBox::mbrNo: //no
exec(NULL, "restore"); return exec(NULL, "restore");
break; break;
} }
return menu_return::RETURN_REPAINT;
} }
//restores settings //restores settings
void CNetworkSetup::restoreNetworkSettings() void CNetworkSetup::restoreNetworkSettings()
{ {
snprintf(g_settings.ifname, sizeof(g_settings.ifname), "%s", old_ifname.c_str());
networkConfig->readConfig(g_settings.ifname);//FIXME ?
mac_addr = networkConfig->mac_addr;
network_automatic_start = old_network_automatic_start; network_automatic_start = old_network_automatic_start;
network_dhcp = old_network_dhcp; network_dhcp = old_network_dhcp;
network_address = old_network_address; network_address = old_network_address;
@@ -447,6 +524,9 @@ void CNetworkSetup::restoreNetworkSettings()
network_broadcast = old_network_broadcast; network_broadcast = old_network_broadcast;
network_nameserver = old_network_nameserver; network_nameserver = old_network_nameserver;
network_gateway = old_network_gateway; network_gateway = old_network_gateway;
network_hostname = old_network_hostname;
network_ssid = old_network_ssid;
network_key = old_network_key;
networkConfig->automatic_start = network_automatic_start; networkConfig->automatic_start = network_automatic_start;
networkConfig->inet_static = (network_dhcp ? false : true); networkConfig->inet_static = (network_dhcp ? false : true);
@@ -455,23 +535,49 @@ void CNetworkSetup::restoreNetworkSettings()
networkConfig->broadcast = network_broadcast; networkConfig->broadcast = network_broadcast;
networkConfig->gateway = network_gateway; networkConfig->gateway = network_gateway;
networkConfig->nameserver = network_nameserver; networkConfig->nameserver = network_nameserver;
networkConfig->hostname = network_hostname;
networkConfig->ssid = network_ssid;
networkConfig->key = network_key;
networkConfig->commitConfig(); networkConfig->commitConfig();
} }
bool CNetworkSetup::changeNotify(const neutrino_locale_t, void * Data) bool CNetworkSetup::changeNotify(const neutrino_locale_t locale, void * Data)
{ {
char ip[16]; if(locale == LOCALE_NETWORKMENU_IPADDRESS) {
unsigned char _ip[4]; char ip[16];
sscanf((char*) Data, "%hhu.%hhu.%hhu.%hhu", &_ip[0], &_ip[1], &_ip[2], &_ip[3]); unsigned char _ip[4];
sscanf((char*) Data, "%hhu.%hhu.%hhu.%hhu", &_ip[0], &_ip[1], &_ip[2], &_ip[3]);
sprintf(ip, "%hhu.%hhu.%hhu.255", _ip[0], _ip[1], _ip[2]); sprintf(ip, "%hhu.%hhu.%hhu.255", _ip[0], _ip[1], _ip[2]);
networkConfig->broadcast = ip; networkConfig->broadcast = ip;
network_broadcast = networkConfig->broadcast; network_broadcast = networkConfig->broadcast;
networkConfig->netmask = (_ip[0] == 10) ? "255.0.0.0" : "255.255.255.0"; networkConfig->netmask = (_ip[0] == 10) ? "255.0.0.0" : "255.255.255.0";
network_netmask = networkConfig->netmask; network_netmask = networkConfig->netmask;
} else if(locale == LOCALE_NETWORKMENU_SELECT_IF) {
networkConfig->readConfig(g_settings.ifname);
readNetworkSettings();
printf("CNetworkSetup::changeNotify: using %s, static %d\n", g_settings.ifname, CNetworkConfig::getInstance()->inet_static);
changeNotify(LOCALE_NETWORKMENU_DHCP, &CNetworkConfig::getInstance()->inet_static);
int ecnt = sizeof(wlanEnable) / sizeof(CMenuForwarder*);
for(int i = 0; i < ecnt; i++)
wlanEnable[i]->setActive(CNetworkConfig::getInstance()->wireless);
} else if(locale == LOCALE_NETWORKMENU_DHCP) {
CNetworkConfig::getInstance()->inet_static = (network_dhcp == NETWORK_DHCP_OFF);
int ecnt = sizeof(dhcpDisable) / sizeof(CMenuForwarder*);
for(int i = 0; i < ecnt; i++)
dhcpDisable[i]->setActive(CNetworkConfig::getInstance()->inet_static);
ecnt = sizeof(dhcpEnable) / sizeof(CMenuForwarder*);
for(int i = 0; i < ecnt; i++)
dhcpEnable[i]->setActive(!CNetworkConfig::getInstance()->inet_static);
}
return true; return true;
} }
@@ -480,4 +586,125 @@ void CNetworkSetup::setWizardMode(bool mode)
{ {
printf("[neutrino network setup] %s set network settings menu to mode %d...\n", __FUNCTION__, mode); printf("[neutrino network setup] %s set network settings menu to mode %d...\n", __FUNCTION__, mode);
is_wizard = mode; is_wizard = mode;
} }
void CNetworkSetup::showCurrentNetworkSettings()
{
char ip[16];
char mask[16];
char broadcast[16];
char router[16];
char nameserver[16];
std::string text;
netGetIP(g_settings.ifname, ip, mask, broadcast);
if (ip[0] == 0) {
text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE_NETWORK);
}
else {
netGetNameserver(nameserver);
netGetDefaultRoute(router);
CNetworkConfig networkConfig;
std::string dhcp = networkConfig.inet_static ? g_Locale->getText(LOCALE_OPTIONS_OFF) : g_Locale->getText(LOCALE_OPTIONS_ON);
text = (std::string)g_Locale->getText(LOCALE_NETWORKMENU_DHCP) + ": " + dhcp + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_IPADDRESS ) + ": " + ip + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_NETMASK ) + ": " + mask + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_BROADCAST ) + ": " + broadcast + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER) + ": " + nameserver + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY ) + ": " + router;
}
ShowMsgUTF(LOCALE_NETWORKMENU_SHOW, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8
}
const char * CNetworkSetup::mypinghost(const char * const host)
{
int retvalue = pinghost(host);
switch (retvalue)
{
case 1: return (g_Locale->getText(LOCALE_PING_OK));
case 0: return (g_Locale->getText(LOCALE_PING_UNREACHABLE));
case -1: return (g_Locale->getText(LOCALE_PING_PROTOCOL));
case -2: return (g_Locale->getText(LOCALE_PING_SOCKET));
}
return "";
}
void CNetworkSetup::testNetworkSettings()
{
char our_ip[16];
char our_mask[16];
char our_broadcast[16];
char our_gateway[16];
char our_nameserver[16];
std::string text, testsite;
//set default testdomain and wiki-IP
std::string defaultsite = "www.google.de", wiki_IP = "89.31.143.1";
//get www-domain testsite from /.version
CConfigFile config('\t');
config.loadConfig("/.version");
testsite = config.getString("homepage",defaultsite);
testsite.replace( 0, testsite.find("www",0), "" );
//use default testdomain if testsite missing
if (testsite.length()==0)
testsite = defaultsite;
if (networkConfig->inet_static)
{
strcpy(our_ip, networkConfig->address.c_str());
strcpy(our_mask, networkConfig->netmask.c_str());
strcpy(our_broadcast, networkConfig->broadcast.c_str());
strcpy(our_gateway, networkConfig->gateway.c_str());
strcpy(our_nameserver, networkConfig->nameserver.c_str());
}
else
{
// FIXME test with current, not changed ifname ?
netGetIP((char *) old_ifname.c_str(), our_ip, our_mask, our_broadcast);
netGetDefaultRoute(our_gateway);
netGetNameserver(our_nameserver);
}
printf("testNw IP: %s\n", our_ip);
printf("testNw MAC-address: %s\n", old_mac_addr.c_str());
printf("testNw Netmask: %s\n", our_mask);
printf("testNw Broadcast: %s\n", our_broadcast);
printf("testNw Gateway: %s\n", our_gateway);
printf("testNw Nameserver: %s\n", our_nameserver);
printf("testNw Testsite %s\n", testsite.c_str());
if (our_ip[0] == 0)
{
text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE_NETWORK);
}
else
{
text = "Box: " + old_mac_addr + "\n ";
text += (std::string)our_ip + " " + (std::string)mypinghost(our_ip);
text += "\n";
text += g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY);
text += " (Router)\n ";
text += (std::string)our_gateway + " " +(std::string)mypinghost(our_gateway);
text += "\n";
text += g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER);
text += "\n ";
text += (std::string)our_nameserver + " " + (std::string)mypinghost(our_nameserver);
text += "\n";
text += "wiki.neutrino-hd.de:\n ";
text += "via IP (" + wiki_IP + "): " + (std::string)mypinghost(wiki_IP.c_str());
text += ":\n ";
if (1 == pinghost(our_nameserver))
{
text += "via DNS: " + (std::string)mypinghost("wiki.neutrino-hd.de");
text += "\n";
text += testsite + ":\n ";
text += "via DNS: " + (std::string)mypinghost(testsite.c_str()) + ":\n";
}
}
ShowMsgUTF(LOCALE_NETWORKMENU_TEST, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8
}

View File

@@ -57,6 +57,9 @@ class CNetworkSetup : public CMenuTarget, CChangeObserver
std::string network_nameserver; std::string network_nameserver;
std::string network_gateway; std::string network_gateway;
std::string network_hostname; std::string network_hostname;
std::string network_ssid;
std::string network_key;
std::string mac_addr;
int old_network_dhcp; int old_network_dhcp;
int old_network_automatic_start; int old_network_automatic_start;
@@ -66,14 +69,24 @@ class CNetworkSetup : public CMenuTarget, CChangeObserver
std::string old_network_nameserver; std::string old_network_nameserver;
std::string old_network_gateway; std::string old_network_gateway;
std::string old_network_hostname; std::string old_network_hostname;
std::string old_ifname;
std::string old_network_ssid;
std::string old_network_key;
std::string old_mac_addr;
CMenuForwarder* dhcpDisable[5];
CMenuForwarder* dhcpEnable[1];
CMenuForwarder* wlanEnable[2];
void restoreNetworkSettings(); void restoreNetworkSettings();
void prepareSettings(); void prepareSettings();
void readNetworkSettings(); void readNetworkSettings();
void backupNetworkSettings();
void showNetworkSetup(); void showNetworkSetup();
void showNetworkNTPSetup(CMenuWidget *menu_ntp); void showNetworkNTPSetup(CMenuWidget *menu_ntp);
void showNetworkNFSMounts(CMenuWidget *menu_nfs); void showNetworkNFSMounts(CMenuWidget *menu_nfs);
void saveChangesDialog(); int saveChangesDialog();
void applyNetworkSettings(); void applyNetworkSettings();
void saveNetworkSettings(); void saveNetworkSettings();
@@ -81,6 +94,7 @@ class CNetworkSetup : public CMenuTarget, CChangeObserver
bool checkStringSettings(); bool checkStringSettings();
bool checkForIP(); bool checkForIP();
bool settingsChanged(); bool settingsChanged();
const char * mypinghost(const char * const host);
public: public:
enum NETWORK_DHCP_MODE enum NETWORK_DHCP_MODE
@@ -115,6 +129,8 @@ class CNetworkSetup : public CMenuTarget, CChangeObserver
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
virtual bool changeNotify(const neutrino_locale_t, void * Data); virtual bool changeNotify(const neutrino_locale_t, void * Data);
void showCurrentNetworkSettings();
void testNetworkSettings();
}; };

View File

@@ -21,21 +21,23 @@
#include <config.h> #include <config.h>
#include <cstdio> /* perror... */ #include <cstdio> /* perror... */
#include <sys/wait.h> #include <sys/wait.h>
#include <string.h>
#include "configure_network.h" #include "configure_network.h"
#include "libnet.h" /* netGetNameserver, netSetNameserver */ #include "libnet.h" /* netGetNameserver, netSetNameserver */
#include "network_interfaces.h" /* getInetAttributes, setInetAttributes */ #include "network_interfaces.h" /* getInetAttributes, setInetAttributes */
#include <stdlib.h> /* system */ #include <stdlib.h> /* system */
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
CNetworkConfig::CNetworkConfig(void) CNetworkConfig::CNetworkConfig()
{ {
char our_nameserver[16]; char our_nameserver[16];
netGetNameserver(our_nameserver); netGetNameserver(our_nameserver);
nameserver = our_nameserver; nameserver = our_nameserver;
inet_static = getInetAttributes("eth0", automatic_start, address, netmask, broadcast, gateway); ifname = "eth0";
init_vars();
copy_to_orig();
} }
CNetworkConfig* CNetworkConfig::getInstance() CNetworkConfig* CNetworkConfig::getInstance()
@@ -52,9 +54,16 @@ CNetworkConfig* CNetworkConfig::getInstance()
CNetworkConfig::~CNetworkConfig() CNetworkConfig::~CNetworkConfig()
{ {
} }
void CNetworkConfig::readConfig(std::string iname)
{
ifname = iname;
inet_static = getInetAttributes(ifname, automatic_start, address, netmask, broadcast, gateway);
init_vars();
copy_to_orig();
}
void CNetworkConfig::init_vars(void) void CNetworkConfig::init_vars(void)
{ {
@@ -62,15 +71,41 @@ void CNetworkConfig::init_vars(void)
char _broadcast[16]; char _broadcast[16];
char router[16]; char router[16];
char ip[16]; char ip[16];
unsigned char addr[6];
hostname = netGetHostname(); hostname = netGetHostname();
netGetDefaultRoute(router); netGetDefaultRoute(router);
gateway = router; gateway = router;
netGetIP((char *) "eth0", ip, mask, _broadcast);
netmask = mask; /* FIXME its enough to read IP for dhcp only ?
broadcast = _broadcast; * static config should not be different from settings in etc/network/interfaces */
address = ip; if(!inet_static) {
netGetIP((char *) ifname.c_str(), ip, mask, _broadcast);
netmask = mask;
broadcast = _broadcast;
address = ip;
}
netGetMacAddr((char *) ifname.c_str(), addr);
std::stringstream mac_tmp;
for(int i=0;i<6;++i)
mac_tmp<<std::hex<<std::setfill('0')<<std::setw(2)<<(int)addr[i]<<':';
mac_addr = mac_tmp.str().substr(0,17);
key = "";
ssid = "";
wireless = 0;
std::string tmp = "/sys/class/net/" + ifname + "/wireless";
if(access(tmp.c_str(), R_OK) == 0)
wireless = 1;
if(wireless)
readWpaConfig();
printf("CNetworkConfig: %s loaded, wireless %s\n", ifname.c_str(), wireless ? "yes" : "no");
} }
void CNetworkConfig::copy_to_orig(void) void CNetworkConfig::copy_to_orig(void)
@@ -82,10 +117,35 @@ void CNetworkConfig::copy_to_orig(void)
orig_gateway = gateway; orig_gateway = gateway;
orig_inet_static = inet_static; orig_inet_static = inet_static;
orig_hostname = hostname; orig_hostname = hostname;
orig_ifname = ifname;
orig_ssid = ssid;
orig_key = key;
} }
bool CNetworkConfig::modified_from_orig(void) bool CNetworkConfig::modified_from_orig(void)
{ {
#ifdef DEBUG
if(orig_automatic_start != automatic_start)
printf("CNetworkConfig::modified_from_orig: automatic_start changed\n");
if(orig_address != address )
printf("CNetworkConfig::modified_from_orig: address changed\n");
if(orig_netmask != netmask )
printf("CNetworkConfig::modified_from_orig: netmask changed\n");
if(orig_broadcast != broadcast )
printf("CNetworkConfig::modified_from_orig: broadcast changed\n");
if(orig_gateway != gateway )
printf("CNetworkConfig::modified_from_orig: gateway changed\n");
if(orig_hostname != hostname )
printf("CNetworkConfig::modified_from_orig: hostname changed\n");
if(orig_inet_static != inet_static )
printf("CNetworkConfig::modified_from_orig: inet_static changed\n");
if(orig_ifname != ifname)
printf("CNetworkConfig::modified_from_orig: ifname changed\n");
#endif
if(wireless) {
if((ssid != orig_ssid) || (key != orig_key))
return 1;
}
return ( return (
(orig_automatic_start != automatic_start) || (orig_automatic_start != automatic_start) ||
(orig_address != address ) || (orig_address != address ) ||
@@ -93,7 +153,8 @@ bool CNetworkConfig::modified_from_orig(void)
(orig_broadcast != broadcast ) || (orig_broadcast != broadcast ) ||
(orig_gateway != gateway ) || (orig_gateway != gateway ) ||
(orig_hostname != hostname ) || (orig_hostname != hostname ) ||
(orig_inet_static != inet_static ) (orig_inet_static != inet_static ) ||
(orig_ifname != ifname)
); );
} }
@@ -101,21 +162,27 @@ void CNetworkConfig::commitConfig(void)
{ {
if (modified_from_orig()) if (modified_from_orig())
{ {
#ifdef DEBUG
printf("CNetworkConfig::commitConfig: modified, saving (wireless %d, ssid %s key %s)...\n", wireless, ssid.c_str(), key.c_str());
#endif
if(orig_hostname != hostname) if(orig_hostname != hostname)
netSetHostname((char *) hostname.c_str()); netSetHostname((char *) hostname.c_str());
copy_to_orig();
if (inet_static) if (inet_static)
{ {
addLoopbackDevice("lo", true); addLoopbackDevice("lo", true);
setStaticAttributes("eth0", automatic_start, address, netmask, broadcast, gateway); setStaticAttributes(ifname, automatic_start, address, netmask, broadcast, gateway, wireless);
} }
else else
{ {
addLoopbackDevice("lo", true); addLoopbackDevice("lo", true);
setDhcpAttributes("eth0", automatic_start); setDhcpAttributes(ifname, automatic_start, wireless);
} }
if(wireless && ((key != orig_key) || (ssid != orig_ssid)))
saveWpaConfig();
copy_to_orig();
} }
if (nameserver != orig_nameserver) if (nameserver != orig_nameserver)
{ {
@@ -150,7 +217,12 @@ int mysystem(char * cmd, char * arg1, char * arg2)
void CNetworkConfig::startNetwork(void) void CNetworkConfig::startNetwork(void)
{ {
system("/sbin/ifup -v eth0"); std::string cmd = "/sbin/ifup " + ifname;
#ifdef DEBUG
printf("CNetworkConfig::startNetwork: %s\n", cmd.c_str());
#else
system(cmd.c_str());
#endif
if (!inet_static) { if (!inet_static) {
init_vars(); init_vars();
} }
@@ -159,6 +231,72 @@ void CNetworkConfig::startNetwork(void)
void CNetworkConfig::stopNetwork(void) void CNetworkConfig::stopNetwork(void)
{ {
//mysystem("ifdown eth0", NULL, NULL); std::string cmd = "/sbin/ifdown " + ifname;
system("/sbin/ifdown eth0"); #ifdef DEBUG
printf("CNetworkConfig::stopNetwork: %s\n", cmd.c_str());
#else
system(cmd.c_str());
#endif
}
void CNetworkConfig::readWpaConfig()
{
std::string s;
std::ifstream in("/etc/wpa_supplicant.conf");
ssid = "";
key = "";
if(!in.is_open()) {
perror("/etc/wpa_supplicant.conf read error");
return;
}
while(getline(in, s)) {
if(s[0] == '#')
continue;
std::string::size_type i = s.find('=');
if (i != std::string::npos) {
std::string n = s.substr(0, i);
std::string val = s.substr(i + 1, s.length() - (i + 1));
while((i = n.find(' ')) != std::string::npos)
n.erase(i, 1);
while((i = n.find('\t')) != std::string::npos)
n.erase(i, 1);
if((i = val.find('"')) != std::string::npos)
val.erase(i, 1);
if((i = val.rfind('"')) != std::string::npos)
val.erase(i, 1);
if(n == "ssid")
ssid = val;
else if(n == "psk")
key = val;
}
}
#ifdef DEBUG
printf("CNetworkConfig::readWpaConfig: ssid %s key %s\n", ssid.c_str(), key.c_str());
#endif
}
void CNetworkConfig::saveWpaConfig()
{
#ifdef DEBUG
printf("CNetworkConfig::saveWpaConfig\n");
#endif
std::ofstream out("/etc/wpa_supplicant.conf");
if(!out.is_open()) {
perror("/etc/wpa_supplicant.conf write error");
return;
}
out << "# generated by neutrino\n";
out << "ctrl_interface=/var/run/wpa_supplicant\n";
out << "network={\n";
out << " ssid=\"" + ssid + "\"\n";
out << " psk=\"" + key + "\"\n";;
out << " proto=WPA WPA2\n";
out << " key_mgmt=WPA-PSK\n";
out << " pairwise=CCMP TKIP\n";
out << " group=CCMP TKIP\n";
out << "}\n";
} }

View File

@@ -35,9 +35,14 @@ class CNetworkConfig
std::string orig_nameserver; std::string orig_nameserver;
std::string orig_hostname; std::string orig_hostname;
bool orig_inet_static; bool orig_inet_static;
std::string orig_ifname;
std::string orig_ssid;
std::string orig_key;
void copy_to_orig(void); void copy_to_orig(void);
void init_vars(void); void init_vars(void);
void readWpaConfig();
void saveWpaConfig();
public: public:
bool automatic_start; bool automatic_start;
@@ -47,7 +52,12 @@ class CNetworkConfig
std::string gateway; std::string gateway;
std::string nameserver; std::string nameserver;
std::string hostname; std::string hostname;
std::string mac_addr;
std::string ifname;
std::string ssid;
std::string key;
bool inet_static; bool inet_static;
bool wireless;
CNetworkConfig(); CNetworkConfig();
~CNetworkConfig(); ~CNetworkConfig();
@@ -55,10 +65,12 @@ class CNetworkConfig
static CNetworkConfig* getInstance(); static CNetworkConfig* getInstance();
bool modified_from_orig(void); bool modified_from_orig(void);
void readConfig(std::string iname);
void commitConfig(void); void commitConfig(void);
void startNetwork(void); void startNetwork(void);
void stopNetwork(void); void stopNetwork(void);
void setIfName(std::string name) { ifname = name;};
}; };
class CNetAdapter class CNetAdapter

View File

@@ -220,6 +220,8 @@ bool CTP_scanNotifier::changeNotify(const neutrino_locale_t, void * Data)
} }
return true; return true;
} }
#if 0 // not used
CDHCPNotifier::CDHCPNotifier( CMenuForwarder* a1, CMenuForwarder* a2, CMenuForwarder* a3, CMenuForwarder* a4, CMenuForwarder* a5, CMenuForwarder* a6) CDHCPNotifier::CDHCPNotifier( CMenuForwarder* a1, CMenuForwarder* a2, CMenuForwarder* a3, CMenuForwarder* a4, CMenuForwarder* a5, CMenuForwarder* a6)
{ {
toDisable[0] = a1; toDisable[0] = a1;
@@ -240,7 +242,7 @@ bool CDHCPNotifier::changeNotify(const neutrino_locale_t, void * data)
toEnable[0]->setActive(!CNetworkConfig::getInstance()->inet_static); toEnable[0]->setActive(!CNetworkConfig::getInstance()->inet_static);
return true; return true;
} }
#endif
COnOffNotifier::COnOffNotifier( CMenuItem* a1,CMenuItem* a2,CMenuItem* a3,CMenuItem* a4,CMenuItem* a5) COnOffNotifier::COnOffNotifier( CMenuItem* a1,CMenuItem* a2,CMenuItem* a3,CMenuItem* a4,CMenuItem* a5)
{ {
number = 0; number = 0;
@@ -514,6 +516,7 @@ bool CKeySetupNotifier::changeNotify(const neutrino_locale_t, void *)
return false; return false;
} }
#if 0 // not used
bool CIPChangeNotifier::changeNotify(const neutrino_locale_t, void * Data) bool CIPChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
{ {
char ip[16]; char ip[16];
@@ -531,6 +534,7 @@ bool CIPChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
return true; return true;
} }
#endif
bool CConsoleDestChangeNotifier::changeNotify(const neutrino_locale_t, void * Data) bool CConsoleDestChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
{ {
@@ -778,6 +782,7 @@ std::string CNetAdapter::getMacAddr(void)
} }
} }
#if 0 // not used, moved to gui/network_setup.cpp
const char * mypinghost(const char * const host) const char * mypinghost(const char * const host)
{ {
int retvalue = pinghost(host); int retvalue = pinghost(host);
@@ -899,6 +904,7 @@ void showCurrentNetworkSettings()
} }
ShowMsgUTF(LOCALE_NETWORKMENU_SHOW, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8 ShowMsgUTF(LOCALE_NETWORKMENU_SHOW, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8
} }
#endif
uint64_t getcurrenttime() uint64_t getcurrenttime()
{ {