summaryrefslogtreecommitdiff
path: root/openwrt/package/kismet/patches
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-07-25 07:34:42 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-07-25 07:34:42 +0000
commit0672b5981e313e1db94f7c1ff11604303e968173 (patch)
tree3328fbff1e167423f387b874e10f99b92c6ff3ac /openwrt/package/kismet/patches
parente144d98ebaefd8cd242be931cc7b43c1d038c578 (diff)
change wrt54g packet source to automatically switch to monitor mode without wl, add channel hopping support
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@1548 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'openwrt/package/kismet/patches')
-rw-r--r--openwrt/package/kismet/patches/130-wrt54g_source.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/openwrt/package/kismet/patches/130-wrt54g_source.patch b/openwrt/package/kismet/patches/130-wrt54g_source.patch
new file mode 100644
index 0000000000..9192224c6e
--- /dev/null
+++ b/openwrt/package/kismet/patches/130-wrt54g_source.patch
@@ -0,0 +1,109 @@
+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();