diff options
author | Niklas | 2011-09-05 17:04:22 +0200 |
---|---|---|
committer | Niklas | 2011-09-05 17:04:22 +0200 |
commit | 5ea57d78c4c42551fcf57d423b13a0897f7db980 (patch) | |
tree | 134f4bbfacb52040a75529185f4a959b3d0d23c8 /LogReceiver/logreceiver.cpp | |
parent | added a new container class which holds config informations about an interfac... (diff) | |
download | fbgui-5ea57d78c4c42551fcf57d423b13a0897f7db980.tar.gz fbgui-5ea57d78c4c42551fcf57d423b13a0897f7db980.tar.xz fbgui-5ea57d78c4c42551fcf57d423b13a0897f7db980.zip |
tried to manage cmake but failed. also tried to add the del_route() method of interface.c but failed too. made a static lib of the customdhcpcd files but couldn't change it to a shared lib. (tried to add SHARE to the add_library code but this resulted in an error multiple declarations of main...
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() |