add rml's netdev-random patch and modify et to use it (finally some entropy on /dev...
[oweals/openwrt.git] / openwrt / package / kismet / patches / remove-sources.patch
1 diff -urN kismet-2005-04-R1.old/kismet_drone.cc kismet-2005-04-R1.dev/kismet_drone.cc
2 --- kismet-2005-04-R1.old/kismet_drone.cc       2005-04-03 07:33:42.000000000 +0200
3 +++ kismet-2005-04-R1.dev/kismet_drone.cc       2005-04-27 17:10:22.000000000 +0200
4 @@ -32,11 +32,8 @@
5  #include "packet.h"
6  
7  #include "packetsource.h"
8 -#include "prism2source.h"
9  #include "pcapsource.h"
10  #include "wtapfilesource.h"
11 -#include "wsp100source.h"
12 -#include "vihasource.h"
13  #include "dronesource.h"
14  #include "packetsourcetracker.h"
15  #include "kis_packsources.h"
16 diff -urN kismet-2005-04-R1.old/kismet_server.cc kismet-2005-04-R1.dev/kismet_server.cc
17 --- kismet-2005-04-R1.old/kismet_server.cc      2005-04-03 07:33:42.000000000 +0200
18 +++ kismet-2005-04-R1.dev/kismet_server.cc      2005-04-27 17:10:35.000000000 +0200
19 @@ -37,11 +37,8 @@
20  #include "packet.h"
21  
22  #include "packetsource.h"
23 -#include "prism2source.h"
24  #include "pcapsource.h"
25  #include "wtapfilesource.h"
26 -#include "wsp100source.h"
27 -#include "vihasource.h"
28  #include "dronesource.h"
29  #include "packetsourcetracker.h"
30  #include "kis_packsources.h"
31 diff -urN kismet-2005-04-R1.old/kis_packsources.cc kismet-2005-04-R1.dev/kis_packsources.cc
32 --- kismet-2005-04-R1.old/kis_packsources.cc    2005-04-03 07:33:42.000000000 +0200
33 +++ kismet-2005-04-R1.dev/kis_packsources.cc    2005-04-27 17:11:22.000000000 +0200
34 @@ -58,15 +58,10 @@
35      REG_EMPTY_CARD(sourcetracker, "pcapfile");
36  #endif
37  
38 +    REG_EMPTY_CARD(sourcetracker, "cisco");
39 +    REG_EMPTY_CARD(sourcetracker, "cisco_wifix");
40  #if defined(HAVE_LIBPCAP) && defined(HAVE_LINUX_WIRELESS)
41      // Linux wext-driven cards
42 -    sourcetracker->RegisterPacketsource("cisco", 1, "IEEE80211b", 6,
43 -                                       pcapsource_wext_registrant,
44 -                                       monitor_cisco, unmonitor_cisco, 
45 -                                       chancontrol_wext, 1);
46 -    sourcetracker->RegisterPacketsource("cisco_wifix", 1, "IEEE80211b", 6,
47 -                                       pcapsource_ciscowifix_registrant,
48 -                                       monitor_cisco_wifix, NULL, NULL, 1);
49      sourcetracker->RegisterPacketsource("hostap", 1, "IEEE80211b", 6,
50                                         pcapsource_wext_registrant,
51                                         monitor_hostap, unmonitor_hostap, 
52 @@ -142,8 +137,6 @@
53  
54  #else
55      // Register the linuxwireless pcap stuff as null
56 -    REG_EMPTY_CARD(sourcetracker, "cisco");
57 -    REG_EMPTY_CARD(sourcetracker, "cisco_wifix");
58      REG_EMPTY_CARD(sourcetracker, "hostap");
59      REG_EMPTY_CARD(sourcetracker, "orinoco");
60      REG_EMPTY_CARD(sourcetracker, "acx100");
61 @@ -179,14 +172,7 @@
62      REG_EMPTY_CARD(sourcetracker, "wrt54g");
63  #endif
64  
65 -#if defined(SYS_LINUX) && defined(HAVE_LINUX_NETLINK)
66 -    sourcetracker->RegisterPacketsource("wlanng_legacy", 1, "IEEE80211b", 6,
67 -                                        prism2source_registrant,
68 -                                        monitor_wlanng_legacy, NULL,
69 -                                        chancontrol_wlanng_legacy, 1);
70 -#else
71      REG_EMPTY_CARD(sourcetracker, "wlanng_legacy");
72 -#endif
73  
74  #if defined(HAVE_LIBPCAP) && defined(SYS_OPENBSD)
75      sourcetracker->RegisterPacketsource("cisco_openbsd", 1, "IEEE80211b", 6,
76 @@ -228,21 +214,8 @@
77      REG_EMPTY_CARD(sourcetracker, "wtapfile");
78  #endif
79  
80 -#if defined(HAVE_WSP100)
81 -    sourcetracker->RegisterPacketsource("wsp100", 0, "IEEE80211b", 6,
82 -                                        wsp100source_registrant,
83 -                                        monitor_wsp100, NULL, chancontrol_wsp100, 0);
84 -#else
85      REG_EMPTY_CARD(sourcetracker, "wsp100");
86 -#endif
87 -
88 -#if defined(HAVE_VIHAHEADERS)
89 -    sourcetracker->RegisterPacketsource("viha", 1, "IEEE80211b", 6,
90 -                                        vihasource_registrant,
91 -                                        NULL, NULL, chancontrol_viha, 0);
92 -#else
93      REG_EMPTY_CARD(sourcetracker, "viha");
94 -#endif
95  
96      return 1;
97  }
98 diff -urN kismet-2005-04-R1.old/kis_packsources.h kismet-2005-04-R1.dev/kis_packsources.h
99 --- kismet-2005-04-R1.old/kis_packsources.h     2005-04-03 07:33:42.000000000 +0200
100 +++ kismet-2005-04-R1.dev/kis_packsources.h     2005-04-27 17:10:43.000000000 +0200
101 @@ -22,11 +22,8 @@
102  #include "config.h"
103  
104  #include "packetsource.h"
105 -#include "prism2source.h"
106  #include "pcapsource.h"
107  #include "wtapfilesource.h"
108 -#include "wsp100source.h"
109 -#include "vihasource.h"
110  #include "dronesource.h"
111  #include "packetsourcetracker.h"
112  
113 diff -urN kismet-2005-04-R1.old/Makefile.in kismet-2005-04-R1.dev/Makefile.in
114 --- kismet-2005-04-R1.old/Makefile.in   2005-04-03 07:33:42.000000000 +0200
115 +++ kismet-2005-04-R1.dev/Makefile.in   2005-04-27 17:10:09.000000000 +0200
116 @@ -40,8 +40,8 @@
117  
118  # Objects
119  PSO    = util.o ringbuf.o configfile.o speech.o ifcontrol.o iwcontrol.o packet.o \
120 -               pcapsource.o prism2source.o wtapfilesource.o wsp100source.o \
121 -               dronesource.o vihasource.o packetsourcetracker.o kis_packsources.o \
122 +               pcapsource.o wtapfilesource.o \
123 +               dronesource.o packetsourcetracker.o kis_packsources.o \
124                 wtapdump.o wtaplocaldump.o gpsdump.o airsnortdump.o fifodump.o \
125                 gpsd.o manuf.o \
126                 packetracker.o timetracker.o alertracker.o finitestate.o \
127 @@ -50,8 +50,8 @@
128  PS     = kismet_server
129  
130  DRONEO = util.o ringbuf.o configfile.o getopt.o ifcontrol.o iwcontrol.o packet.o \
131 -               tcpstreamer.o prism2source.o pcapsource.o wtapfilesource.o wsp100source.o \
132 -               dronesource.o vihasource.o packetsourcetracker.o kis_packsources.o \
133 +               tcpstreamer.o pcapsource.o wtapfilesource.o \
134 +               dronesource.o packetsourcetracker.o kis_packsources.o \
135                 timetracker.o gpsd.o server_globals.o kismet_drone.o
136  DRONE = kismet_drone
137  
138 diff -urN kismet-2005-04-R1.old/pcapsource.cc kismet-2005-04-R1.dev/pcapsource.cc
139 --- kismet-2005-04-R1.old/pcapsource.cc 2005-04-03 07:33:42.000000000 +0200
140 +++ kismet-2005-04-R1.dev/pcapsource.cc 2005-04-27 16:58:10.000000000 +0200
141 @@ -282,8 +282,6 @@
142  
143      if (datalink_type == DLT_PRISM_HEADER) {
144          ret = Prism2KisPack(packet, data, moddata);
145 -    } else if (datalink_type == KDLT_BSD802_11) {
146 -        ret = BSD2KisPack(packet, data, moddata);
147  #ifdef HAVE_RADIOTAP
148      } else if (datalink_type == DLT_IEEE802_11_RADIO) {
149          ret = Radiotap2KisPack(packet, data, moddata);
150 @@ -418,46 +416,6 @@
151  
152  }
153  
154 -int PcapSource::BSD2KisPack(kis_packet *packet, uint8_t *data, uint8_t *moddata) {
155 -    int callback_offset = 0;
156 -
157 -    // Process our hacked in BSD type
158 -    if (callback_header.caplen < sizeof(bsd_80211_header)) {
159 -        snprintf(errstr, 1024, "pcap bsd converter saw undersized capture frame for bsd header.");
160 -        packet->len = 0;
161 -        packet->caplen = 0;
162 -        return 0;
163 -    }
164 -
165 -    packet->caplen = kismin(callback_header.caplen - sizeof(bsd_80211_header), 
166 -                            (uint32_t) MAX_PACKET_LEN);
167 -    packet->len = packet->caplen;
168 -
169 -    bsd_80211_header *bsdhead = (bsd_80211_header *) callback_data;
170 -
171 -    packet->signal = bsdhead->wi_signal;
172 -    packet->noise = bsdhead->wi_silence;
173 -
174 -    // Set our offset
175 -    callback_offset = sizeof(bsd_80211_header);
176 -    memcpy(packet->data, callback_data + callback_offset, 24);
177 -
178 -    // Adjust for driver appended headers
179 -    if (packet->data[0] > 0x08) {
180 -        packet->len -= 22;
181 -        packet->caplen -= 22;
182 -        memcpy(packet->data + 24, callback_data + callback_offset + 46, 
183 -               packet->caplen - 2);
184 -    } else {
185 -        packet->len -= 30;
186 -        packet->caplen -= 30;
187 -        memcpy(packet->data + 24, callback_data + callback_offset + 46, 
188 -               packet->caplen - 2);
189 -    }
190 -
191 -    return 1;
192 -}
193 -
194  #ifdef HAVE_RADIOTAP
195  /*
196   * Convert MHz frequency to IEEE channel number.
197 @@ -949,17 +907,6 @@
198      return new PcapSourceWextFCS(in_name, in_device);
199  }
200  
201 -KisPacketSource *pcapsource_ciscowifix_registrant(string in_name, string in_device, char *in_err) {
202 -    vector<string> devbits = StrTokenize(in_device, ":");
203 -
204 -    if (devbits.size() < 2) {
205 -        snprintf(in_err, STATUS_MAX, "Invalid device pair '%s'", in_device.c_str());
206 -        return NULL;
207 -    }
208 -
209 -    return new PcapSourceWext(in_name, devbits[1]);
210 -}
211 -
212  KisPacketSource *pcapsource_11g_registrant(string in_name, string in_device,
213                                             char *in_err) {
214      return new PcapSource11G(in_name, in_device);
215 @@ -1004,132 +951,6 @@
216  
217  // Monitor commands
218  #ifdef HAVE_LINUX_WIRELESS
219 -// Cisco uses its own config file in /proc to control modes
220 -int monitor_cisco(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
221 -    FILE *cisco_config;
222 -    char cisco_path[128];
223 -
224 -    linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
225 -    (*in_if) = ifparm;
226 -
227 -    if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
228 -        return -1;
229 -    }
230 -
231 -    if (Iwconfig_Get_SSID(in_dev, in_err, ifparm->essid) < 0)
232 -        return -1;
233 -
234 -    if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
235 -        return -1;
236 -
237 -    if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
238 -        return -1;
239 -
240 -    if (Ifconfig_Delta_Flags(in_dev, in_err, IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
241 -        return -1;
242 -
243 -    // Try the iwpriv
244 -    if (Iwconfig_Set_IntPriv(in_dev, "setRFMonitor", 1, 0, in_err) >= 0) {
245 -        return 0;
246 -    }
247 -
248 -    // Zero the ssid - nonfatal
249 -    Iwconfig_Set_SSID(in_dev, in_err, NULL);
250 -   
251 -    // Build the proc control path
252 -    snprintf(cisco_path, 128, "/proc/driver/aironet/%s/Config", in_dev);
253 -
254 -    if ((cisco_config = fopen(cisco_path, "w")) == NULL) {
255 -        snprintf(in_err, STATUS_MAX, "Unable to open cisco control file '%s' %d:%s",
256 -                 cisco_path, errno, strerror(errno));
257 -        return -1;
258 -    }
259 -
260 -    fprintf(cisco_config, "Mode: r\n");
261 -    fprintf(cisco_config, "Mode: y\n");
262 -    fprintf(cisco_config, "XmitPower: 1\n");
263 -
264 -    fclose(cisco_config);
265 -
266 -    // Channel can't be set on cisco with these drivers.
267 -
268 -    return 0;
269 -}
270 -
271 -int unmonitor_cisco(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
272 -    linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
273 -    int ret = -1;
274 -
275 -    // Try the iwpriv
276 -    if (Iwconfig_Set_IntPriv(in_dev, "setRFMonitor", 0, 0, in_err) >= 0) {
277 -        // If we're the new drivers, unmonitor
278 -        if (Ifconfig_Set_Flags(in_dev, in_err, ifparm->flags) < 0) {
279 -            return -1;
280 -        }
281 -
282 -        // Reset the SSID since monitor mode nukes it
283 -        if (Iwconfig_Set_SSID(in_dev, in_err, ifparm->essid) < 0)
284 -            return -1;
285 -
286 -        if (ifparm->channel > 0) {
287 -            if (Iwconfig_Set_Channel(in_dev, ifparm->channel, in_err) < 0)
288 -                return -1;
289 -        }
290 -
291 -        ret = 1;
292 -    }
293 -
294 -    free(ifparm);
295 -
296 -    return ret;
297 -}
298 -
299 -// Cisco uses its own config file in /proc to control modes
300 -//
301 -// I was doing this with ioctls but that seems to cause lockups while
302 -// this method doesn't.  I don't think I like these drivers.
303 -int monitor_cisco_wifix(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
304 -    FILE *cisco_config;
305 -    char cisco_path[128];
306 -    vector<string> devbits = StrTokenize(in_dev, ":");
307 -
308 -    if (devbits.size() < 2) {
309 -        snprintf(in_err, STATUS_MAX, "Invalid device pair '%s'", in_dev);
310 -        return -1;
311 -    }
312 -
313 -    // Bring the device up, zero its ip, and set promisc
314 -    if (Ifconfig_Delta_Flags(devbits[0].c_str(), in_err, 
315 -                             IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
316 -        return -1;
317 -    if (Ifconfig_Delta_Flags(devbits[1].c_str(), in_err, 
318 -                             IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
319 -        return -1;
320 -
321 -    // Zero the ssid, nonfatally
322 -    Iwconfig_Set_SSID(devbits[0].c_str(), in_err, NULL);
323 -    Iwconfig_Set_SSID(devbits[1].c_str(), in_err, NULL);
324 -    
325 -    // Build the proc control path
326 -    snprintf(cisco_path, 128, "/proc/driver/aironet/%s/Config", devbits[0].c_str());
327 -
328 -    if ((cisco_config = fopen(cisco_path, "w")) == NULL) {
329 -        snprintf(in_err, STATUS_MAX, "Unable to open cisco control file '%s' %d:%s",
330 -                 cisco_path, errno, strerror(errno));
331 -        return -1;
332 -    }
333 -
334 -    fprintf(cisco_config, "Mode: r\n");
335 -    fprintf(cisco_config, "Mode: y\n");
336 -    fprintf(cisco_config, "XmitPower: 1\n");
337 -
338 -    fclose(cisco_config);
339 -
340 -    // Channel can't be set on cisco with these drivers.
341 -
342 -    return 0;
343 -}
344 -
345  // Hostap uses iwpriv and iwcontrol settings to control monitor mode
346  int monitor_hostap(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
347      int ret;