summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/ChangeLog3
-rw-r--r--noncore/net/wellenreiter/TODO6
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp48
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h5
4 files changed, 56 insertions, 6 deletions
diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog
index fdc8aa7..b59f9f9 100644
--- a/noncore/net/wellenreiter/ChangeLog
+++ b/noncore/net/wellenreiter/ChangeLog
@@ -2,2 +2,5 @@
+ * Registered a signal handler. We're now trying to gracefully exit and emergency close capture files.
+ This should allow reproducing failures.
+ * Added sanity check for compile time vs. run time Wireless Extension versions.
* Added sanity check isPresent(interface) before starting the engine.
diff --git a/noncore/net/wellenreiter/TODO b/noncore/net/wellenreiter/TODO
index 0640d23..f0a193d 100644
--- a/noncore/net/wellenreiter/TODO
+++ b/noncore/net/wellenreiter/TODO
@@ -24,3 +24,3 @@
- bluetooth
- - usb?
+ - usb
@@ -38,3 +38,3 @@
-- fix autodetection (interface name)
+- fix autodetection (the interface name is not selected correctly)
@@ -75,3 +75 @@
-- add SIGSEGV handler for emergency closing the capture file etc.
-
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 40cd105..12b3978 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -60,2 +60,5 @@ using namespace Opie::Ui;
#include <stdlib.h>
+#include <signal.h>
+
+Wellenreiter* Wellenreiter::instance = 0;
@@ -89,2 +92,3 @@ Wellenreiter::Wellenreiter( QWidget* parent )
+ registerSignalHandler();
}
@@ -95,2 +99,3 @@ Wellenreiter::~Wellenreiter()
delete pcap;
+ //unregisterSignalHandler();
}
@@ -100,3 +105,3 @@ void Wellenreiter::initialTimer()
{
- odebug << "Wellenreiter::preloading manufacturer database..." << oendl;
+ odebug << "preloading manufacturer database..." << oendl;
OManufacturerDB::instance();
@@ -105,2 +110,31 @@ void Wellenreiter::initialTimer()
+void Wellenreiter::signalHandler( int sig )
+{
+ oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl;
+ if ( Wellenreiter::instance->sniffing )
+ {
+ Wellenreiter::instance->pcap->close();
+ Wellenreiter::instance->stopClicked();
+ }
+ oerr << "Phew. Seemed to work." << oendl;
+ ::exit( -1 );
+}
+
+
+void Wellenreiter::registerSignalHandler()
+{
+ Wellenreiter::instance = this;
+ struct sigaction action;
+
+ action.sa_handler = Wellenreiter::signalHandler;
+ if (sigemptyset(&action.sa_mask))
+ oerr << "sigemptyset() failure:" << strerror( errno ) << oendl;
+ if (sigaction(SIGSEGV, &action, NULL))
+ oerr << "can't set up a signal handler for SIGSEGV:" << strerror( errno ) << oendl;
+ if (sigaction(SIGBUS, &action, NULL))
+ oerr << "can't set up a signal handler for SIGBUS:" << strerror( errno ) << oendl;
+ odebug << "signal handlers setup." << oendl;
+}
+
+
void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
@@ -504,3 +538,3 @@ void Wellenreiter::startClicked()
QMessageBox::information( this, "Wellenreiter II",
- tr( "Your device is not\nproperly configured. Please reconfigure!" ) );
+ tr( "No device configured.\nPlease reconfigure!" ) );
return;
@@ -534,2 +568,12 @@ void Wellenreiter::startClicked()
}
+
+ // check if wireless extension version matches
+ if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() )
+ {
+ QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>are not matching!<p>"
+ " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" )
+ .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) )
+ .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) );
+ return;
+ }
}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index f609ef4..32e5690 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -22,2 +22,4 @@
+#include <signal.h>
+
class QTimerEvent;
@@ -56,2 +58,4 @@ class Wellenreiter : public WellenreiterBase {
bool sniffing;
+ static Wellenreiter* instance;
+ static void signalHandler( int sig );
@@ -88,2 +92,3 @@ class Wellenreiter : public WellenreiterBase {
bool checkDumpPacket( Opie::Net::OPacket* p );
+ void registerSignalHandler();