summaryrefslogtreecommitdiffstats
path: root/LogReceiver
diff options
context:
space:
mode:
Diffstat (limited to 'LogReceiver')
-rwxr-xr-xLogReceiver/LogReceiverbin122376 -> 130952 bytes
-rw-r--r--LogReceiver/Makefile2
-rw-r--r--LogReceiver/logreceiver.cpp57
-rw-r--r--LogReceiver/logreceiver.h4
4 files changed, 60 insertions, 3 deletions
diff --git a/LogReceiver/LogReceiver b/LogReceiver/LogReceiver
index a16897b..21d42f2 100755
--- a/LogReceiver/LogReceiver
+++ b/LogReceiver/LogReceiver
Binary files differ
diff --git a/LogReceiver/Makefile b/LogReceiver/Makefile
index cd541af..2b6b8c6 100644
--- a/LogReceiver/Makefile
+++ b/LogReceiver/Makefile
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: LogReceiver
-# Generated by qmake (2.01a) (Qt 4.7.2) on: Wed Aug 24 10:11:58 2011
+# Generated by qmake (2.01a) (Qt 4.7.2) on: Thu Sep 1 13:01:39 2011
# Project: LogReceiver.pro
# Template: app
# Command: /usr/local/Trolltech/QtEmbedded-4.7.2/bin/qmake -o Makefile LogReceiver.pro
diff --git a/LogReceiver/logreceiver.cpp b/LogReceiver/logreceiver.cpp
index 802f442..1256bfe 100644
--- a/LogReceiver/logreceiver.cpp
+++ b/LogReceiver/logreceiver.cpp
@@ -222,6 +222,60 @@ void LogReceiver::checkInternetConnection(QList<QString> &interfaces) {
checkInternetConnection(nI);
}
}
+
+void LogReceiver::checkConnectivity(QString ifName) {
+ QString command("route");
+ QStringList argList;
+ QString gateway(" ");
+
+ // get gateway address
+ QString pathToGatewayFile(DEFAULT_GATEWAY_INFO_LOCATION);
+ pathToGatewayFile += ifName;
+ QFile file(pathToGatewayFile);
+ if(file.exists()) {
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ qDebug() << "couldnt open file:" << pathToGatewayFile;
+ return;
+ }
+ while(!file.atEnd()) {
+ QString line(file.readLine());
+ QStringList gateways = line.split(",");
+ gateway = gateways.first().trimmed();
+ }
+ }
+ else {
+ qDebug() << "file doesn't exist:" << pathToGatewayFile;
+ return;
+ }
+
+ // delete default route
+ argList << "del" << "default";
+ QProcess * p = new QProcess(this);
+ p->start(command, argList);
+ p->waitForFinished();
+
+ // add new default route
+ argList.clear();
+ argList << "add" << "default" << "gw" << gateway << ifName;
+ p = new QProcess(this);
+ p->start(command, argList);
+ p->waitForFinished();
+
+ // check connectivity via tcp connection
+ QTcpSocket *tcpSocket = new QTcpSocket(this);
+ tcpSocket->connectToHost(QString("209.85.148.105"), 80);
+ if (!tcpSocket->waitForConnected(2000)) {
+ qDebug() << "no internet connection with interface" << ifName;
+ qDebug() << tcpSocket->errorString();
+ emit updateStatusLabel(ifName, "connection not possible");
+ } else {
+ qDebug() << "internet: check passed! for interface" << ifName;
+ emit
+ updateStatusLabel(ifName, "connection possible");
+ emit connectionEstablished(ifName);
+ }
+}
+
void LogReceiver::checkInternetConnectionViaTCP(QString ifName) {
const bool canStartIAP = (configurationManager.capabilities()
@@ -418,7 +472,8 @@ void LogReceiver::handleProcessFinished(int exitCode,
emit
updateStatusLabel(ifName, "check connectivity");
//checkInternetConnection(ifName);
- checkInternetConnectionViaTCP(ifName);
+ //checkInternetConnectionViaTCP(ifName);
+ checkConnectivity(ifName);
}
}
QLocalSocket *client = ifNameToClient.value(ifName, 0);
diff --git a/LogReceiver/logreceiver.h b/LogReceiver/logreceiver.h
index ce6d070..a8572d0 100644
--- a/LogReceiver/logreceiver.h
+++ b/LogReceiver/logreceiver.h
@@ -16,7 +16,8 @@ class LogReceiver: public QObject {
Q_OBJECT
#define DEFAULT_QTSOCKETADDRESS "/var/tmp/qt_c_socket_default"
-#define DEFAULT_PATHTODHCPCDEXE "/home/niklas/fbgui/workspace/customdhcpcd/src/customdhcpcd"
+#define DEFAULT_PATHTODHCPCDEXE "/home/niklas/fbgui/customdhcpcd/src/customdhcpcd"
+#define DEFAULT_GATEWAY_INFO_LOCATION "/var/tmp/gateways_"
public:
LogReceiver();
@@ -66,6 +67,7 @@ private:
void checkInternetConnection(QString ifName);
void checkInternetConnection(QList<QString> &interfaces);
void checkInternetConnectionViaTCP(QString ifName);
+ void checkConnectivity(QString ifName);
QList<QString> getListOfNetworkInterfaces();
bool checkBlackList(QString i);