summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-12-11 14:57:54 (UTC)
committer mickeyl <mickeyl>2002-12-11 14:57:54 (UTC)
commitf9ab0941b88762b0c6c2f0a623f3067d6e1e9c49 (patch) (unidiff)
treed9d45a52b43b74029a9d5fd36b34016c55a1d036
parent7a17954c26add31f28b69989f54e0f28a17c8949 (diff)
downloadopie-f9ab0941b88762b0c6c2f0a623f3067d6e1e9c49.zip
opie-f9ab0941b88762b0c6c2f0a623f3067d6e1e9c49.tar.gz
opie-f9ab0941b88762b0c6c2f0a623f3067d6e1e9c49.tar.bz2
- include wellenreiter.desktop in .pro-file
- daemon now uses CARD_TYPE defined in header file (was: hardcoded CARD_TYPE_NG) (BTW. - we really need argument parsing and the config stuff ASAP) - default CARD_TYPE now is CARD_TYPE_HOSTAP
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.cc2
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh2
-rw-r--r--noncore/net/wellenreiter/opie-wellenreiter.control2
3 files changed, 3 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc
index 95f2f83..cc72377 100644
--- a/noncore/net/wellenreiter/daemon/source/daemon.cc
+++ b/noncore/net/wellenreiter/daemon/source/daemon.cc
@@ -1,119 +1,119 @@
1/* 1/*
2 * Startup functions of wellenreiter 2 * Startup functions of wellenreiter
3 * 3 *
4 * $Id$ 4 * $Id$
5 */ 5 */
6 6
7#include "config.hh" 7#include "config.hh"
8#include "daemon.hh" 8#include "daemon.hh"
9 9
10/* Main function of wellenreiterd */ 10/* Main function of wellenreiterd */
11int main(int argc, char **argv) 11int main(int argc, char **argv)
12{ 12{
13 int sock, maxfd, retval; 13 int sock, maxfd, retval;
14 char buffer[128]; 14 char buffer[128];
15 struct pcap_pkthdr header; 15 struct pcap_pkthdr header;
16 pcap_t *handletopcap; 16 pcap_t *handletopcap;
17 const unsigned char *packet; 17 const unsigned char *packet;
18 18
19 fd_set rset; 19 fd_set rset;
20 20
21 fprintf(stderr, "wellenreiterd %s\n\n", VERSION); 21 fprintf(stderr, "wellenreiterd %s\n\n", VERSION);
22 22
23 if(!card_into_monitormode(&handletopcap, SNIFFER_DEVICE, CARD_TYPE_NG)) 23 if(!card_into_monitormode(&handletopcap, SNIFFER_DEVICE, CARD_TYPE))
24 { 24 {
25 wl_logerr("Cannot set card into mon mode, aborting"); 25 wl_logerr("Cannot set card into mon mode, aborting");
26 exit(-1); 26 exit(-1);
27 } 27 }
28 wl_loginfo("Set card into monitor mode"); 28 wl_loginfo("Set card into monitor mode");
29 29
30 /////// following line will be moved to lib as soon as possible //////////// 30 /////// following line will be moved to lib as soon as possible ////////////
31 if((handletopcap = pcap_open_live(SNIFFER_DEVICE, BUFSIZ, 1, 0, NULL)) == NULL) 31 if((handletopcap = pcap_open_live(SNIFFER_DEVICE, BUFSIZ, 1, 0, NULL)) == NULL)
32 { 32 {
33 wl_logerr("pcap_open_live() failed: %s", strerror(errno)); 33 wl_logerr("pcap_open_live() failed: %s", strerror(errno));
34 exit(-1); 34 exit(-1);
35 } 35 }
36 36
37#ifdef HAVE_PCAP_NONBLOCK 37#ifdef HAVE_PCAP_NONBLOCK
38 pcap_setnonblock(handletopcap, 1, NULL); 38 pcap_setnonblock(handletopcap, 1, NULL);
39#endif 39#endif
40 40
41 /* getting the datalink type */ 41 /* getting the datalink type */
42 retval = pcap_datalink(handletopcap); 42 retval = pcap_datalink(handletopcap);
43 if (retval != DLT_IEEE802_11) /* Rawmode is IEEE802_11 */ 43 if (retval != DLT_IEEE802_11) /* Rawmode is IEEE802_11 */
44 { 44 {
45 wl_loginfo("Interface %s does not work in the correct 802.11 raw mode", SNIFFER_DEVICE); 45 wl_loginfo("Interface %s does not work in the correct 802.11 raw mode", SNIFFER_DEVICE);
46 pcap_close(handletopcap); 46 pcap_close(handletopcap);
47 return 0; 47 return 0;
48 } 48 }
49 wl_loginfo("Your successfully listen on %s in 802.11 raw mode", SNIFFER_DEVICE); 49 wl_loginfo("Your successfully listen on %s in 802.11 raw mode", SNIFFER_DEVICE);
50 //////////////////////////////////////// 50 ////////////////////////////////////////
51 51
52 /* Setup socket for incoming commands */ 52 /* Setup socket for incoming commands */
53 if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0) 53 if((sock=commsock(DAEMONADDR, DAEMONPORT)) < 0)
54 { 54 {
55 wl_logerr("Cannot setup socket"); 55 wl_logerr("Cannot setup socket");
56 exit(-1); 56 exit(-1);
57 } 57 }
58 wl_loginfo("Set up socket '%d' for GUI communication", sock); 58 wl_loginfo("Set up socket '%d' for GUI communication", sock);
59 59
60 FD_ZERO(&rset); 60 FD_ZERO(&rset);
61 61
62 /* Start main loop */ 62 /* Start main loop */
63 wl_loginfo("Starting main loop"); 63 wl_loginfo("Starting main loop");
64 while(1) 64 while(1)
65 { 65 {
66 66
67 FD_SET(sock, &rset); 67 FD_SET(sock, &rset);
68 FD_SET(pcap_fileno(handletopcap), &rset); 68 FD_SET(pcap_fileno(handletopcap), &rset);
69 maxfd=sock + pcap_fileno(handletopcap) + 1; 69 maxfd=sock + pcap_fileno(handletopcap) + 1;
70 70
71 if(select(maxfd, &rset, NULL, NULL, NULL) < 0) 71 if(select(maxfd, &rset, NULL, NULL, NULL) < 0)
72 { 72 {
73 wl_logerr("Error calling select: %s", strerror(errno)); 73 wl_logerr("Error calling select: %s", strerror(errno));
74 break; 74 break;
75 } 75 }
76 76
77 /* Got data on local socket from GUI */ 77 /* Got data on local socket from GUI */
78 if(FD_ISSET(sock, &rset)) 78 if(FD_ISSET(sock, &rset))
79 { 79 {
80 /* Receive data from socket */ 80 /* Receive data from socket */
81 if((retval=recvcomm(&sock, buffer, sizeof(buffer))) < 0) 81 if((retval=recvcomm(&sock, buffer, sizeof(buffer))) < 0)
82 { 82 {
83 wl_logerr("Error trying to read: %s", strerror(errno)); 83 wl_logerr("Error trying to read: %s", strerror(errno));
84 break; 84 break;
85 } 85 }
86 else 86 else
87 { 87 {
88 /* check type of packet and start function according to it */ 88 /* check type of packet and start function according to it */
89 switch(retval) 89 switch(retval)
90 { 90 {
91 case 98: 91 case 98:
92 wl_loginfo("Received STARTSNIFF command"); 92 wl_loginfo("Received STARTSNIFF command");
93 break; 93 break;
94 case 99: 94 case 99:
95 wl_loginfo("Received STOPSNIFF command"); 95 wl_loginfo("Received STOPSNIFF command");
96 break; 96 break;
97 default: 97 default:
98 wl_logerr("Received unknown command: %d", retval); 98 wl_logerr("Received unknown command: %d", retval);
99 break; 99 break;
100 } 100 }
101 } 101 }
102 } /* FD_ISSET */ 102 } /* FD_ISSET */
103 103
104 /* Check pcap lib for packets */ 104 /* Check pcap lib for packets */
105 if(FD_ISSET(pcap_fileno(handletopcap), &rset)) 105 if(FD_ISSET(pcap_fileno(handletopcap), &rset))
106 { 106 {
107 107
108 /* Grab one single packet */ 108 /* Grab one single packet */
109 packet = pcap_next(handletopcap, &header); 109 packet = pcap_next(handletopcap, &header);
110 110
111 /* process the packet */ 111 /* process the packet */
112 process_packets(&header,*&packet, GUIADDR, GUIPORT); 112 process_packets(&header,*&packet, GUIADDR, GUIPORT);
113 } 113 }
114 114
115 } /* while(1) */ 115 } /* while(1) */
116 116
117 close(sock); 117 close(sock);
118 exit(0); 118 exit(0);
119} 119}
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
index a3f8280..fad74cf 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
@@ -1,37 +1,37 @@
1/* $Id$ */ 1/* $Id$ */
2 2
3#ifndef CARDMODE_HH 3#ifndef CARDMODE_HH
4#define CARDMODE_HH 4#define CARDMODE_HH
5 5
6#include <string.h> 6#include <string.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <errno.h> 8#include <errno.h>
9#include <sys/socket.h> 9#include <sys/socket.h>
10#include <netinet/in.h> 10#include <netinet/in.h>
11#include <arpa/inet.h> 11#include <arpa/inet.h>
12 12
13extern "C" 13extern "C"
14{ 14{
15#include <net/bpf.h> 15#include <net/bpf.h>
16#include <pcap.h> 16#include <pcap.h>
17} 17}
18 18
19#include "../../libwellenreiter/source/log.hh" 19#include "../../libwellenreiter/source/log.hh"
20 20
21/* Defines, used for the card setup */ 21/* Defines, used for the card setup */
22#define DEFAULT_PATH "/proc/driver/aironet/%s/Config" 22#define DEFAULT_PATH "/proc/driver/aironet/%s/Config"
23 #define CARD_TYPE_CISCO1 23 #define CARD_TYPE_CISCO1
24 #define CARD_TYPE_NG 2 24 #define CARD_TYPE_NG 2
25 #define CARD_TYPE_HOSTAP3 25 #define CARD_TYPE_HOSTAP3
26 26
27/* only for now, until we have the daemon running */ 27/* only for now, until we have the daemon running */
28/*the config file should provide these information */ 28/*the config file should provide these information */
29#define CARD_TYPE CARD_TYPE_CISCO 29#define CARD_TYPE CARD_TYPE_HOSTAP
30 #define SBIN_PATH "/sbin/ifconfig %s promisc up" 30 #define SBIN_PATH "/sbin/ifconfig %s promisc up"
31#define WLANCTL_PATH "/sbin/wlanctl-ng" 31#define WLANCTL_PATH "/sbin/wlanctl-ng"
32 32
33/* Prototypes */ 33/* Prototypes */
34int card_into_monitormode (pcap_t **, char *, int); 34int card_into_monitormode (pcap_t **, char *, int);
35int card_set_promisc_up (const char *); 35int card_set_promisc_up (const char *);
36 36
37#endif /* CARDMODE_HH */ 37#endif /* CARDMODE_HH */
diff --git a/noncore/net/wellenreiter/opie-wellenreiter.control b/noncore/net/wellenreiter/opie-wellenreiter.control
index f34cc08..0ea27bf 100644
--- a/noncore/net/wellenreiter/opie-wellenreiter.control
+++ b/noncore/net/wellenreiter/opie-wellenreiter.control
@@ -1,9 +1,9 @@
1Files: bin/wellenreiter bin/wellenreiterd bin/orinoco_hopper pics/wellenreiter $QTDIR/lib/libwellenreiter.* 1Files: bin/wellenreiter bin/wellenreiterd bin/orinoco_hopper pics/wellenreiter apps/Applications/wellenreiter.desktop $QTDIR/lib/libwellenreiter.*
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Michael Lauer <mickeyl@handhelds.org> 4Maintainer: Michael Lauer <mickeyl@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION), libpcap 7Depends: opie-base ($QPE_VERSION), libpcap
8Description: A WaveLAN Network Monitor 8Description: A WaveLAN Network Monitor
9 A WaveLAN Network Monitor/Sniffer for the Opie Environment. 9 A WaveLAN Network Monitor/Sniffer for the Opie Environment.