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
@@ -1,4 +1,7 @@
2004-??-?? Michael Lauer <mickey@Vanille.de>
+ * 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.
* Added a View submenu. Added actions to expand and collapse all items.
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
@@ -23,5 +23,5 @@
- infrared
- bluetooth
- - usb?
+ - usb
- define packet structure in a metalanguage and generate
@@ -37,5 +37,5 @@
- enable sniffing in wired networks
-- fix autodetection (interface name)
+- fix autodetection (the interface name is not selected correctly)
- use ethtool IOCTLs (if present)
@@ -74,4 +74,2 @@
N 41.1008009 W 8.3893034 ( Porceven ) BBS ( 00:a0:f8:41:91:63 ) 22:32:39 (GMT) [ 21 177 156 ]
-- 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
@@ -59,4 +59,7 @@ using namespace Opie::Ui;
#include <sys/types.h>
#include <stdlib.h>
+#include <signal.h>
+
+Wellenreiter* Wellenreiter::instance = 0;
Wellenreiter::Wellenreiter( QWidget* parent )
@@ -88,4 +91,5 @@ Wellenreiter::Wellenreiter( QWidget* parent )
QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
+ registerSignalHandler();
}
@@ -94,4 +98,5 @@ Wellenreiter::~Wellenreiter()
{
delete pcap;
+ //unregisterSignalHandler();
}
@@ -99,9 +104,38 @@ Wellenreiter::~Wellenreiter()
void Wellenreiter::initialTimer()
{
- odebug << "Wellenreiter::preloading manufacturer database..." << oendl;
+ odebug << "preloading manufacturer database..." << oendl;
OManufacturerDB::instance();
}
+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 )
{
@@ -503,5 +537,5 @@ void Wellenreiter::startClicked()
{
QMessageBox::information( this, "Wellenreiter II",
- tr( "Your device is not\nproperly configured. Please reconfigure!" ) );
+ tr( "No device configured.\nPlease reconfigure!" ) );
return;
}
@@ -533,4 +567,14 @@ void Wellenreiter::startClicked()
return;
}
+
+ // 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;
+ }
}
// set monitor mode
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
@@ -21,4 +21,6 @@
#endif
+#include <signal.h>
+
class QTimerEvent;
class QPixmap;
@@ -55,4 +57,6 @@ class Wellenreiter : public WellenreiterBase {
public:
bool sniffing;
+ static Wellenreiter* instance;
+ static void signalHandler( int sig );
protected:
@@ -87,4 +91,5 @@ class Wellenreiter : public WellenreiterBase {
QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol );
bool checkDumpPacket( Opie::Net::OPacket* p );
+ void registerSignalHandler();
private: