summaryrefslogtreecommitdiff
authormax <max>2003-01-23 02:21:57 (UTC)
committer max <max>2003-01-23 02:21:57 (UTC)
commit5383c984ad15bde0300a6ca4559b0df52fe695b0 (patch) (side-by-side diff)
tree12ac9b23d45e5d8144a952343bbac3fb0cf58899
parentc464d34970bedca56a518310deef7ce08474033c (diff)
downloadopie-5383c984ad15bde0300a6ca4559b0df52fe695b0.zip
opie-5383c984ad15bde0300a6ca4559b0df52fe695b0.tar.gz
opie-5383c984ad15bde0300a6ca4559b0df52fe695b0.tar.bz2
hostap monitor command
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc7
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh1
2 files changed, 8 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
index 7362f14..d462488 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc
@@ -35,40 +35,47 @@ int card_into_monitormode (pcap_t **orighandle, char *device, int cardtype)
snprintf(CiscoRFMON, sizeof(CiscoRFMON) - 1, DEFAULT_PATH, device);
if((CISCO_CONFIG_FILE = fopen(CiscoRFMON,"w")) == NULL)
{
wl_logerr("Cannot open config file: %s", strerror(errno));
return 0;
}
fputs ("Mode: r",CISCO_CONFIG_FILE);
fputs ("Mode: y",CISCO_CONFIG_FILE);
fputs ("XmitPower: 1",CISCO_CONFIG_FILE);
fclose(CISCO_CONFIG_FILE);
}
else if (cardtype == CARD_TYPE_NG)
{
char wlanngcmd[62];
snprintf(wlanngcmd, sizeof(wlanngcmd) - 1, "%s %s lnxreq_wlansniff channel=1 enable=true", WLANCTL_PATH, device);
if (system(wlanngcmd) != 0)
{
wl_logerr("Could not set %s in raw mode, check cardtype", device);
return 0;
}
}
else if (cardtype == CARD_TYPE_HOSTAP)
{
wl_logerr("Got a host-ap card, nothing is implemented now");
+ char hostapcmd[250];
+ snprintf(hostapcmd, sizeof(hostapcmd) -1, "%s %s monitor 2", IWPRIV_PATH, device);
+ if (system(hostapcmd) !=0)
+ {
+ wl_logerr("Could not set %s in raw mode, check cardtype", device);
+ return 0;
+ }
}
return 1;
}
/* Set card into promisc mode */
int card_set_promisc_up (const char *device)
{
char ifconfigcmd[48];
int retval=0;
snprintf(ifconfigcmd, sizeof(ifconfigcmd) - 1, SBIN_PATH, device);
retval = system(ifconfigcmd);
return (retval ? 0 : 1);
}
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
index b85b7b7..9721b39 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
@@ -7,30 +7,31 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
extern "C"
{
#include <net/bpf.h>
#include <pcap.h>
}
/* 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"
+#define IWPRIV_PATH "/sbin/iwpriv"
/* Prototypes */
int card_into_monitormode (pcap_t **, char *, int);
int card_set_promisc_up (const char *);
#endif /* CARDMODE_HH */