summaryrefslogtreecommitdiff
authormax <max>2003-02-07 17:17:35 (UTC)
committer max <max>2003-02-07 17:17:35 (UTC)
commit014608882b23343473c5d0e7dca3ea09cf02dcfb (patch) (side-by-side diff)
tree90eac99cbb0faca581cc9b5cc37a9fd460548050
parenta14c5974339f5beef433754d52c952cb99834619 (diff)
downloadopie-014608882b23343473c5d0e7dca3ea09cf02dcfb.zip
opie-014608882b23343473c5d0e7dca3ea09cf02dcfb.tar.gz
opie-014608882b23343473c5d0e7dca3ea09cf02dcfb.tar.bz2
Chanswitch
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.cc26
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.hh1
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc9
3 files changed, 25 insertions, 11 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
@@ -10,14 +10,22 @@
// 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);
}
@@ -25,5 +33,5 @@ static int chanswitch()
int main(int argc, char **argv)
{
- int sock, maxfd, retval, card_type;
+ int sock, maxfd, retval;
char buffer[WL_SOCKBUF];
struct pcap_pkthdr header;
@@ -41,6 +49,6 @@ int main(int argc, char **argv)
// removed soon, see above
- SIGNAL(SIGALRM, chanswitch);
-
+ signal(SIGALRM, chanswitch);
+ alarm(1);
/* Set sniffer device */
memset(sniffer_device, 0, sizeof(sniffer_device));
@@ -49,5 +57,5 @@ int main(int argc, char **argv)
/* Set card type */
card_type = atoi(argv[2]);
- if(card_type < 1 || card_type > 3)
+ if(card_type < 1 || card_type > 4)
usage();
@@ -92,5 +100,4 @@ int main(int argc, char **argv)
// blah
timedout=1;
- alarm(1);
/* socket or pcap handle bigger? Will be cleaned up, have to check pcap */
@@ -151,7 +158,8 @@ 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
@@ -13,4 +13,5 @@
#include <unistd.h>
#include <errno.h>
+#include <signal.h>
#include <libwellenreiter/source/wl_sock.hh>
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
index 697d182..0c23922 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
@@ -74,4 +74,8 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype)
return 0;
}
+ else
+ {
+ wl_loginfo("Successfully set %s into raw mode",device);
+ }
}
@@ -157,5 +161,4 @@ int card_set_promisc_up (const char *device)
int card_set_channel (const char *device, int channel, int cardtype)
{
-
if (cardtype == CARD_TYPE_CISCO)
{
@@ -168,5 +171,5 @@ int card_set_channel (const char *device, int channel, int cardtype)
char lucentreset[63];
char lucentcmd[62];
- snprintf(lucentreset, sizeof(lucentreset) -1,"$(which iwpriv) %s card_reset", device);
+ snprintf(lucentreset, sizeof(lucentreset) -1,"$(which iwpriv) %s force_reset", device);
if (system(lucentreset) != 0)
{
@@ -180,4 +183,6 @@ int card_set_channel (const char *device, int channel, int cardtype)
return 0;
}
+ wl_loginfo("Channel %d set on interface %s",channel,device);
+ return 1;
}