author | mjm <mjm> | 2002-12-27 16:35:28 (UTC) |
---|---|---|
committer | mjm <mjm> | 2002-12-27 16:35:28 (UTC) |
commit | 3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf (patch) (side-by-side diff) | |
tree | 180016a8feae9e40c3e6b8be62b518bdf8ef18fc /noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc | |
parent | e6aaae74f39e3aed4dc3c186c56f92cef8c7da09 (diff) | |
download | opie-3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf.zip opie-3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf.tar.gz opie-3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf.tar.bz2 |
cleanup, new protocol, renaming of some functions, GUI has to update!
Diffstat (limited to 'noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc index 3aaa4a7..c29f4d0 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.cc @@ -1,78 +1,77 @@ /* * Set card modes for sniffing * * $Id$ */ #include "cardmode.hh" -#include "log.hh" +#include "wl_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"); return 0; } /* Setting the prmiscous and up flag to the interface */ if (!card_set_promisc_up(device)) { wl_logerr("Cannot set interface to promisc mode: %s", strerror(errno)); return 0; } wl_loginfo("Interface set to promisc mode"); /* Check the cardtype and executes the commands to go into monitor mode */ if (cardtype == CARD_TYPE_CISCO) { /* bring the sniffer into rfmon mode */ - snprintf(CiscoRFMON, sizeof(CiscoRFMON), DEFAULT_PATH, device); + 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), "%s %s lnxreq_wlansniff channel=1 enable=true", WLANCTL_PATH, device); + 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"); } return 1; } /* Set card into promisc mode */ int card_set_promisc_up (const char *device) { char ifconfigcmd[32]; int retval=0; - snprintf(ifconfigcmd, sizeof(ifconfigcmd), SBIN_PATH, device); + snprintf(ifconfigcmd, sizeof(ifconfigcmd) - 1, SBIN_PATH, device); retval = system(ifconfigcmd); if(retval != 0) return 0; return 1; } |