diff options
Diffstat (limited to 'LogReceiver/logreceiver.cpp')
-rw-r--r-- | LogReceiver/logreceiver.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/LogReceiver/logreceiver.cpp b/LogReceiver/logreceiver.cpp index 199f6ed..61e9c62 100644 --- a/LogReceiver/logreceiver.cpp +++ b/LogReceiver/logreceiver.cpp @@ -2,6 +2,7 @@ #include <QtNetwork> #include <QProcess> +#include <arpa/inet.h> #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -14,6 +15,7 @@ #include <qlocalsocket.h> #include "status.h" #include "dhcp.h" +#include "interface.h" #include "../common/fbgui.h" @@ -230,6 +232,9 @@ void LogReceiver::checkConnectivity(QString ifName) { QString command("route"); QStringList argList; QString gateway(" "); + QByteArray ba; + struct in_addr destination, netmask, gw; + int metric = 0; // get gateway address QString pathToGatewayFile(DEFAULT_GATEWAY_INFO_LOCATION); @@ -238,11 +243,22 @@ void LogReceiver::checkConnectivity(QString ifName) { ifConf.readConfigOutOfFile(pathToGatewayFile); // delete default route - argList << "del" << "default"; + ba = ifName.toAscii(); + char *ifname = ba.data(); + inet_aton("0.0.0.0", &destination); + inet_aton("0.0.0.0", &netmask); + ba = ifConf.getGateway().toAscii(); + const char * gwaddr = ba.data(); + inet_aton(gwaddr,&gw); + del_route(ifname, destination, netmask, gw, metric); + QProcess * p = new QProcess(this); + /* + argList << "del" << "default"; + p->start(command, argList); p->waitForFinished(); - + */ // add new default route argList.clear(); qDebug() << "add default route with:" << ifConf.getGateway() |