summaryrefslogtreecommitdiff
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
commit5fdaea419cd71eed4dcc752f2e0803b2bde6f06f (patch)
treeb3ad550341df9e61861239ec54b2a60e793a9744
parentedcca4b8d49ddad3c62d4b89fada96421185b04e (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/openwrt@1548 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/kismet/files/kismet.conf4
-rw-r--r--package/kismet/files/kismet_drone.conf4
-rw-r--r--package/kismet/patches/130-wrt54g_source.patch109
3 files changed, 115 insertions, 2 deletions
diff --git a/package/kismet/files/kismet.conf b/package/kismet/files/kismet.conf
index 1f750a60c9..a417d2885b 100644
--- a/package/kismet/files/kismet.conf
+++ b/package/kismet/files/kismet.conf
@@ -18,7 +18,9 @@ suiduser=nobody
# The initial channel is optional, if hopping is not enabled it can be used
# to set the channel the interface listens on.
# YOU MUST CHANGE THIS TO BE THE SOURCE YOU WANT TO USE
-source=wrt54g,prism0,wireless
+source=wrt54g,eth1,wireless
+# For v1 hardware uncomment this:
+# source=wrt54g,eth2,wireless
# Comma-separated list of sources to enable. This is only needed if you defined
# multiple sources and only want to enable some of them. By default, all defined
diff --git a/package/kismet/files/kismet_drone.conf b/package/kismet/files/kismet_drone.conf
index a485471339..901b5b83e1 100644
--- a/package/kismet/files/kismet_drone.conf
+++ b/package/kismet/files/kismet_drone.conf
@@ -48,7 +48,9 @@ maxclients=5
# enablesources line to enable them. For example:
# source=prism2,wlan0,prism
# source=cisco,eth0,cisco
-source=wrt54g,prism0,wireless
+source=wrt54g,eth1,wireless
+# For v1 hardware uncomment this:
+# source=wrt54g,eth2,wireless
# Comma-separated list of sources to enable. This is only needed if you wish
# to selectively enable multiple sources.
diff --git a/package/kismet/patches/130-wrt54g_source.patch b/package/kismet/patches/130-wrt54g_source.patch
new file mode 100644
index 0000000000..9192224c6e
--- /dev/null
+++ b/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();