Diffstat (limited to 'noncore/net/wellenreiter/daemon/source') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 24 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.hh | 1 |
2 files changed, 17 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc index d6e8f6b..b57e6a0 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.cc +++ b/noncore/net/wellenreiter/daemon/source/daemon.cc | |||
@@ -9,22 +9,30 @@ | |||
9 | 9 | ||
10 | // temporary solution, will be removed soon | 10 | // temporary solution, will be removed soon |
11 | #define MAXCHANNEL 13 | 11 | #define MAXCHANNEL 13 |
12 | int card_type; | ||
12 | char sniffer_device[6]; | 13 | char sniffer_device[6]; |
13 | int channel=0; | 14 | int channel=0; |
14 | int timedout=1; | 15 | int timedout=1; |
15 | 16 | ||
16 | static int chanswitch() | 17 | void chanswitch(int blah) |
17 | { | 18 | { |
18 | if(channel >= MAXCHANNEL) | 19 | if(channel >= MAXCHANNEL) |
19 | channel=1 | 20 | { |
21 | channel=1; | ||
22 | } | ||
23 | else | ||
24 | { | ||
25 | channel++; | ||
26 | } | ||
20 | card_set_channel(sniffer_device, channel, card_type); | 27 | card_set_channel(sniffer_device, channel, card_type); |
21 | timedout=0; | 28 | timedout=0; |
29 | alarm(1); | ||
22 | } | 30 | } |
23 | 31 | ||
24 | /* Main function of wellenreiterd */ | 32 | /* Main function of wellenreiterd */ |
25 | int main(int argc, char **argv) | 33 | int main(int argc, char **argv) |
26 | { | 34 | { |
27 | int sock, maxfd, retval, card_type; | 35 | int sock, maxfd, retval; |
28 | char buffer[WL_SOCKBUF]; | 36 | char buffer[WL_SOCKBUF]; |
29 | struct pcap_pkthdr header; | 37 | struct pcap_pkthdr header; |
30 | struct sockaddr_in saddr; | 38 | struct sockaddr_in saddr; |
@@ -40,15 +48,15 @@ int main(int argc, char **argv) | |||
40 | usage(); | 48 | usage(); |
41 | 49 | ||
42 | // removed soon, see above | 50 | // removed soon, see above |
43 | SIGNAL(SIGALRM, chanswitch); | 51 | signal(SIGALRM, chanswitch); |
44 | 52 | alarm(1); | |
45 | /* Set sniffer device */ | 53 | /* Set sniffer device */ |
46 | memset(sniffer_device, 0, sizeof(sniffer_device)); | 54 | memset(sniffer_device, 0, sizeof(sniffer_device)); |
47 | strncpy(sniffer_device, (char *)argv[1], sizeof(sniffer_device) - 1); | 55 | strncpy(sniffer_device, (char *)argv[1], sizeof(sniffer_device) - 1); |
48 | 56 | ||
49 | /* Set card type */ | 57 | /* Set card type */ |
50 | card_type = atoi(argv[2]); | 58 | card_type = atoi(argv[2]); |
51 | if(card_type < 1 || card_type > 3) | 59 | if(card_type < 1 || card_type > 4) |
52 | usage(); | 60 | usage(); |
53 | 61 | ||
54 | if(!card_into_monitormode(&handletopcap, sniffer_device, card_type)) | 62 | if(!card_into_monitormode(&handletopcap, sniffer_device, card_type)) |
@@ -91,7 +99,6 @@ int main(int argc, char **argv) | |||
91 | 99 | ||
92 | // blah | 100 | // blah |
93 | timedout=1; | 101 | timedout=1; |
94 | alarm(1); | ||
95 | 102 | ||
96 | /* socket or pcap handle bigger? Will be cleaned up, have to check pcap */ | 103 | /* socket or pcap handle bigger? Will be cleaned up, have to check pcap */ |
97 | maxfd = (sock > pcap_fileno(handletopcap) ? sock : pcap_fileno(handletopcap)) + 1; | 104 | maxfd = (sock > pcap_fileno(handletopcap) ? sock : pcap_fileno(handletopcap)) + 1; |
@@ -152,6 +159,7 @@ void usage(void) | |||
152 | "\t<device> = Wirelessdevice (e.g. wlan0)\n" \ | 159 | "\t<device> = Wirelessdevice (e.g. wlan0)\n" \ |
153 | "\t<cardtype> = Cardtype:\t Cisco\t= 1\n" \ | 160 | "\t<cardtype> = Cardtype:\t Cisco\t= 1\n" \ |
154 | "\t\t\t\tNG\t= 2\n" \ | 161 | "\t\t\t\tNG\t= 2\n" \ |
155 | "\t\t\t\tHOSTAP\t= 3\n"); | 162 | "\t\t\t\tHOSTAP\t= 3\n" \ |
163 | "\t\t\t\tLUCENT\t= 4\n"); | ||
156 | exit(-1); | 164 | exit(-1); |
157 | } | 165 | } |
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.hh b/noncore/net/wellenreiter/daemon/source/daemon.hh index 1cc3c7c..d50487a 100644 --- a/noncore/net/wellenreiter/daemon/source/daemon.hh +++ b/noncore/net/wellenreiter/daemon/source/daemon.hh | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <arpa/inet.h> | 12 | #include <arpa/inet.h> |
13 | #include <unistd.h> | 13 | #include <unistd.h> |
14 | #include <errno.h> | 14 | #include <errno.h> |
15 | #include <signal.h> | ||
15 | 16 | ||
16 | #include <libwellenreiter/source/wl_sock.hh> | 17 | #include <libwellenreiter/source/wl_sock.hh> |
17 | #include <libwellenreiter/source/wl_log.hh> | 18 | #include <libwellenreiter/source/wl_log.hh> |