Kismet Wireless

Kismet Forums

 

Posted by:tegg
Subject:kismet_drone with the kismet_server on OS X
Date:13:48:46 24/10/2006

I've had some problems getting kismet_server running os my Mac to talk to a kismet_drone I have running on a WRT54G. This now works for me, so I thought I'd share what I'd found out.

When I ran it I was getting FATAL: version mistmach messages.
I saw a previous post mentioning this was a problem with structure packing. Turns out this is the problem. The drone is sending a packed structure, but the gcc Apple ships ignore the packing the way it in done is done in the kismet code.

There is an easy workaround though, as the whole struct is packed, the struct itself can be specified as packed, rather than each of its elements. The stock Apple compiler now properly packs the structures, and the server can communicate to the drone. I've included a diff below.

This change could also be made to the kismet source as it will also not change how the packing behaves under linux.

Cheers,
Pete

diff for packetstream.h (it's a bit long, sorry):

--- packetstream.h 2005-05-26 16:51:45.000000000 +0200
+++ packetstream_new.h 2006-10-24 15:43:42.000000000 +0200
@@ -38,10 +38,10 @@
#define STREAM_COMMAND_FLUSH -1

typedef struct stream_frame_header {
- uint32_t frame_sentinel __attribute__ ((packed));
- uint8_t frame_type __attribute__ ((packed));
- uint32_t frame_len __attribute__ ((packed));
-};
+ uint32_t frame_sentinel;
+ uint8_t frame_type;
+ uint32_t frame_len;
+} __attribute__ ((packed));

typedef struct stream_version_packet {
uint16_t drone_version;
@@ -49,34 +49,34 @@
};

typedef struct stream_packet_header {
- uint32_t header_len __attribute__ ((packed));
- uint16_t drone_version __attribute__ ((packed));
- uint32_t len __attribute__ ((packed));
- uint32_t caplen __attribute__ ((packed));
- uint64_t tv_sec __attribute__ ((packed));
- uint64_t tv_usec __attribute__ ((packed));
- uint16_t quality __attribute__ ((packed));
- uint16_t signal __attribute__ ((packed));
- uint16_t noise __attribute__ ((packed));
- uint8_t error __attribute__ ((packed));
- uint8_t channel __attribute__ ((packed));
- uint8_t carrier __attribute__ ((packed));
- uint8_t encoding __attribute__ ((packed));
- uint32_t datarate __attribute__ ((packed));
-
- int16_t gps_lat __attribute__ ((packed));
- int64_t gps_lat_mant __attribute__ ((packed));
- int16_t gps_lon __attribute__ ((packed));
- int64_t gps_lon_mant __attribute__ ((packed));
- int16_t gps_alt __attribute__ ((packed));
- int64_t gps_alt_mant __attribute__ ((packed));
- int16_t gps_spd __attribute__ ((packed));
- int64_t gps_spd_mant __attribute__ ((packed));
- int16_t gps_heading __attribute__ ((packed));
- int64_t gps_heading_mant __attribute__ ((packed));
- int8_t gps_fix __attribute__ ((packed));
+ uint32_t header_len;
+ uint16_t drone_version;
+ uint32_t len;
+ uint32_t caplen;
+ uint64_t tv_sec;
+ uint64_t tv_usec;
+ uint16_t quality;
+ uint16_t signal;
+ uint16_t noise;
+ uint8_t error;
+ uint8_t channel;
+ uint8_t carrier;
+ uint8_t encoding;
+ uint32_t datarate;
+
+ int16_t gps_lat;
+ int64_t gps_lat_mant;
+ int16_t gps_lon;
+ int64_t gps_lon_mant;
+ int16_t gps_alt;
+ int64_t gps_alt_mant ;
+ int16_t gps_spd;
+ int64_t gps_spd_mant;
+ int16_t gps_heading;
+ int64_t gps_heading_mant;
+ int8_t gps_fix;

- uint8_t sourcename[32] __attribute__ ((packed));
-};
+ uint8_t sourcename[32];
+} __attribute__ ((packed));

#endif


Reply to this message