On Thursday 07 December 2006 15:45, Steffen Schuetz wrote:
> And the second problem was loosing promiscuous mode on the card.
Yeah, pcap_set_datalink() calls bpf_setdlt() which calls bpf_detachd() which
disables promisc.
The 1st diff below changes the order in Packetsourcetracker::BindSources() so
that pcap_set_datalink() happens before the interface is configured for
monitor mode.
The 2nd diff fixes an apm display bug in the client.
There's another bug that's causing Kismet to see far fewer packets than it
should, I'm looking into that.
Please test.
--- /dev/null Fri Dec 8 19:50:48 2006
+++ patches/patch-packetsourcetracker_cc Fri Dec 8 19:29:34 2006
@@ -0,0 +1,55 @@
+$OpenBSD$
+--- packetsourcetracker.cc.orig Fri Dec 8 19:19:30 2006
++++ packetsourcetracker.cc Fri Dec 8 19:23:38 2006
+@@ -670,25 +670,6 @@ int Packetsourcetracker::BindSources(int
+ return -1;
+ }
+
+- // Enable monitor mode
+- int ret = 0;
+- if (meta->prototype->monitor_enable != NULL) {
+- fprintf(stderr, "Source %d (%s): Enabling monitor mode for %s source "
+- "interface %s channel %d...\n",
+- x, meta->name.c_str(), meta->prototype->cardtype.c_str(),
+- meta->device.c_str(), meta->cur_ch);
+-
+- ret = (*meta->prototype->monitor_enable)(meta->device.c_str(),
+- meta->cur_ch, errstr,
+- &meta->stored_interface,
+- (void *) meta->capsource);
+- }
+-
+- if (ret < 0) {
+- // Errstr gets filled out by the monitor command via reference argument
+- return -1;
+- }
+-
+ // Add it to the live sources vector
+ live_packsources.push_back(meta->capsource);
+
+@@ -703,6 +684,25 @@ int Packetsourcetracker::BindSources(int
+ if (meta->capsource->OpenSource() < 0) {
+ meta->valid = 0;
+ snprintf(errstr, 1024, "%s", meta->capsource->FetchError());
++ return -1;
++ }
++
++ // Enable monitor mode
++ int ret = 0;
++ if (meta->prototype->monitor_enable != NULL) {
++ fprintf(stderr, "Source %d (%s): Enabling monitor mode for %s source "
++ "interface %s channel %d...\n",
++ x, meta->name.c_str(), meta->prototype->cardtype.c_str(),
++ meta->device.c_str(), meta->cur_ch);
++
++ ret = (*meta->prototype->monitor_enable)(meta->device.c_str(),
++ meta->cur_ch, errstr,
++ &meta->stored_interface,
++ (void *) meta->capsource);
++ }
++
++ if (ret < 0) {
++ // Errstr gets filled out by the monitor command via reference argument
+ return -1;
+ }
+
Index: patches/patch-panelfront_cc
===================================================================
RCS file: /cvs/ports/net/kismet/patches/patch-panelfront_cc,v
retrieving revision 1.4
diff -u -r1.4 patch-panelfront_cc
--- patches/patch-panelfront_cc 1 Nov 2006 21:13:20 -0000 1.4
+++ patches/patch-panelfront_cc 8 Dec 2006 22:37:17 -0000
@@ -2,8 +2,8 @@
# Make this work on archs without apm. Fix battery display.
---- panelfront.cc.orig Wed Jun 29 20:04:43 2005
-+++ panelfront.cc Fri Oct 20 13:42:27 2006
+--- panelfront.cc.orig Wed Jun 29 19:04:43 2005
++++ panelfront.cc Fri Dec 8 21:39:00 2006
@@ -22,7 +22,7 @@
#include <sys/types.h>
#include <dirent.h>
@@ -50,7 +50,21 @@
struct apm_power_info api;
int apmfd;
-@@ -1561,7 +1561,7 @@ int PanelFront::Tick() {
+@@ -1543,11 +1543,13 @@ int PanelFront::Tick() {
+ if ((apmfd = open("/dev/apm", O_RDONLY)) < 0) {
+ bat_available = 0;
+ WriteStatus("Unable to open /dev/apm\n");
++ monitor_bat = 0;
+ return 1;
+ } else if (ioctl(apmfd, APM_IOC_GETPOWER, &api) < 0) {
+ bat_available = 0;
+ WriteStatus("Apm ioctl failed\n");
+ close(apmfd);
++ monitor_bat = 0;
+ return 1;
+ } else {
+ close(apmfd);
+@@ -1561,7 +1563,7 @@ int PanelFront::Tick() {
}
if (bat_available == 1) {
bat_percentage = (int)api.battery_life;