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 | |||
@@ -1,10 +1,13 @@ | |||
1 | 2004-??-?? Michael Lauer <mickey@Vanille.de> | 1 | 2004-??-?? Michael Lauer <mickey@Vanille.de> |
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. |
4 | * Added a View submenu. Added actions to expand and collapse all items. | 7 | * Added a View submenu. Added actions to expand and collapse all items. |
5 | * Switched to a (hopefully) more reliable method reading from gpsd. | 8 | * Switched to a (hopefully) more reliable method reading from gpsd. |
6 | * Added parsing of named ProbeRequests. Display only-probed-yet SSIDs in a different network color. | 9 | * Added parsing of named ProbeRequests. Display only-probed-yet SSIDs in a different network color. |
7 | * Rewrote the simple actions on new {Network, Client, Station}. Besides playing a sound or | 10 | * Rewrote the simple actions on new {Network, Client, Station}. Besides playing a sound or |
8 | blinking a LED, a user customizable script can now be executed, if something has been | 11 | blinking a LED, a user customizable script can now be executed, if something has been |
9 | detected. This opens up many possibilities, i.e. a qcop to qpegps or exec'ing flite (speech). | 12 | detected. This opens up many possibilities, i.e. a qcop to qpegps or exec'ing flite (speech). |
10 | * Added decloaking of cloaked ESSIDs (length != 0, but essid[0] == \0). | 13 | * Added decloaking of cloaked ESSIDs (length != 0, but essid[0] == \0). |
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 | |||
@@ -17,31 +17,31 @@ | |||
17 | 17 | ||
18 | -------- | 18 | -------- |
19 | ENGINE | 19 | ENGINE |
20 | -------- | 20 | -------- |
21 | 21 | ||
22 | - enable multiple packet sources | 22 | - enable multiple packet sources |
23 | - infrared | 23 | - infrared |
24 | - bluetooth | 24 | - bluetooth |
25 | - usb? | 25 | - usb |
26 | 26 | ||
27 | - define packet structure in a metalanguage and generate | 27 | - define packet structure in a metalanguage and generate |
28 | the actual parsing code (hmmm) | 28 | the actual parsing code (hmmm) |
29 | 29 | ||
30 | - pester the ethereal folks to settle for an application independant | 30 | - pester the ethereal folks to settle for an application independant |
31 | packet dissection framework... (unlikely) | 31 | packet dissection framework... (unlikely) |
32 | 32 | ||
33 | - adaptive hopping scheme ! | 33 | - adaptive hopping scheme ! |
34 | 34 | ||
35 | - gather interface capabilities | 35 | - gather interface capabilities |
36 | 36 | ||
37 | - enable sniffing in wired networks | 37 | - enable sniffing in wired networks |
38 | 38 | ||
39 | - fix autodetection (interface name) | 39 | - fix autodetection (the interface name is not selected correctly) |
40 | 40 | ||
41 | - use ethtool IOCTLs (if present) | 41 | - use ethtool IOCTLs (if present) |
42 | 42 | ||
43 | --------- | 43 | --------- |
44 | UI | 44 | UI |
45 | --------- | 45 | --------- |
46 | 46 | ||
47 | - display interface capabilities (or rewrite networksettings?) | 47 | - display interface capabilities (or rewrite networksettings?) |
@@ -68,10 +68,8 @@ | |||
68 | 68 | ||
69 | - write wi-scan format like that: | 69 | - write wi-scan format like that: |
70 | # $Creator: Wellenreiter II Version 1.0.2 | 70 | # $Creator: Wellenreiter II Version 1.0.2 |
71 | # $Format: wi-scan | 71 | # $Format: wi-scan |
72 | # Latitude Longitude ( SSID ) Type ( BSSID ) Time (GMT) [ SNR Sig Noise ] | 72 | # Latitude Longitude ( SSID ) Type ( BSSID ) Time (GMT) [ SNR Sig Noise ] |
73 | # $DateGMT: 2004-02-07 | 73 | # $DateGMT: 2004-02-07 |
74 | N 41.1008009 W 8.3893034 ( Porceven ) BBS ( 00:a0:f8:41:91:63 ) 22:32:39 (GMT) [ 21 177 156 ] | 74 | N 41.1008009 W 8.3893034 ( Porceven ) BBS ( 00:a0:f8:41:91:63 ) 22:32:39 (GMT) [ 21 177 156 ] |
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 | |||
@@ -53,16 +53,19 @@ using namespace Opie::Ui; | |||
53 | 53 | ||
54 | /* STD */ | 54 | /* STD */ |
55 | #include <assert.h> | 55 | #include <assert.h> |
56 | #include <errno.h> | 56 | #include <errno.h> |
57 | #include <unistd.h> | 57 | #include <unistd.h> |
58 | #include <string.h> | 58 | #include <string.h> |
59 | #include <sys/types.h> | 59 | #include <sys/types.h> |
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <signal.h> | ||
62 | |||
63 | Wellenreiter* Wellenreiter::instance = 0; | ||
61 | 64 | ||
62 | Wellenreiter::Wellenreiter( QWidget* parent ) | 65 | Wellenreiter::Wellenreiter( QWidget* parent ) |
63 | : WellenreiterBase( parent, 0, 0 ), | 66 | : WellenreiterBase( parent, 0, 0 ), |
64 | sniffing( false ), iface( 0 ), configwindow( 0 ) | 67 | sniffing( false ), iface( 0 ), configwindow( 0 ) |
65 | { | 68 | { |
66 | 69 | ||
67 | logwindow->log( "(i) Wellenreiter has been started." ); | 70 | logwindow->log( "(i) Wellenreiter has been started." ); |
68 | 71 | ||
@@ -82,32 +85,63 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
82 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); | 85 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); |
83 | pcap = new OPacketCapturer(); | 86 | pcap = new OPacketCapturer(); |
84 | pcap->setAutoDelete( false ); | 87 | pcap->setAutoDelete( false ); |
85 | 88 | ||
86 | gps = new GPS( this ); | 89 | gps = new GPS( this ); |
87 | 90 | ||
88 | QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); | 91 | QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); |
89 | 92 | ||
93 | registerSignalHandler(); | ||
90 | } | 94 | } |
91 | 95 | ||
92 | 96 | ||
93 | Wellenreiter::~Wellenreiter() | 97 | Wellenreiter::~Wellenreiter() |
94 | { | 98 | { |
95 | delete pcap; | 99 | delete pcap; |
100 | //unregisterSignalHandler(); | ||
96 | } | 101 | } |
97 | 102 | ||
98 | 103 | ||
99 | void Wellenreiter::initialTimer() | 104 | void Wellenreiter::initialTimer() |
100 | { | 105 | { |
101 | odebug << "Wellenreiter::preloading manufacturer database..." << oendl; | 106 | odebug << "preloading manufacturer database..." << oendl; |
102 | OManufacturerDB::instance(); | 107 | OManufacturerDB::instance(); |
103 | } | 108 | } |
104 | 109 | ||
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 ) |
107 | { | 141 | { |
108 | configwindow = cw; | 142 | configwindow = cw; |
109 | } | 143 | } |
110 | 144 | ||
111 | 145 | ||
112 | void Wellenreiter::channelHopped(int c) | 146 | void Wellenreiter::channelHopped(int c) |
113 | { | 147 | { |
@@ -497,17 +531,17 @@ void Wellenreiter::startClicked() | |||
497 | 531 | ||
498 | const QString& interface = configwindow->interfaceName->currentText(); | 532 | const QString& interface = configwindow->interfaceName->currentText(); |
499 | const int cardtype = configwindow->driverType(); | 533 | const int cardtype = configwindow->driverType(); |
500 | const int interval = configwindow->hoppingInterval(); | 534 | const int interval = configwindow->hoppingInterval(); |
501 | 535 | ||
502 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 536 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
503 | { | 537 | { |
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; |
507 | } | 541 | } |
508 | 542 | ||
509 | // configure device | 543 | // configure device |
510 | ONetwork* net = ONetwork::instance(); | 544 | ONetwork* net = ONetwork::instance(); |
511 | 545 | ||
512 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | 546 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces |
513 | 547 | ||
@@ -527,16 +561,26 @@ void Wellenreiter::startClicked() | |||
527 | // bring device UP | 561 | // bring device UP |
528 | iface->setUp( true ); | 562 | iface->setUp( true ); |
529 | if ( !iface->isUp() ) | 563 | if ( !iface->isUp() ) |
530 | { | 564 | { |
531 | QMessageBox::warning( this, "Wellenreiter II", | 565 | QMessageBox::warning( this, "Wellenreiter II", |
532 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 566 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); |
533 | return; | 567 | return; |
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 | } |
536 | // set monitor mode | 580 | // set monitor mode |
537 | bool usePrism = configwindow->usePrismHeader(); | 581 | bool usePrism = configwindow->usePrismHeader(); |
538 | 582 | ||
539 | switch ( cardtype ) | 583 | switch ( cardtype ) |
540 | { | 584 | { |
541 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 585 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
542 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 586 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
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 | |||
@@ -15,16 +15,18 @@ | |||
15 | #define WELLENREITER_H | 15 | #define WELLENREITER_H |
16 | 16 | ||
17 | #include "wellenreiterbase.h" | 17 | #include "wellenreiterbase.h" |
18 | 18 | ||
19 | #ifdef QWS | 19 | #ifdef QWS |
20 | #include <opie2/odevice.h> | 20 | #include <opie2/odevice.h> |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #include <signal.h> | ||
24 | |||
23 | class QTimerEvent; | 25 | class QTimerEvent; |
24 | class QPixmap; | 26 | class QPixmap; |
25 | namespace Opie {namespace Net {class OPacket;}} | 27 | namespace Opie {namespace Net {class OPacket;}} |
26 | namespace Opie {namespace Net {class OWaveLanManagementPacket;}} | 28 | namespace Opie {namespace Net {class OWaveLanManagementPacket;}} |
27 | namespace Opie {namespace Net {class OWaveLanControlPacket;}} | 29 | namespace Opie {namespace Net {class OWaveLanControlPacket;}} |
28 | namespace Opie {namespace Net {class OWaveLanDataPacket;}} | 30 | namespace Opie {namespace Net {class OWaveLanDataPacket;}} |
29 | namespace Opie {namespace Net {class OEthernetPacket;}} | 31 | namespace Opie {namespace Net {class OEthernetPacket;}} |
30 | namespace Opie {namespace Net {class OARPPacket;}} | 32 | namespace Opie {namespace Net {class OARPPacket;}} |
@@ -49,16 +51,18 @@ class Wellenreiter : public WellenreiterBase { | |||
49 | MScanListView* netView() const { return netview; }; | 51 | MScanListView* netView() const { return netview; }; |
50 | MLogWindow* logWindow() const { return logwindow; }; | 52 | MLogWindow* logWindow() const { return logwindow; }; |
51 | PacketView* hexWindow() const { return hexwindow; }; | 53 | PacketView* hexWindow() const { return hexwindow; }; |
52 | bool isDaemonRunning() const { return sniffing; }; | 54 | bool isDaemonRunning() const { return sniffing; }; |
53 | QString captureFileName() const { return dumpname; }; | 55 | QString captureFileName() const { return dumpname; }; |
54 | 56 | ||
55 | public: | 57 | public: |
56 | bool sniffing; | 58 | bool sniffing; |
59 | static Wellenreiter* instance; | ||
60 | static void signalHandler( int sig ); | ||
57 | 61 | ||
58 | protected: | 62 | protected: |
59 | virtual void timerEvent( QTimerEvent* ); | 63 | virtual void timerEvent( QTimerEvent* ); |
60 | 64 | ||
61 | public slots: | 65 | public slots: |
62 | void initialTimer(); | 66 | void initialTimer(); |
63 | 67 | ||
64 | void channelHopped(int); | 68 | void channelHopped(int); |
@@ -81,16 +85,17 @@ class Wellenreiter : public WellenreiterBase { | |||
81 | void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); | 85 | void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); |
82 | void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); | 86 | void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); |
83 | void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); | 87 | void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); |
84 | void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); | 88 | void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to ); |
85 | void handleNotification( Opie::Net::OPacket* p ); | 89 | void handleNotification( Opie::Net::OPacket* p ); |
86 | void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p ); | 90 | void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p ); |
87 | QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol ); | 91 | QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol ); |
88 | bool checkDumpPacket( Opie::Net::OPacket* p ); | 92 | bool checkDumpPacket( Opie::Net::OPacket* p ); |
93 | void registerSignalHandler(); | ||
89 | 94 | ||
90 | private: | 95 | private: |
91 | #ifdef QWS | 96 | #ifdef QWS |
92 | Opie::Core::OSystem _system; // Opie Operating System identifier | 97 | Opie::Core::OSystem _system; // Opie Operating System identifier |
93 | #endif | 98 | #endif |
94 | 99 | ||
95 | QString dumpname; | 100 | QString dumpname; |
96 | Opie::Net::OWirelessNetworkInterface* iface; | 101 | Opie::Net::OWirelessNetworkInterface* iface; |