summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-14 19:13:32 (UTC)
committer mjm <mjm>2002-12-14 19:13:32 (UTC)
commitd9d4e587e62eac418b892c90145e958d6495d081 (patch) (side-by-side diff)
tree6a554548d6dfaaa082f4b088f8912f4c5fc7e528
parent57918323f3b2e1377d9cf97ed6466e31b260d24a (diff)
downloadopie-d9d4e587e62eac418b892c90145e958d6495d081.zip
opie-d9d4e587e62eac418b892c90145e958d6495d081.tar.gz
opie-d9d4e587e62eac418b892c90145e958d6495d081.tar.bz2
code cleanup, possible bug in sniff.cc fixed
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc1
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh2
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/proto.cc9
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/sniff.cc15
4 files changed, 10 insertions, 17 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
index a1c3945..3aaa4a7 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
@@ -1,19 +1,20 @@
/*
* Set card modes for sniffing
*
* $Id$
*/
#include "cardmode.hh"
+#include "log.hh"
/* main card into monitor function */
int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype)
{
char CiscoRFMON[35] = "/proc/driver/aironet/";
FILE *CISCO_CONFIG_FILE;
pcap_t *handle = (pcap_t*)orighandle;
/* Checks if we have a device to sniff on */
if(device == NULL)
{
wl_logerr("No device given");
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
index fad74cf..7c6a21d 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
@@ -7,26 +7,24 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
extern "C"
{
#include <net/bpf.h>
#include <pcap.h>
}
-#include "../../libwellenreiter/source/log.hh"
-
/* Defines, used for the card setup */
#define DEFAULT_PATH "/proc/driver/aironet/%s/Config"
#define CARD_TYPE_CISCO 1
#define CARD_TYPE_NG 2
#define CARD_TYPE_HOSTAP 3
/* only for now, until we have the daemon running */
/*the config file should provide these information */
#define CARD_TYPE CARD_TYPE_HOSTAP
#define SBIN_PATH "/sbin/ifconfig %s promisc up"
#define WLANCTL_PATH "/sbin/wlanctl-ng"
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc
index 305f401..2ec23f4 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc
@@ -47,33 +47,32 @@ int send_network_found (const char *guihost, int guiport, void *structure)
/* Set lenght of ssid */
memset(temp, 0, sizeof(temp));
if(ptr->ssid_len > 99)
snprintf(temp, 4, "%d", ptr->ssid_len);
else if(ptr->ssid_len < 10)
snprintf(temp, 4, "00%d", ptr->ssid_len);
else
snprintf(temp, 4, "0%d", ptr->ssid_len);
memcpy(buffer + 23, temp, 3);
- fprintf( stderr, "Temp is %s\n", temp );
- fprintf( stderr, "ssid_len is %d\n", ptr->ssid_len );
-
/* Set ssid */
memcpy(buffer + 26, ptr->bssid, ptr->ssid_len);
- fprintf( stderr, "Buffer is %s\n", buffer );
-
/* Send prepared buffer to GUI */
+#ifdef DEBUG
+ wl_loginfo("Sending network to GUI: '%s'", buffer);
+#endif
+
sendcomm(guihost, guiport, buffer);
return 1;
}
/* Fill buffer into structur */
int get_network_found (void *structure, const char *buffer)
{
wl_network_t *ptr;
char temp[512];
ptr = (wl_network_t *)structure;
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
index 84caf12..c703052 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc
@@ -85,64 +85,59 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack
a noise packet, if this comes up */
pinfoptr->isvalid = 0;
return;
}
if (pinfoptr->channel < 1 || pinfoptr->channel > 14)
{
/* Only channels between 1 and 14 are possible
others must be noise packets */
pinfoptr->isvalid = 0;
return;
}
- printf( "cap_ESS is %d, cap_IBSS is %d\n", pinfoptr->cap_ESS, pinfoptr->cap_IBSS );
-
/* Here should be the infos to the gui issued */
if (pinfoptr->cap_ESS == 1 &&pinfoptr->cap_IBSS ==0)
{
wl_loginfo("Found an access point");
wl_net.net_type=1;
}
else if(pinfoptr->cap_ESS == 0 && pinfoptr->cap_IBSS == 2)
{
wl_loginfo("Found an ad-hoc network");
wl_net.net_type=2;
}
+
if (strcmp (pinfoptr->ssid,NONBROADCASTING) ==0)
- {
wl_loginfo("Net is a non-broadcasting network");
- }
else
- {
wl_loginfo("SSID is: %s", pinfoptr->ssid);
- // wl_net.bssid=pinfoptr->ssid;
- }
+
+ wl_loginfo("SSID is: %s", pinfoptr->ssid);
+ memcpy(wl_net.bssid, pinfoptr->ssid, sizeof(wl_net.bssid)-1);
wl_loginfo("SSID length is: %d", pinfoptr->ssid_len);
wl_net.ssid_len=pinfoptr->ssid_len;
wl_loginfo("Channel is: %d", pinfoptr->channel);
wl_net.channel=pinfoptr->channel;
wl_net.wep=pinfoptr->cap_WEP;
wl_loginfo("Mac is: %s", pinfoptr->sndhwaddr);
memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac)-1);;
- wl_loginfo("SSID is: %s", pinfoptr->ssid);
- memcpy(wl_net.bssid, pinfoptr->ssid, sizeof(wl_net.bssid)-1);
- // printf ("\n\tDest : %s\n",pinfoptr->desthwaddr);
send_network_found((char *)guihost, guiport, &wl_net);
wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport);
}
break;
+
default:
wl_logerr("Unknown IEEE802.11 frame subtype (%d)", FC_SUBTYPE(fc));
break;
} /* End of switch over different mgt frame types */
break;
case T_CTRL:
wl_loginfo("Received control frame, not implemented yet");
break;
case T_DATA: