summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -8,24 +8,32 @@
#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;
@@ -39,17 +47,17 @@ int main(int argc, char **argv)
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))
{
@@ -90,9 +98,8 @@ int main(int argc, char **argv)
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;
@@ -149,9 +156,10 @@ 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
@@ -11,8 +11,9 @@
#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>
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
@@ -72,8 +72,12 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype)
{
wl_logerr("Could not set %s in raw mode, check cardtype", device);
return 0;
}
+ else
+ {
+ wl_loginfo("Successfully set %s into raw mode",device);
+ }
}
/* Setting the promiscous and up flag to the interface */
if (!card_check_rfmon_datalink(device))
@@ -155,9 +159,8 @@ int card_set_promisc_up (const char *device)
/* Set channel (Wireless frequency) of the device */
int card_set_channel (const char *device, int channel, int cardtype)
{
-
if (cardtype == CARD_TYPE_CISCO)
{
/* Cisco cards don't need channelswitching */
return 1;
@@ -166,9 +169,9 @@ int card_set_channel (const char *device, int channel, int cardtype)
else if (cardtype == CARD_TYPE_ORINOCCO)
{
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)
{
wl_logerr("Could not reset the card %s",device);
return 0;
@@ -178,8 +181,10 @@ int card_set_channel (const char *device, int channel, int cardtype)
{
wl_logerr("Could not set %s in raw mode, check cardtype", device);
return 0;
}
+ wl_loginfo("Channel %d set on interface %s",channel,device);
+ return 1;
}
/* For undefined situations */
return 0;