pkgsrc/net/kismet/patches/patch-ac
2006-10-09 18:48:35 +00:00

104 lines
4.1 KiB
Text

$NetBSD: patch-ac,v 1.2 2006/10/09 18:48:35 joerg Exp $
--- pcapsource.cc.orig 2006-04-02 15:13:00.000000000 +0000
+++ pcapsource.cc
@@ -44,7 +44,9 @@ typedef unsigned long u64;
#include <net/if_media.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
+#if defined(SYS_OPENBSD)
#include <dev/ic/if_wi_ieee.h>
+#endif
#ifdef HAVE_RADIOTAP
#include <net80211/ieee80211.h>
@@ -54,12 +56,15 @@ typedef unsigned long u64;
#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
@@ -185,7 +190,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"
@@ -983,7 +988,7 @@ int PcapSourceOpenBSDPrism::FetchChannel
}
#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();
@@ -1097,7 +1102,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);
@@ -2698,7 +2703,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;
}
@@ -2849,7 +2854,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;
@@ -2898,7 +2903,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;
@@ -2915,7 +2920,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) {
@@ -2946,7 +2951,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);