1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
$NetBSD: patch-ac,v 1.3 2008/10/28 11:06:38 adam Exp $
--- pcapsource.cc.orig 2008-05-21 17:56:43.000000000 +0200
+++ pcapsource.cc
@@ -72,12 +72,15 @@ extern "C" {
}
#endif
-#ifdef SYS_FREEBSD
+#if defined(SYS_FREEBSD) || defined(__DragonFly__)
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_media.h>
-#ifdef HAVE_RADIOTAP
+#if defined(__DragonFly__)
+#include <netproto/802_11/ieee80211_ioctl.h>
+#include <netproto/802_11/ieee80211_radiotap.h>
+#elif defined HAVE_RADIOTAP
#include <net80211/ieee80211_ioctl.h>
#include <net80211/ieee80211_radiotap.h>
#endif
@@ -247,7 +250,7 @@ int PcapSource::DatalinkType() {
datalink_type = pcap_datalink(pd);
// Blow up if we're not valid 802.11 headers
-#if (defined(SYS_FREEBSD) || defined(SYS_OPENBSD)) || defined(SYS_NETBSD)
+#if (defined(SYS_FREEBSD) || defined(SYS_OPENBSD)) || defined(SYS_NETBSD) || defined(__DragonFly__)
if (datalink_type == DLT_EN10MB) {
fprintf(stderr, "WARNING: pcap reports link type of EN10MB but we'll fake "
"it on BSD.\n"
@@ -1167,7 +1170,7 @@ carrier_type PcapSourceWrt54g::IEEE80211
}
#endif
-#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD)))
+#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD) || defined(__DragonFly__)))
int PcapSourceRadiotap::OpenSource() {
// XXX this is a hack to avoid duplicating code
int s = PcapSource::OpenSource();
@@ -1289,7 +1292,7 @@ KisPacketSource *pcapsource_openbsdprism
}
#endif
-#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD)))
+#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD) || defined(__DragonFly__)))
KisPacketSource *pcapsource_radiotap_registrant(string in_name, string in_device,
char *in_err) {
return new PcapSourceRadiotap(in_name, in_device);
@@ -2997,7 +3000,7 @@ int chancontrol_openbsd_prism2(const cha
}
#endif
-#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD)))
+#if (defined(HAVE_RADIOTAP) && (defined(SYS_NETBSD) || defined(SYS_OPENBSD) || defined(SYS_FREEBSD) || defined(__DragonFly__)))
RadiotapBSD::RadiotapBSD(const char *name) : ifname(name) {
s = -1;
}
@@ -3148,7 +3151,7 @@ bool RadiotapBSD::set80211(int type, int
return true;
}
-#elif defined(SYS_FREEBSD) /* FreeBSD has a generic 802.11 ioctl */
+#elif defined(SYS_FREEBSD) || defined(__DragonFly__) /* FreeBSD has a generic 802.11 ioctl */
bool RadiotapBSD::get80211(int type, int& val, int len, u_int8_t *data) {
struct ieee80211req ireq;
@@ -3198,7 +3201,7 @@ bool RadiotapBSD::getifflags(int& flags)
}
#if defined(SYS_FREEBSD)
flags = (ifr.ifr_flags & 0xffff) | (ifr.ifr_flagshigh << 16);
-#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD)
+#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD) || defined(__DragonFly__)
flags = ifr.ifr_flags;
#endif
return true;
@@ -3215,7 +3218,7 @@ bool RadiotapBSD::setifflags(int flags)
#if defined(SYS_FREEBSD)
ifr.ifr_flags = flags & 0xffff;
ifr.ifr_flagshigh = flags >> 16;
-#elif defined(SYS_OPENBSD) || (SYS_NETBSD)
+#elif defined(SYS_OPENBSD) || (SYS_NETBSD) || defined(__DragonFly__)
ifr.ifr_flags = flags;
#endif
if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) {
@@ -3246,7 +3249,7 @@ bool RadiotapBSD::monitor_enable(int ini
}
#if defined(SYS_FREEBSD)
if (!setifflags(prev_flags | IFF_PPROMISC | IFF_UP)) {
-#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD)
+#elif defined(SYS_OPENBSD) || defined(SYS_NETBSD) || defined(__DragonFly__)
if (!setifflags(prev_flags | IFF_PROMISC | IFF_UP)) {
#endif
(void) set80211(IEEE80211_IOC_CHANNEL, prev_chan, 0, NULL);
|