1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-30 05:31:54 +02:00
openwrt-xburst/openwrt/package/kismet/patches/130-wrt54g_source.patch

110 lines
3.7 KiB
Diff
Raw Normal View History

diff -urN kismet.old/kis_packsources.cc kismet.dev/kis_packsources.cc
--- kismet.old/kis_packsources.cc 2005-07-25 12:18:47.230369000 +0200
+++ kismet.dev/kis_packsources.cc 2005-07-25 12:54:44.654390736 +0200
@@ -165,7 +165,7 @@
chancontrol_wlanng_avs, 1);
sourcetracker->RegisterPacketsource("wrt54g", 1, "na", 0,
pcapsource_wrt54g_registrant,
- monitor_wrt54g, NULL, NULL, 0);
+ monitor_wrt54g, NULL, chancontrol_wext, 1);
#else
REG_EMPTY_CARD(sourcetracker, "wlanng");
REG_EMPTY_CARD(sourcetracker, "wlanng_avs");
diff -urN kismet.old/packetsourcetracker.cc kismet.dev/packetsourcetracker.cc
--- kismet.old/packetsourcetracker.cc 2005-04-03 07:33:42.000000000 +0200
+++ kismet.dev/packetsourcetracker.cc 2005-07-25 13:29:45.698983408 +0200
@@ -978,6 +978,7 @@
(meta_packsources[chanpak.meta_num]->device.c_str(),
chanpak.channel, errstr,
(void *) (meta_packsources[chanpak.meta_num]->capsource)) < 0) {
+#if 0
meta_packsources[chanpak.meta_num]->consec_errors++;
@@ -999,6 +1000,7 @@
CHANFLAG_FATAL));
continue;
}
+#endif
} else {
// Otherwise reset the error count
meta_packsources[chanpak.meta_num]->consec_errors = 0;
diff -urN kismet.old/pcapsource.cc kismet.dev/pcapsource.cc
--- kismet.old/pcapsource.cc 2005-07-25 12:18:47.234368000 +0200
+++ kismet.dev/pcapsource.cc 2005-07-25 12:51:19.426590104 +0200
@@ -140,6 +140,48 @@
return 1;
}
+
+// Open a source
+int PcapSourceWrt54g::OpenSource() {
+ channel = 0;
+
+ errstr[0] = '\0';
+
+ char *unconst = strdup("prism0");
+
+ pd = pcap_open_live(unconst, MAX_PACKET_LEN, 1, 1000, errstr);
+
+ free(unconst);
+
+ if (strlen(errstr) > 0)
+ return -1; // Error is already in errstr
+
+ paused = 0;
+
+ errstr[0] = '\0';
+
+ num_packets = 0;
+
+ if (DatalinkType() < 0)
+ return -1;
+
+#ifdef HAVE_PCAP_NONBLOCK
+ pcap_setnonblock(pd, 1, errstr);
+#elif !defined(SYS_OPENBSD)
+ // do something clever (Thanks to Guy Harris for suggesting this).
+ int save_mode = fcntl(pcap_get_selectable_fd(pd), F_GETFL, 0);
+ if (fcntl(pcap_get_selectable_fd(pd), F_SETFL, save_mode | O_NONBLOCK) < 0) {
+ snprintf(errstr, 1024, "fcntl failed, errno %d (%s)",
+ errno, strerror(errno));
+ }
+#endif
+
+ if (strlen(errstr) > 0)
+ return -1; // Ditto
+
+ return 1;
+}
+
// Datalink, override as appropriate
carrier_type PcapSource::IEEE80211Carrier() {
int ch = FetchChannel();
@@ -1609,7 +1651,7 @@
int monitor_wrt54g(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
char cmdline[2048];
- snprintf(cmdline, 2048, "/usr/sbin/wl monitor 1");
+ snprintf(cmdline, 2048, "/usr/sbin/iwpriv %s set_monitor 1", in_dev);
if (RunSysCmd(cmdline) < 0) {
snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
return -1;
diff -urN kismet.old/pcapsource.h kismet.dev/pcapsource.h
--- kismet.old/pcapsource.h 2005-04-03 07:33:42.000000000 +0200
+++ kismet.dev/pcapsource.h 2005-07-25 12:49:22.089428064 +0200
@@ -250,11 +250,13 @@
// Override packet fetching logic on this one to discard jumbo corrupt packets
// that it likes to generate
+// Override OpenSource() to use prism0 as pcap device
class PcapSourceWrt54g : public PcapSource {
public:
PcapSourceWrt54g(string in_name, string in_dev) : PcapSource(in_name, in_dev) {
fcsbytes = 4;
}
+ int OpenSource();
int FetchPacket(kis_packet *packet, uint8_t *data, uint8_t *moddata);
protected:
carrier_type IEEE80211Carrier();