Project "Tuxbox-GIT: apps":

The branch, master has been updated
       via  ac59ccffb18ee5065dc215d32042ce5f8da7cb46 (commit)
      from  76e2683e7dfb66736ec60452fae5b2195edca7eb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ac59ccffb18ee5065dc215d32042ce5f8da7cb46
Author: GetAway <get-a...@t-online.de>
Date:   Wed May 27 18:43:59 2015 +0200

    network: use my_system()
    
    Signed-off-by: GetAway <get-a...@t-online.de>

diff --git a/tuxbox/neutrino/src/system/configure_network.cpp 
b/tuxbox/neutrino/src/system/configure_network.cpp
index a737347..5737647 100644
--- a/tuxbox/neutrino/src/system/configure_network.cpp
+++ b/tuxbox/neutrino/src/system/configure_network.cpp
@@ -27,10 +27,13 @@
 #include <iomanip>
 #include <sstream>
 
+#include <system/helper.h>
+
 CNetworkConfig::CNetworkConfig(void)
 {
        netGetNameserver(nameserver);
-       inet_static = getInetAttributes("eth0", automatic_start, address, 
netmask, broadcast, gateway);
+       ifname = "eth0";
+       inet_static = getInetAttributes(ifname, automatic_start, address, 
netmask, broadcast, gateway);
 
        init_vars();
        copy_to_orig();
@@ -55,7 +58,6 @@ CNetworkConfig::~CNetworkConfig()
 
 void CNetworkConfig::init_vars(void)
 {
-       std::string ifname = "eth0";
        unsigned char addr[6];
 
        netGetMacAddr(ifname, addr);
@@ -98,12 +100,12 @@ void CNetworkConfig::commitConfig(void)
                if (inet_static)
                {
                        addLoopbackDevice("lo", true);
-                       setStaticAttributes("eth0", automatic_start, address, 
netmask, broadcast, gateway);
+                       setStaticAttributes(ifname, automatic_start, address, 
netmask, broadcast, gateway);
                }
                else
                {
                        addLoopbackDevice("lo", true);
-                       setDhcpAttributes("eth0", automatic_start);
+                       setDhcpAttributes(ifname, automatic_start);
                }
        }
        if (nameserver != orig_nameserver)
@@ -115,11 +117,15 @@ void CNetworkConfig::commitConfig(void)
 
 void CNetworkConfig::startNetwork(void)
 {
-       system("ifup eth0");
+       std::string cmd = "/sbin/ifup " + ifname;
+
+       my_system(3, "/bin/sh", "-c", cmd.c_str());
 }
 
 void CNetworkConfig::stopNetwork(void)
 {
-       system("ifdown eth0");
+       std::string cmd = "/sbin/ifdown " + ifname;
+
+       my_system(3, "/bin/sh", "-c", cmd.c_str());
 }
 
diff --git a/tuxbox/neutrino/src/system/configure_network.h 
b/tuxbox/neutrino/src/system/configure_network.h
index 7b7f6c4..13641a7 100644
--- a/tuxbox/neutrino/src/system/configure_network.h
+++ b/tuxbox/neutrino/src/system/configure_network.h
@@ -46,6 +46,7 @@ class CNetworkConfig
        std::string gateway;
        std::string nameserver;
        std::string mac_addr;
+       std::string ifname;
        bool        inet_static;
 
        CNetworkConfig();

-----------------------------------------------------------------------

Summary of changes:
 tuxbox/neutrino/src/system/configure_network.cpp |   18 ++++++++++++------
 tuxbox/neutrino/src/system/configure_network.h   |    1 +
 2 files changed, 13 insertions(+), 6 deletions(-)


-- 
Tuxbox-GIT: apps

------------------------------------------------------------------------------
_______________________________________________
Tuxbox-cvs-commits mailing list
Tuxbox-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits

Reply via email to