author | mickeyl <mickeyl> | 2004-05-01 16:15:05 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-05-01 16:15:05 (UTC) |
commit | fd2bbf9a09aa7a13bd8a43db351b9153e5a4b7ab (patch) (unidiff) | |
tree | 17e24a7acb78e995e53ec7127e2d20a834984706 | |
parent | d5abd7878f553f5ac0a41966b27f4c09389d3cfd (diff) | |
download | opie-fd2bbf9a09aa7a13bd8a43db351b9153e5a4b7ab.zip opie-fd2bbf9a09aa7a13bd8a43db351b9153e5a4b7ab.tar.gz opie-fd2bbf9a09aa7a13bd8a43db351b9153e5a4b7ab.tar.bz2 |
- be really paranoid about wireless extension versions for compile time vs. run time
- register handlers for SIGSEGV and SIGBUG to emergency-close the capture file
-rw-r--r-- | noncore/net/wellenreiter/ChangeLog | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/TODO | 6 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 48 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 5 |
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 @@ | |||
2 | 2 | ||
3 | * Registered a signal handler. We're now trying to gracefully exit and emergency close capture files. | ||
4 | This should allow reproducing failures. | ||
5 | * Added sanity check for compile time vs. run time Wireless Extension versions. | ||
3 | * Added sanity check isPresent(interface) before starting the engine. | 6 | * 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 @@ | |||
24 | - bluetooth | 24 | - bluetooth |
25 | - usb? | 25 | - usb |
26 | 26 | ||
@@ -38,3 +38,3 @@ | |||
38 | 38 | ||
39 | - fix autodetection (interface name) | 39 | - fix autodetection (the interface name is not selected correctly) |
40 | 40 | ||
@@ -75,3 +75 @@ | |||
75 | |||
76 | - add SIGSEGV handler for emergency closing the capture file etc. | ||
77 | |||
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; | |||
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <signal.h> | ||
62 | |||
63 | Wellenreiter* Wellenreiter::instance = 0; | ||
61 | 64 | ||
@@ -89,2 +92,3 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
89 | 92 | ||
93 | registerSignalHandler(); | ||
90 | } | 94 | } |
@@ -95,2 +99,3 @@ Wellenreiter::~Wellenreiter() | |||
95 | delete pcap; | 99 | delete pcap; |
100 | //unregisterSignalHandler(); | ||
96 | } | 101 | } |
@@ -100,3 +105,3 @@ void Wellenreiter::initialTimer() | |||
100 | { | 105 | { |
101 | odebug << "Wellenreiter::preloading manufacturer database..." << oendl; | 106 | odebug << "preloading manufacturer database..." << oendl; |
102 | OManufacturerDB::instance(); | 107 | OManufacturerDB::instance(); |
@@ -105,2 +110,31 @@ void Wellenreiter::initialTimer() | |||
105 | 110 | ||
111 | void Wellenreiter::signalHandler( int sig ) | ||
112 | { | ||
113 | oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; | ||
114 | if ( Wellenreiter::instance->sniffing ) | ||
115 | { | ||
116 | Wellenreiter::instance->pcap->close(); | ||
117 | Wellenreiter::instance->stopClicked(); | ||
118 | } | ||
119 | oerr << "Phew. Seemed to work." << oendl; | ||
120 | ::exit( -1 ); | ||
121 | } | ||
122 | |||
123 | |||
124 | void Wellenreiter::registerSignalHandler() | ||
125 | { | ||
126 | Wellenreiter::instance = this; | ||
127 | struct sigaction action; | ||
128 | |||
129 | action.sa_handler = Wellenreiter::signalHandler; | ||
130 | if (sigemptyset(&action.sa_mask)) | ||
131 | oerr << "sigemptyset() failure:" << strerror( errno ) << oendl; | ||
132 | if (sigaction(SIGSEGV, &action, NULL)) | ||
133 | oerr << "can't set up a signal handler for SIGSEGV:" << strerror( errno ) << oendl; | ||
134 | if (sigaction(SIGBUS, &action, NULL)) | ||
135 | oerr << "can't set up a signal handler for SIGBUS:" << strerror( errno ) << oendl; | ||
136 | odebug << "signal handlers setup." << oendl; | ||
137 | } | ||
138 | |||
139 | |||
106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 140 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
@@ -504,3 +538,3 @@ void Wellenreiter::startClicked() | |||
504 | QMessageBox::information( this, "Wellenreiter II", | 538 | QMessageBox::information( this, "Wellenreiter II", |
505 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 539 | tr( "No device configured.\nPlease reconfigure!" ) ); |
506 | return; | 540 | return; |
@@ -534,2 +568,12 @@ void Wellenreiter::startClicked() | |||
534 | } | 568 | } |
569 | |||
570 | // check if wireless extension version matches | ||
571 | if ( ONetwork::wirelessExtensionCompileVersion() != iface->wirelessExtensionDriverVersion() ) | ||
572 | { | ||
573 | QMessageBox::critical( this, "Wellenreiter II", tr( "<p>The Wireless Extension Versions<br>are not matching!<p>" | ||
574 | " Wellenreiter II : WE V%1<br>Interface driver: WE V%2" ) | ||
575 | .arg( QString::number( ONetwork::wirelessExtensionCompileVersion() ) ) | ||
576 | .arg( QString::number( iface->wirelessExtensionDriverVersion() ) ) ); | ||
577 | return; | ||
578 | } | ||
535 | } | 579 | } |
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 @@ | |||
22 | 22 | ||
23 | #include <signal.h> | ||
24 | |||
23 | class QTimerEvent; | 25 | class QTimerEvent; |
@@ -56,2 +58,4 @@ class Wellenreiter : public WellenreiterBase { | |||
56 | bool sniffing; | 58 | bool sniffing; |
59 | static Wellenreiter* instance; | ||
60 | static void signalHandler( int sig ); | ||
57 | 61 | ||
@@ -88,2 +92,3 @@ class Wellenreiter : public WellenreiterBase { | |||
88 | bool checkDumpPacket( Opie::Net::OPacket* p ); | 92 | bool checkDumpPacket( Opie::Net::OPacket* p ); |
93 | void registerSignalHandler(); | ||
89 | 94 | ||