author | max <max> | 2003-02-07 17:17:35 (UTC) |
---|---|---|
committer | max <max> | 2003-02-07 17:17:35 (UTC) |
commit | 014608882b23343473c5d0e7dca3ea09cf02dcfb (patch) (side-by-side diff) | |
tree | 90eac99cbb0faca581cc9b5cc37a9fd460548050 /noncore/net/wellenreiter/daemon/source | |
parent | a14c5974339f5beef433754d52c952cb99834619 (diff) | |
download | opie-014608882b23343473c5d0e7dca3ea09cf02dcfb.zip opie-014608882b23343473c5d0e7dca3ea09cf02dcfb.tar.gz opie-014608882b23343473c5d0e7dca3ea09cf02dcfb.tar.bz2 |
Chanswitch
Diffstat (limited to 'noncore/net/wellenreiter/daemon/source') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.cc | 26 | ||||
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/daemon.hh | 1 |
2 files changed, 18 insertions, 9 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 @@ -6,28 +6,36 @@ #include "config.hh" #include "daemon.hh" // temporary solution, will be removed soon #define MAXCHANNEL 13 +int card_type; char sniffer_device[6]; int channel=0; int timedout=1; -static int chanswitch() +void chanswitch(int blah) { if(channel >= MAXCHANNEL) - channel=1 + { + channel=1; + } + else + { + channel++; + } card_set_channel(sniffer_device, channel, card_type); timedout=0; + alarm(1); } /* Main function of wellenreiterd */ int main(int argc, char **argv) { - int sock, maxfd, retval, card_type; + int sock, maxfd, retval; char buffer[WL_SOCKBUF]; struct pcap_pkthdr header; struct sockaddr_in saddr; pcap_t *handletopcap; const unsigned char *packet; @@ -37,21 +45,21 @@ int main(int argc, char **argv) fprintf(stderr, "(c) 2002 by M-M-M\n\n"); if(argc < 3) usage(); // removed soon, see above - SIGNAL(SIGALRM, chanswitch); - + signal(SIGALRM, chanswitch); + alarm(1); /* Set sniffer device */ memset(sniffer_device, 0, sizeof(sniffer_device)); strncpy(sniffer_device, (char *)argv[1], sizeof(sniffer_device) - 1); /* Set card type */ card_type = atoi(argv[2]); - if(card_type < 1 || card_type > 3) + if(card_type < 1 || card_type > 4) usage(); if(!card_into_monitormode(&handletopcap, sniffer_device, card_type)) { wl_logerr("Cannot initialize the wireless-card, aborting"); exit(-1); @@ -88,13 +96,12 @@ int main(int argc, char **argv) FD_SET(sock, &rset); FD_SET(pcap_fileno(handletopcap), &rset); // blah timedout=1; - alarm(1); /* socket or pcap handle bigger? Will be cleaned up, have to check pcap */ maxfd = (sock > pcap_fileno(handletopcap) ? sock : pcap_fileno(handletopcap)) + 1; if(select(maxfd, &rset, NULL, NULL, NULL) < 0 && timedout) { @@ -147,11 +154,12 @@ int main(int argc, char **argv) } void usage(void) { fprintf(stderr, "Usage: wellenreiter <device> <cardtype>\n" \ "\t<device> = Wirelessdevice (e.g. wlan0)\n" \ - "\t<cardtype> = Cardtype:\t Cisco\t= 1\n" \ + "\t<cardtype> = Cardtype:\tCisco\t= 1\n" \ "\t\t\t\tNG\t= 2\n" \ - "\t\t\t\tHOSTAP\t= 3\n"); + "\t\t\t\tHOSTAP\t= 3\n" \ + "\t\t\t\tLUCENT\t= 4\n"); exit(-1); } 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 @@ -9,12 +9,13 @@ #include <sys/time.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <errno.h> +#include <signal.h> #include <libwellenreiter/source/wl_sock.hh> #include <libwellenreiter/source/wl_log.hh> #include <libwellenreiter/source/wl_types.hh> #include <libwellenreiter/source/wl_proto.hh> #include <libwellenreiter/source/cardmode.hh> |